Re: [patch 33/34] x86: Use generic idle loop

From: Srivatsa S. Bhat
Date: Thu Mar 28 2013 - 11:46:01 EST


On 03/22/2013 03:23 AM, Thomas Gleixner wrote:
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: x86@xxxxxxxxxx
> ---
[...]
> +#define POLL_IDLE (void*) 0x01
> +

[...]

> #ifdef CONFIG_APM_MODULE
> @@ -411,20 +376,6 @@ void stop_this_cpu(void *dummy)
> halt();
> }
>
> -/*
> - * On SMP it's slightly faster (but much more power-consuming!)
> - * to poll the ->work.need_resched flag instead of waiting for the
> - * cross-CPU IPI to arrive. Use this option with caution.
> - */
> -static void poll_idle(void)
> -{
> - trace_cpu_idle_rcuidle(0, smp_processor_id());
> - local_irq_enable();
> - while (!need_resched())
> - cpu_relax();
> - trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
> -}
> -
> bool amd_e400_c1e_detected;
> EXPORT_SYMBOL(amd_e400_c1e_detected);
>
> @@ -489,7 +440,7 @@ static void amd_e400_idle(void)
> void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
> {
> #ifdef CONFIG_SMP
> - if (x86_idle == poll_idle && smp_num_siblings > 1)
> + if (x86_idle == POLL_IDLE && smp_num_siblings > 1)
> pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n");
> #endif
> if (x86_idle)
> @@ -517,8 +468,9 @@ static int __init idle_setup(char *str)
>
> if (!strcmp(str, "poll")) {
> pr_info("using polling idle threads\n");
> - x86_idle = poll_idle;
> + x86_idle = POLL_IDLE;
> boot_option_idle_override = IDLE_POLL;
> + cpu_idle_poll_ctrl(true);

Why is that POLL_IDLE needed? Won't cpu_idle_poll_ctrl() suffice?

By the way, booting with idle=poll locks up the kernel during boot with
this patch applied (I verified it). So I think we should just skip the
whole POLL_IDLE thing and leave the job to cpu_idle_poll_ctrl().


Regards,
Srivatsa S. Bhat

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/