Skip to content

Commit

Permalink
x86: move warning message of polling idle and HT enabled
Browse files Browse the repository at this point in the history
The warning message at idle_setup() is never shown because
smp_num_sibling hasn't been updated at this point yet.

Move this polling idle and HT enabled warning to select_idle_routine().
I also implement this warning on 64-bit kernel.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Hiroshi Shimamoto authored and Ingo Molnar committed Jan 30, 2008
1 parent 2274c33 commit 27415a4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
18 changes: 12 additions & 6 deletions arch/x86/kernel/process_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,28 +295,34 @@ static int mwait_usable(const struct cpuinfo_x86 *c)

void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
{
static int selected;

if (selected)
return;
#ifdef CONFIG_X86_SMP
if (pm_idle == poll_idle && smp_num_siblings > 1) {
printk(KERN_WARNING "WARNING: polling idle and HT enabled,"
" performance may degrade.\n");
}
#endif
if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) {
printk("monitor/mwait feature present.\n");
/*
* Skip, if setup has overridden idle.
* One CPU supports mwait => All CPUs supports mwait
*/
if (!pm_idle) {
printk("using mwait in idle threads.\n");
printk(KERN_INFO "using mwait in idle threads.\n");
pm_idle = mwait_idle;
}
}
selected = 1;
}

static int __init idle_setup(char *str)
{
if (!strcmp(str, "poll")) {
printk("using polling idle threads.\n");
pm_idle = poll_idle;
#ifdef CONFIG_X86_SMP
if (smp_num_siblings > 1)
printk("WARNING: polling idle and HT enabled, performance may degrade.\n");
#endif
} else if (!strcmp(str, "mwait"))
force_mwait = 1;
else
Expand Down
17 changes: 12 additions & 5 deletions arch/x86/kernel/process_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,20 +291,27 @@ static int mwait_usable(const struct cpuinfo_x86 *c)

void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
{
static int printed;
static int selected;

if (selected)
return;
#ifdef CONFIG_X86_SMP
if (pm_idle == poll_idle && smp_num_siblings > 1) {
printk(KERN_WARNING "WARNING: polling idle and HT enabled,"
" performance may degrade.\n");
}
#endif
if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) {
/*
* Skip, if setup has overridden idle.
* One CPU supports mwait => All CPUs supports mwait
*/
if (!pm_idle) {
if (!printed) {
printk(KERN_INFO "using mwait in idle threads.\n");
printed = 1;
}
printk(KERN_INFO "using mwait in idle threads.\n");
pm_idle = mwait_idle;
}
}
selected = 1;
}

static int __init idle_setup(char *str)
Expand Down

0 comments on commit 27415a4

Please sign in to comment.