Skip to content

Commit

Permalink
cpuidle: haltpoll: Do not enable interrupts when entering idle
Browse files Browse the repository at this point in the history
The cpuidle drivers' ->enter() methods are supposed to be IRQ invariant:

  5e26aa9 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls")
  bb7b112 ("cpuidle: Move IRQ state validation")

Do that in the haltpoll driver too.

Fixes: 5e26aa9 ("cpuidle/poll: Ensure IRQs stay disabled after cpuidle_state::enter() calls")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218245
Reported-by: <[email protected]>
Tested-by: <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
bp3tk0v authored and rafaeljw committed Dec 29, 2023
1 parent 92813fd commit c8f5cae
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/cpuidle/cpuidle-haltpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c8f5cae

Please sign in to comment.