ieu.desnoy...@efficios.com>, Frederic Weisbecker <frede...@kernel.org>, Len Brown <l...@kernel.org>, linux-xte...@linux-xtensa.org, Sascha Hauer <ker...@pengutronix.de>, Vasily Gorbik <g...@linux.ibm.com>, linux-arm-msm <linux-arm-...@vger.kernel.org>, linux-al...@vger.kernel.org, linux-m68k <linux-m...@lists.linux-m68k.org>, Stafford Horne <sho...@gmail.com>, Linux ARM <linux-arm-ker...@lists.infradead.org>, ch...@zankel.net, Stephen Boyd <sb...@kernel.org>, dingu...@kernel.org, Daniel Bristot de Oliveira <bris...@redhat.com>, Alexander Shishkin <alexander.shish...@linux.intel.com>, lpieral...@kernel.org, Rasmus Villemoes <li...@rasmusvillemoes.dk>, Joel Fernandes <j...@joelfernandes.org>, Will Deacon <w...@kernel.org>, Boris Ostrovsky <boris.ostrov...@oracle.com>, Kevin Hilman <khil...@kernel.org>, linux-c...@vger.kernel.org, pv-driv...@vmware.com, linux-snps-...@lists.infradead.org, Mel Gorman <mgor...@suse.de>, Jacob Pan <jacob.jun....@linux.intel.com>, Arnd Bergmann <arnd@arndb.d e>, ulli.kr...@googlemail.com, vgu...@kernel.org, linux-clk <linux-...@vger.kernel.org>, Josh Triplett <j...@joshtriplett.org>, Steven Rostedt <rost...@goodmis.org>, r...@vger.kernel.org, Borislav Petkov <b...@alien8.de>, bc...@quicinc.com, Thomas Bogendoerfer <tsbog...@alpha.franken.de>, Parisc List <linux-par...@vger.kernel.org>, Sudeep Holla <sudeep.ho...@arm.com>, Shawn Guo <shawn...@kernel.org>, David Miller <da...@davemloft.net>, Rich Felker <dal...@libc.org>, Tony Lindgren <t...@atomide.com>, amakha...@vmware.com, Bjorn Andersson <bjorn.anders...@linaro.org>, "H. Peter Anvin" <h...@zytor.com>, sparcli...@vger.kernel.org, linux-hexa...@vger.kernel.org, linux-riscv <linux-ri...@lists.infradead.org>, anton.iva...@cambridgegreys.com, jo...@southpole.se, Yury Norov <yury.no...@gmail.com>, Richard Weinberger <rich...@nod.at>, the arch/x86 maintainers <x...@kernel.org>, Russell King - ARM Linux <li...@armlinux.org.uk>, Ingo Molnar <mi...@redhat.com>, Albert Ou <a...@eecs.berkeley.edu>, "P aul E. McKenney" <paul...@kernel.org>, Heiko Carstens <h...@linux.ibm.com>, stefan.kristians...@saunalahti.fi, openr...@lists.librecores.org, Paul Walmsley <paul.walms...@sifive.com>, linux-tegra <linux-te...@vger.kernel.org>, namhy...@kernel.org, Andy Shevchenko <andriy.shevche...@linux.intel.com>, jpoim...@kernel.org, Juergen Gross <jgr...@suse.com>, Michal Simek <mon...@monstr.eu>, "open list:BROADCOM NVRAM DRIVER" <linux-m...@vger.kernel.org>, Palmer Dabbelt <pal...@dabbelt.com>, Anup Patel <a...@brainfault.org>, i...@jurassic.park.msu.ru, Johannes Berg <johan...@sipsolutions.net>, linuxppc-dev <linuxppc-dev@lists.ozlabs.org> Errors-To: linuxppc-dev-bounces+archive=mail-archive....@lists.ozlabs.org Sender: "Linuxppc-dev" <linuxppc-dev-bounces+archive=mail-archive....@lists.ozlabs.org>
On Wed, Jun 8, 2022 at 4:47 PM Peter Zijlstra <pet...@infradead.org> wrote: > > Commit c227233ad64c ("intel_idle: enable interrupts before C1 on > Xeons") wrecked intel_idle in two ways: > > - must not have tracing in idle functions > - must return with IRQs disabled > > Additionally, it added a branch for no good reason. > > Fixes: c227233ad64c ("intel_idle: enable interrupts before C1 on Xeons") > Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org> Acked-by: Rafael J. Wysocki <rafael.j.wyso...@intel.com> And do I think correctly that this can be applied without the rest of the series? > --- > drivers/idle/intel_idle.c | 48 > +++++++++++++++++++++++++++++++++++----------- > 1 file changed, 37 insertions(+), 11 deletions(-) > > --- a/drivers/idle/intel_idle.c > +++ b/drivers/idle/intel_idle.c > @@ -129,21 +137,37 @@ static unsigned int mwait_substates __in > * > * Must be called under local_irq_disable(). > */ > + > -static __cpuidle int intel_idle(struct cpuidle_device *dev, > - struct cpuidle_driver *drv, int index) > +static __always_inline int __intel_idle(struct cpuidle_device *dev, > + struct cpuidle_driver *drv, int index) > { > struct cpuidle_state *state = &drv->states[index]; > unsigned long eax = flg2MWAIT(state->flags); > unsigned long ecx = 1; /* break on interrupt flag */ > > - if (state->flags & CPUIDLE_FLAG_IRQ_ENABLE) > - local_irq_enable(); > - > mwait_idle_with_hints(eax, ecx); > > return index; > } > > +static __cpuidle int intel_idle(struct cpuidle_device *dev, > + struct cpuidle_driver *drv, int index) > +{ > + return __intel_idle(dev, drv, index); > +} > + > +static __cpuidle int intel_idle_irq(struct cpuidle_device *dev, > + struct cpuidle_driver *drv, int index) > +{ > + int ret; > + > + raw_local_irq_enable(); > + ret = __intel_idle(dev, drv, index); > + raw_local_irq_disable(); > + > + return ret; > +} > + > /** > * intel_idle_s2idle - Ask the processor to enter the given idle state. > * @dev: cpuidle device of the target CPU. > @@ -1801,6 +1824,9 @@ static void __init intel_idle_init_cstat > /* Structure copy. */ > drv->states[drv->state_count] = cpuidle_state_table[cstate]; > > + if (cpuidle_state_table[cstate].flags & > CPUIDLE_FLAG_IRQ_ENABLE) > + drv->states[drv->state_count].enter = intel_idle_irq; > + > if ((disabled_states_mask & BIT(drv->state_count)) || > ((icpu->use_acpi || force_use_acpi) && > intel_idle_off_by_default(mwait_hint) && > >