Skip to content

Commit 83a3cb2

Browse files
Sebastian Andrzej Siewiorgregkh
authored andcommitted
sched/idle: Make the idle timer expire in hard interrupt context
[ Upstream commit 9848417 ] The intel powerclamp driver will setup a per-CPU worker with RT priority. The worker will then invoke play_idle() in which it remains in the idle poll loop until it is stopped by the timer it started earlier. That timer needs to expire in hard interrupt context on PREEMPT_RT. Otherwise the timer will expire in ksoftirqd as a SOFT timer but that task won't be scheduled on the CPU because its priority is lower than the priority of the worker which is in the idle loop. Always expire the idle timer in hard interrupt context. Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20210906113034.jgfxrjdvxnjqgtmc@linutronix.de Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 647c19b commit 83a3cb2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/sched/idle.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ void play_idle_precise(u64 duration_ns, u64 latency_ns)
372372
cpuidle_use_deepest_state(latency_ns);
373373

374374
it.done = 0;
375-
hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
375+
hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
376376
it.timer.function = idle_inject_timer_fn;
377377
hrtimer_start(&it.timer, ns_to_ktime(duration_ns),
378-
HRTIMER_MODE_REL_PINNED);
378+
HRTIMER_MODE_REL_PINNED_HARD);
379379

380380
while (!READ_ONCE(it.done))
381381
do_idle();

0 commit comments

Comments
 (0)