[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YotbuODSnj+M+KaY@BLR-5CG11610CF.amd.com>
Date: Mon, 23 May 2022 15:32:32 +0530
From: "Gautham R. Shenoy" <gautham.shenoy@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: frederic@...nel.org, paulmck@...nel.org, rjw@...ysocki.net,
x86@...nel.org, linux-kernel@...r.kernel.org, jpoimboe@...nel.org
Subject: Re: [RFC][PATCH 9/9] arch/idle: Change arch_cpu_idle() IRQ behaviour
On Thu, May 19, 2022 at 11:27:59PM +0200, Peter Zijlstra wrote:
> Current arch_cpu_idle() is called with IRQs disabled, but will return
> with IRQs enabled.
>
> However, the very first thing the generic code does after calling
> arch_cpu_idle() is raw_local_irq_disable(). This means that
> architectures that can idle with IRQs disabled end up doing a
> pointless 'enable-disable' dance.
>
> Therefore, push this IRQ disabling into the idle function, meaning
> that those architectures can avoid the pointless IRQ state flipping.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
[...]
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -699,6 +699,7 @@ EXPORT_SYMBOL(boot_option_idle_override)
> void __cpuidle default_idle(void)
> {
> raw_safe_halt();
> + raw_local_irq_disable();
> }
> #if defined(CONFIG_APM_MODULE) || defined(CONFIG_HALTPOLL_CPUIDLE_MODULE)
> EXPORT_SYMBOL(default_idle);
> @@ -804,13 +805,7 @@ static void amd_e400_idle(void)
>
> default_idle();
>
> - /*
> - * The switch back from broadcast mode needs to be called with
> - * interrupts disabled.
> - */
> - raw_local_irq_disable();
> tick_broadcast_exit();
> - raw_local_irq_enable();
> }
>
> /*
> @@ -849,12 +844,11 @@ static __cpuidle void mwait_idle(void)
> }
>
> __monitor((void *)¤t_thread_info()->flags, 0, 0);
> - if (!need_resched())
> + if (!need_resched()) {
> __sti_mwait(0, 0);
> - else
> - raw_local_irq_enable();
> + raw_local_irq_disable();
> + }
> } else {
> - raw_local_irq_enable();
> }
We don't need the outer else clause anymore.
> __current_clr_polling();
> }
--
Thanks and Regards
gautham.
Powered by blists - more mailing lists