Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212050
b: refs/heads/master
c: ce5f682
h: refs/heads/master
v: v3
  • Loading branch information
H. Peter Anvin committed Sep 20, 2010
1 parent 0b9bc47 commit 0316ae6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a68e5c94f7d3dd64fef34dd5d97e365cae4bb42a
refs/heads/master: ce5f68246bf2385d6174856708d0b746dc378f20
20 changes: 19 additions & 1 deletion trunk/arch/x86/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,9 +1394,12 @@ static inline void mwait_play_dead(void)
unsigned int highest_cstate = 0;
unsigned int highest_subcstate = 0;
int i;
void *mwait_ptr;

if (!cpu_has(&current_cpu_data, X86_FEATURE_MWAIT))
return;
if (!cpu_has(&current_cpu_data, X86_FEATURE_CLFLSH))
return;
if (current_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
return;

Expand All @@ -1422,10 +1425,25 @@ static inline void mwait_play_dead(void)
(highest_subcstate - 1);
}

/*
* This should be a memory location in a cache line which is
* unlikely to be touched by other processors. The actual
* content is immaterial as it is not actually modified in any way.
*/
mwait_ptr = &current_thread_info()->flags;

wbinvd();

while (1) {
__monitor(&current_thread_info()->flags, 0, 0);
/*
* The CLFLUSH is a workaround for erratum AAI65 for
* the Xeon 7400 series. It's not clear it is actually
* needed, but it should be harmless in either case.
* The WBINVD is insufficient due to the spurious-wakeup
* case where we return around the loop.
*/
clflush(mwait_ptr);
__monitor(mwait_ptr, 0, 0);
mb();
__mwait(eax, 0);
}
Expand Down

0 comments on commit 0316ae6

Please sign in to comment.