arch/idle: Change arch_cpu_idle() behavior: always exit with IRQs disabled
authorPeter Zijlstra <peterz@infradead.org>
Thu, 12 Jan 2023 19:43:35 +0000 (20:43 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 13 Jan 2023 10:48:15 +0000 (11:48 +0100)
commit89b3098703bd2aa3237ef10a704e6a5838e6ea69
tree10d881133134e9ead2c7478b2d353a958f5f7c0f
parent9b461a6faae7b220c32466261965778b10189e54
arch/idle: Change arch_cpu_idle() behavior: always exit with IRQs disabled

Current arch_cpu_idle() is called with IRQs disabled, but will return
with IRQs enabled.

However, the very first thing the generic code does after calling
arch_cpu_idle() is raw_local_irq_disable(). This means that
architectures that can idle with IRQs disabled end up doing a
pointless 'enable-disable' dance.

Therefore, push this IRQ disabling into the idle function, meaning
that those architectures can avoid the pointless IRQ state flipping.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Acked-by: Mark Rutland <mark.rutland@arm.com> [arm64]
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Guo Ren <guoren@kernel.org>
Acked-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20230112195540.618076436@infradead.org
27 files changed:
arch/alpha/kernel/process.c
arch/arc/kernel/process.c
arch/arm/kernel/process.c
arch/arm/mach-gemini/board-dt.c
arch/arm64/kernel/idle.c
arch/csky/kernel/process.c
arch/csky/kernel/smp.c
arch/hexagon/kernel/process.c
arch/ia64/kernel/process.c
arch/loongarch/kernel/idle.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/coco/tdx/tdx.c
arch/x86/kernel/process.c
arch/xtensa/kernel/process.c
kernel/sched/idle.c