Skip to content

sched/idle: Fix missing need_resched() checks after rcu_idle_enter()

Frederic Weisbecker linux-pm linux-tegra lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sched/idle: Fix missing need_resched() check after rcu_idle_enter()kernel/sched/idle.c+12 -61 reply
2/4cpuidle: Fix missing need_resched() check after rcu_idle_enter()drivers/cpuidle/cpuidle.c+25 -83 replies
3/4ARM: imx6q: Fix missing need_resched() check after rcu_idle_enter()arch/arm/mach-imx/cpuidle-imx6q.c+6 -10 replies
4/4ACPI: processor: Fix missing need_resched() check after rcu_idle_enter()drivers/acpi/processor_idle.c+8 -20 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPaul E. McKenneyRafael J. Wysocki
SeriesR-b
1/4T-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] sched/idle: Fix missing need_resched() checks after rcu_idle_enter()

With Paul, we've been thinking that the idle loop wasn't twisted enough yet to deserve 2020.

rcutorture, after some recent parameter changes, has been complaining about a hung task.

It appears that rcu_idle_enter() may wake up a NOCB kthread but this happens after the last generic need_resched() check. Some cpuidle drivers fix it by chance but many others don't.

Here is a proposed bunch of fixes. I will need to also fix the rcu_user_enter() case, likely using irq_work, since nohz_full requires irq work to support self IPI.

Also more generally, this raise the question of local task wake_up() under disabled interrupts. When a wake up occurs in a preempt disabled section, it gets handled by the outer preempt_enable() call. There is no similar mechanism when a wake up occurs with interrupts disabled. I guess it is assumed to be handled, at worst, in the next tick. But a local irq work would provide instant preemption once IRQs are re-enabled. Of course this would only make sense in CONFIG_PREEMPTION, and when the tick is disabled...

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
sched/idle

HEAD: f2fa6e4a070c1535b9edc9ee097167fd2b15d235

Thanks,
Frederic
---

Frederic Weisbecker (4):
sched/idle: Fix missing need_resched() check after rcu_idle_enter()
cpuidle: Fix missing need_resched() check after rcu_idle_enter()
ARM: imx6q: Fix missing need_resched() check after rcu_idle_enter()
ACPI: processor: Fix missing need_resched() check after rcu_idle_enter()

 arch/arm/mach-imx/cpuidle-imx6q.c |  7 ++++++-
 drivers/acpi/processor_idle.c     | 10 ++++++++--
 drivers/cpuidle/cpuidle.c         | 33 +++++++++++++++++++++++++--------
 kernel/sched/idle.c               | 18 ++++++++++++------
 4 files changed, 51 insertions(+), 17 deletions(-)