Message ID | 20231228145416.GAZY2MGLY6THMkAZ2W@fat_crate.local (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | cpuidle: haltpoll: Do not enable interrupts when entering idle | expand |
On Thu, Dec 28, 2023 at 3:54 PM Borislav Petkov (AMD) <bp@alien8.de> wrote: > > Hi, > > I think PeterZ's massaging from > > https://lore.kernel.org/all/20230112194314.845371875@infradead.org/ > > missed one. > > @Forza, if you want to have your real name in the patch tags below and > thus be part of git history, lemme know. If you don't want them there, > either. > > Thx. > > --- > From: Borislav Petkov (AMD) <bp@alien8.de> I would have appreciated a Subject: line here. > > The cpuidle governors' ->enter() methods are supposed to be IRQ > invariant: cpuidle governors have no ->enter() callbacks, drivers do. And this particular haltpoll is a driver (there is a haltpoll governor too, confusingly enough). > > 5e26aa933911 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls") > bb7b11258561 ("cpuidle: Move IRQ state validation") > > Do that in the haltpoll governor too. And so s/governor/driver/ here. > Fixes: 5e26aa933911 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls") > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218245 > Reported-by: <forza@tnonline.net> > Tested-by: <forza@tnonline.net> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Nevertheless, applied (with the changelog adjustments mentioned above). > --- > drivers/cpuidle/cpuidle-haltpoll.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c > index e66df22f9695..d8515d5c0853 100644 > --- a/drivers/cpuidle/cpuidle-haltpoll.c > +++ b/drivers/cpuidle/cpuidle-haltpoll.c > @@ -25,13 +25,12 @@ MODULE_PARM_DESC(force, "Load unconditionally"); > static struct cpuidle_device __percpu *haltpoll_cpuidle_devices; > static enum cpuhp_state haltpoll_hp_state; > > -static int default_enter_idle(struct cpuidle_device *dev, > - struct cpuidle_driver *drv, int index) > +static __cpuidle int default_enter_idle(struct cpuidle_device *dev, > + struct cpuidle_driver *drv, int index) > { > - if (current_clr_polling_and_test()) { > - local_irq_enable(); > + if (current_clr_polling_and_test()) > return index; > - } > + > arch_cpu_idle(); > return index; > } > -- > 2.42.0.rc0.25.ga82fb66fed25 > > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette
On Fri, Dec 29, 2023 at 06:12:36PM +0100, Rafael J. Wysocki wrote: > I would have appreciated a Subject: line here. mutt uses it as the actual subject if I do mutt -H /path/to/patch-file since I want to type in stuff before sending. > cpuidle governors have no ->enter() callbacks, drivers do. And this > particular haltpoll is a driver (there is a haltpoll governor too, > confusingly enough). Fun. > Nevertheless, applied (with the changelog adjustments mentioned above). Thanks!
diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c index e66df22f9695..d8515d5c0853 100644 --- a/drivers/cpuidle/cpuidle-haltpoll.c +++ b/drivers/cpuidle/cpuidle-haltpoll.c @@ -25,13 +25,12 @@ MODULE_PARM_DESC(force, "Load unconditionally"); static struct cpuidle_device __percpu *haltpoll_cpuidle_devices; static enum cpuhp_state haltpoll_hp_state; -static int default_enter_idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) +static __cpuidle int default_enter_idle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) { - if (current_clr_polling_and_test()) { - local_irq_enable(); + if (current_clr_polling_and_test()) return index; - } + arch_cpu_idle(); return index; }