Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96834
b: refs/heads/master
c: e9623b3
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner committed May 17, 2008
1 parent 6e94331 commit 07bcf6b
Show file tree
Hide file tree
Showing 2 changed files with 29 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: 31f4d870b02e1590260ab7f2a9ff74306bd27e88
refs/heads/master: e9623b35599fcdbc00c16535cbefbb4d5578f4ab
29 changes: 28 additions & 1 deletion trunk/arch/x86/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,33 @@ static void poll_idle(void)
cpu_relax();
}

/*
* mwait selection logic:
*
* It depends on the CPU. For AMD CPUs that support MWAIT this is
* wrong. Family 0x10 and 0x11 CPUs will enter C1 on HLT. Powersavings
* then depend on a clock divisor and current Pstate of the core. If
* all cores of a processor are in halt state (C1) the processor can
* enter the C1E (C1 enhanced) state. If mwait is used this will never
* happen.
*
* idle=mwait overrides this decision and forces the usage of mwait.
*/
static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
{
if (force_mwait)
return 1;

if (c->x86_vendor == X86_VENDOR_AMD) {
switch(c->x86) {
case 0x10:
case 0x11:
return 0;
}
}
return 1;
}

void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
{
static int selected;
Expand All @@ -122,7 +149,7 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
" performance may degrade.\n");
}
#endif
if (cpu_has(c, X86_FEATURE_MWAIT)) {
if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) {
/*
* Skip, if setup has overridden idle.
* One CPU supports mwait => All CPUs supports mwait
Expand Down

0 comments on commit 07bcf6b

Please sign in to comment.