mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-18 12:30:31 +00:00
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
This commit is contained in:
parent
1682425539
commit
7e98b71920
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
static inline void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
|
||||||
{
|
{
|
||||||
if (!current_set_polling_and_test()) {
|
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 *)¤t_thread_info()->flags);
|
clflush((void *)¤t_thread_info()->flags);
|
||||||
|
mb();
|
||||||
|
}
|
||||||
|
|
||||||
__monitor((void *)¤t_thread_info()->flags, 0, 0);
|
__monitor((void *)¤t_thread_info()->flags, 0, 0);
|
||||||
if (!need_resched())
|
if (!need_resched())
|
||||||
|
|
Loading…
Add table
Reference in a new issue