提交 083044e6 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

[PATCH] x86-64: Remove disable_tsc code in context switch

It only offers extremly dubious security advantages and
is not worth the overhead in this critical path.
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 fe5d5f07
......@@ -486,33 +486,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
return err;
}
/*
* This function selects if the context switch from prev to next
* has to tweak the TSC disable bit in the cr4.
*/
static inline void disable_tsc(struct task_struct *prev_p,
struct task_struct *next_p)
{
struct thread_info *prev, *next;
/*
* gcc should eliminate the ->thread_info dereference if
* has_secure_computing returns 0 at compile time (SECCOMP=n).
*/
prev = prev_p->thread_info;
next = next_p->thread_info;
if (has_secure_computing(prev) || has_secure_computing(next)) {
/* slow path here */
if (has_secure_computing(prev) &&
!has_secure_computing(next)) {
write_cr4(read_cr4() & ~X86_CR4_TSD);
} else if (!has_secure_computing(prev) &&
has_secure_computing(next))
write_cr4(read_cr4() | X86_CR4_TSD);
}
}
/*
* This special macro can be used to load a debugging register
*/
......@@ -631,8 +604,6 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *
}
}
disable_tsc(prev_p, next_p);
return prev_p;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册