Commit-ID:  7e98b71920464b8d15fa95c74366416cd3c88861
Gitweb:     http://git.kernel.org/tip/7e98b71920464b8d15fa95c74366416cd3c88861
Author:     H. Peter Anvin <h...@linux.intel.com>
AuthorDate: Thu, 19 Dec 2013 11:58:16 -0800
Committer:  H. Peter Anvin <h...@linux.intel.com>
CommitDate: Thu, 19 Dec 2013 11:58:16 -0800

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 <h...@linux.intel.com>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Len Brown <len.br...@intel.com>
Link: 
http://lkml.kernel.org/r/ca%2b55afzgxcml7j8cevqpyzh0w81uvoaavmgctmouz7cz1yy...@mail.gmail.com
---
 arch/x86/include/asm/mwait.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h
index 361b02e..19b71c4 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)
 static inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
 {
        if (!current_set_polling_and_test()) {
-               if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
+               if (static_cpu_has(X86_FEATURE_CLFLUSH_MONITOR)) {
+                       mb();
                        clflush((void *)&current_thread_info()->flags);
+                       mb();
+               }
 
                __monitor((void *)&current_thread_info()->flags, 0, 0);
                if (!need_resched())
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to