sched/idle: Fix arch_cpu_idle() vs tracing
authorPeter Zijlstra <peterz@infradead.org>
Fri, 20 Nov 2020 10:50:35 +0000 (11:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Dec 2020 09:58:32 +0000 (10:58 +0100)
commitfb82d3ac7ec1ffb5f4758b025bfdcd1b82eeddd5
tree14b549dadadd5f1e959c90b5aa8c1ee3f9ca1814
parentc51f65d693603ff1acebea1eae04cb20b6af8bcb
sched/idle: Fix arch_cpu_idle() vs tracing

[ Upstream commit 58c644ba512cfbc2e39b758dd979edd1d6d00e27 ]

We call arch_cpu_idle() with RCU disabled, but then use
local_irq_{en,dis}able(), which invokes tracing, which relies on RCU.

Switch all arch_cpu_idle() implementations to use
raw_local_irq_{en,dis}able() and carefully manage the
lockdep,rcu,tracing state like we do in entry.

(XXX: we really should change arch_cpu_idle() to not return with
interrupts enabled)

Reported-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lkml.kernel.org/r/20201120114925.594122626@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
23 files changed:
arch/alpha/kernel/process.c
arch/arm/kernel/process.c
arch/arm64/kernel/process.c
arch/csky/kernel/process.c
arch/h8300/kernel/process.c
arch/hexagon/kernel/process.c
arch/ia64/kernel/process.c
arch/microblaze/kernel/process.c
arch/mips/kernel/idle.c
arch/nios2/kernel/process.c
arch/openrisc/kernel/process.c
arch/parisc/kernel/process.c
arch/powerpc/kernel/idle.c
arch/riscv/kernel/process.c
arch/s390/kernel/idle.c
arch/sh/kernel/idle.c
arch/sparc/kernel/leon_pmc.c
arch/sparc/kernel/process_32.c
arch/sparc/kernel/process_64.c
arch/um/kernel/process.c
arch/x86/include/asm/mwait.h
arch/x86/kernel/process.c
kernel/sched/idle.c