linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/22] cpu,sched: Mark arch_cpu_idle_dead() __noreturn
@ 2023-02-03 22:05 Josh Poimboeuf
  2023-02-03 22:05 ` [PATCH 01/22] alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration Josh Poimboeuf
                   ` (21 more replies)
  0 siblings, 22 replies; 32+ messages in thread
From: Josh Poimboeuf @ 2023-02-03 22:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: jgross, richard.henderson, ink, mattst88, linux-alpha, linux,
	linux-arm-kernel, catalin.marinas, will, guoren, linux-csky,
	linux-ia64, chenhuacai, kernel, loongarch, f.fainelli,
	bcm-kernel-feedback-list, tsbogend, linux-mips, jiaxun.yang, mpe,
	npiggin, christophe.leroy, linuxppc-dev, ysato, dalias, linux-sh,
	davem, sparclinux, tglx, mingo, bp, dave.hansen, x86, hpa, chris,
	jcmvbkbc, linux-xtensa, peterz, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, vschneid,
	paulmck

These are some minor changes to enable the __noreturn attribute for
arch_cpu_idle_dead().  (If there are no objections, I can merge the
entire set through the tip tree.)

Until recently [1], in Xen, when a previously offlined CPU was brought
back online, it unexpectedly resumed execution where it left off in the
middle of the idle loop by returning from play_dead() and its caller
arch_cpu_idle_dead().

There were some clever hacks to make that work, but the behavior was
surprising as do_idle() doesn't expect an offlined CPU to return from
the dead in the middle of the function.

Now that Xen has been fixed, make sure arch_cpu_idle_dead() never
returns by marking it __noreturn.  This causes the compiler to complain
if an arch-specific implementation might return.  It also improves code
generation for both caller and callee.

Patches 1-20 update the arch-specific implementations of the function so
they don't actually return (even in error cases), and make that visible
to the compiler.  That's typically done by ending the function with a
call to another noreturn function, or with a BUG().

Patch 21 fixes the weak implementation.

Patch 22 actually adds the __noreturn attribute.

[1] 076cbf5d2163 ("x86/xen: don't let xen_pv_play_dead() return")

Josh Poimboeuf (22):
  alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration
  alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return
  arm/cpu: Make sure arch_cpu_idle_dead() doesn't return
  arm64/cpu: Mark cpu_die() __noreturn
  csky/cpu: Make sure arch_cpu_idle_dead() doesn't return
  ia64/cpu: Mark play_dead() __noreturn
  loongarch/cpu: Make sure play_dead() doesn't return
  loongarch/cpu: Mark play_dead() __noreturn
  mips/cpu: Expose play_dead()'s prototype definition
  mips/cpu: Make sure play_dead() doesn't return
  mips/cpu: Mark play_dead() __noreturn
  powerpc/cpu: Mark start_secondary_resume() __noreturn
  sh/cpu: Make sure play_dead() doesn't return
  sh/cpu: Mark play_dead() __noreturn
  sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition
  sparc/cpu: Mark cpu_play_dead() __noreturn
  x86/cpu: Make sure play_dead() doesn't return
  x86/cpu: Mark play_dead() __noreturn
  xtensa/cpu: Make sure cpu_die() doesn't return
  xtensa/cpu: Mark cpu_die() __noreturn
  sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't
    return
  sched/idle: Mark arch_cpu_idle_dead() __noreturn

 arch/alpha/kernel/process.c      | 2 ++
 arch/arm/kernel/smp.c            | 2 ++
 arch/arm64/include/asm/smp.h     | 2 +-
 arch/csky/kernel/smp.c           | 2 ++
 arch/ia64/kernel/process.c       | 4 ++--
 arch/loongarch/include/asm/smp.h | 2 +-
 arch/loongarch/kernel/smp.c      | 2 +-
 arch/mips/include/asm/smp.h      | 2 +-
 arch/mips/kernel/smp-bmips.c     | 3 +++
 arch/mips/loongson64/smp.c       | 1 +
 arch/powerpc/include/asm/smp.h   | 2 +-
 arch/sh/include/asm/smp-ops.h    | 5 +++--
 arch/sh/kernel/idle.c            | 1 +
 arch/sparc/include/asm/smp_64.h  | 2 +-
 arch/x86/include/asm/smp.h       | 3 ++-
 arch/x86/kernel/process.c        | 2 +-
 arch/xtensa/include/asm/smp.h    | 2 +-
 arch/xtensa/kernel/smp.c         | 2 ++
 include/linux/cpu.h              | 2 +-
 kernel/sched/idle.c              | 2 +-
 tools/objtool/check.c            | 1 +
 21 files changed, 31 insertions(+), 15 deletions(-)

-- 
2.39.0


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2023-02-07 17:33 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 22:05 [PATCH 00/22] cpu,sched: Mark arch_cpu_idle_dead() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 01/22] alpha/cpu: Expose arch_cpu_idle_dead()'s prototype declaration Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 02/22] alpha/cpu: Make sure arch_cpu_idle_dead() doesn't return Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 03/22] arm/cpu: " Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 04/22] arm64/cpu: Mark cpu_die() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 05/22] csky/cpu: Make sure arch_cpu_idle_dead() doesn't return Josh Poimboeuf
2023-02-04  1:12   ` Guo Ren
2023-02-04  2:29     ` Josh Poimboeuf
2023-02-06  3:11       ` Guo Ren
2023-02-03 22:05 ` [PATCH 06/22] ia64/cpu: Mark play_dead() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 07/22] loongarch/cpu: Make sure play_dead() doesn't return Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 08/22] loongarch/cpu: Mark play_dead() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 09/22] mips/cpu: Expose play_dead()'s prototype definition Josh Poimboeuf
2023-02-06 22:36   ` Florian Fainelli
2023-02-03 22:05 ` [PATCH 10/22] mips/cpu: Make sure play_dead() doesn't return Josh Poimboeuf
2023-02-06 22:36   ` Florian Fainelli
2023-02-03 22:05 ` [PATCH 11/22] mips/cpu: Mark play_dead() __noreturn Josh Poimboeuf
2023-02-06 22:36   ` Florian Fainelli
2023-02-03 22:05 ` [PATCH 12/22] powerpc/cpu: Mark start_secondary_resume() __noreturn Josh Poimboeuf
2023-02-06 11:10   ` Michael Ellerman
2023-02-06 22:22     ` Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 13/22] sh/cpu: Make sure play_dead() doesn't return Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 14/22] sh/cpu: Mark play_dead() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 15/22] sh/cpu: Expose arch_cpu_idle_dead()'s prototype definition Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 16/22] sparc/cpu: Mark cpu_play_dead() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 17/22] x86/cpu: Make sure play_dead() doesn't return Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 18/22] x86/cpu: Mark play_dead() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 19/22] xtensa/cpu: Make sure cpu_die() doesn't return Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 20/22] xtensa/cpu: Mark cpu_die() __noreturn Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 21/22] sched/idle: Make sure weak version of arch_cpu_idle_dead() doesn't return Josh Poimboeuf
2023-02-03 22:05 ` [PATCH 22/22] sched/idle: Mark arch_cpu_idle_dead() __noreturn Josh Poimboeuf
2023-02-07 17:33   ` [PATCH v1.1 " Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).