panic: add panic_redirect_cpu declaration to header
PATCH 1/1 panic: add panic_redirect_cpu declaration to header
Add the extern declaration for panic_redirect_cpu to linux/panic.h to fix the sparse warning:
kernel/panic.c:305:10: sparse: sparse: symbol 'panic_redirect_cpu' was not declared. Should it be static?
The variable needs to be declared in the header alongside panic_cpu since it is used for synchronization when redirecting panic to a specific CPU via the panic_force_cpu= boot parameter.
--- include/linux/panic.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/panic.h +8 -0
@@ -41,6 +41,14 @@ void abort(void);* PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec(). */ extern atomic_t panic_cpu; + +/* +* panic_redirect_cpu is used when panic is redirected to a specific CPU via +* the panic_force_cpu= boot parameter. It holds the CPU number that originally +* triggered the panic before redirection. A value of PANIC_CPU_INVALID means +* no redirection has occurred. +*/ +extern atomic_t panic_redirect_cpu;#define PANIC_CPU_INVALID -1bool panic_try_start (void );
Signature · 1 line
2.43.0
Quoted 10 lines · On Sun, 18 Jan 2026 14:01:49 +0200 Pnina Feder <[email protected]> wrote:
Add the extern declaration for
panic_redirect_cputolinux/panic.hto fix the sparse warning:
kernel/panic.c:305:10: sparse: sparse: symbol 'panic_redirect_cpu' was not declared. Should it be static?The variable needs to be declared in the header alongside
panic_cpusince it is used for synchronization when redirecting panic to a specific CPU via the panic_force_cpu= boot parameter.
Thanks, I added this as a squashable fix against your earlier patch "panic: add panic_force_cpu= parameter to redirect panic to a specific CPU".
(It's nice to tell people when a patch fixes a pending patch in this manner - otherwise everyone has to run around trying to figure out which tree is being patched and why).