mbox series

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

Message ID 20210104152058.36642-1-frederic@kernel.org
Headers show
Series sched/idle: Fix missing need_resched() checks after rcu_idle_enter() v2 | expand

Message

Frederic Weisbecker Jan. 4, 2021, 3:20 p.m. UTC
The only code change in this v2 is the use of tif_need_resched() instead
of need_resched() on 3/4 (build issue reported on linux-next).

The rest is added Tested-by and Reviewed-by tags.

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

HEAD: c246718af0112c8624ec9c46a85bf0ef1562e050

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 |  8 +++++++-
 drivers/acpi/processor_idle.c     | 10 ++++++++--
 drivers/cpuidle/cpuidle.c         | 33 +++++++++++++++++++++++++--------
 kernel/sched/idle.c               | 18 ++++++++++++------
 4 files changed, 52 insertions(+), 17 deletions(-)

Comments

Fabio Estevam Jan. 4, 2021, 3:57 p.m. UTC | #1
Hi Frederic,

On Mon, Jan 4, 2021 at 12:21 PM Frederic Weisbecker <frederic@kernel.org> wrote:
>
> Entering RCU idle mode may cause a deferred wake up of an RCU NOCB_GP
> kthread (rcuog) to be serviced.
>
> Usually a wake up happening while running the idle task is spotted in
> one of the need_resched() checks carefully placed within the idle loop
> that can break to the scheduler.
>
> Unfortunately imx6q_enter_wait() is beyond the last generic
> need_resched() check and it performs a wfi right away after the call to
> rcu_idle_enter(). We may halt the CPU with a resched request unhandled,
> leaving the task hanging.
>
> Fix this with performing a last minute need_resched() check after
> calling rcu_idle_enter().

Shouldn't tif_need_resched() be used instead of need_resched() in the
commit log?