diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2013-12-19 14:58:16 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2013-12-19 14:58:16 -0500 |
commit | 7e98b71920464b8d15fa95c74366416cd3c88861 (patch) | |
tree | e33e2af9f6a1813490aa686619de72c67b159e81 | |
parent | 16824255394f55adf31b9a96a9965d8c15bdac4c (diff) |
x86, idle: Use static_cpu_has() for CLFLUSH workaround, add barriers
Use static_cpu_has() to conditionalize the CLFLUSH workaround, and add
memory barriers around it since the documentation is explicit that
CLFLUSH is only ordered with respect to MFENCE.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Len Brown <len.brown@intel.com>
Link: http://lkml.kernel.org/r/CA%2B55aFzGxcML7j8CEvQPYzh0W81uVoAAVmGctMOUZ7CZ1yYd2A@mail.gmail.com
-rw-r--r-- | arch/x86/include/asm/mwait.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h index 361b02ef128c..19b71c439256 100644 --- a/arch/x86/include/asm/mwait.h +++ b/arch/x86/include/asm/mwait.h | |||
@@ -43,8 +43,11 @@ static inline void __mwait(unsigned long eax, unsigned long ecx) | |||
43 | static inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) | 43 | static inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) |
44 | { | 44 | { |
45 | if (!current_set_polling_and_test()) { | 45 | if (!current_set_polling_and_test()) { |
46 | if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) | 46 | if (static_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) { |
47 | mb(); | ||
47 | clflush((void *)¤t_thread_info()->flags); | 48 | clflush((void *)¤t_thread_info()->flags); |
49 | mb(); | ||
50 | } | ||
48 | 51 | ||
49 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | 52 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
50 | if (!need_resched()) | 53 | if (!need_resched()) |