panic/kexec: Allow forcing panic execution on a specific CPU
Subsystems (2)
PATCH 1/1 panic/kexec: Allow forcing panic execution on a specific CPU
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This may be due to firmware, interrupt routing, or platform-specific constraints where only one CPU is able to safely enter the crash kernel.
Add an optional configuration that allows redirecting panic execution to a designated target CPU before invoking kexec into the crash kernel.
When CONFIG_PANIC_FORCE_CPU is enabled, the initial panic CPU will forward the panic to the configured CPU using smp_call_function_single(). If a panic is already in progress on another CPU, redirection is skipped and a warning is printed.
There is no functional change when the option is disabled.
--- kernel/Kconfig.kexec | 17 ++++++++++++ kernel/panic.c | 66 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+)
kernel/Kconfig.kexec +17 -0
@@ -179,4 +179,21 @@ config CRASH_MAX_MEMORY_RANGES the computation behind the value provided through the /sys/kernel/crash_elfcorehdr_size attribute. +config PANIC_FORCE_CPU + bool "Force panic to execute on a specific CPU" + depends on SMP && CRASH_DUMP + help + Some platforms require panic handling to occur on a specific CPU + for the crash kernel to function correctly. This option forces + panic handling to be redirected to the specified CPU before kexec + into the crash kernel. + +config PANIC_FORCE_CPU_ID + int "CPU number for panic execution" + depends on PANIC_FORCE_CPU + default 0 + help + The CPU number that should handle panic when PANIC_FORCE_CPU is + enabled. + endmenu
kernel/panic.c +66 -0
78 lines not on this page · raw message
Signature · 1 line
2.43.0
Andrew Morton
maintainerQuoted 5 lines · On Thu, 1 Jan 2026 14:32:37 +0200 Pnina Feder <[email protected]> wrote:
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This may be due to firmware, interrupt routing, or platform-specific constraints where only one CPU is able to safely enter the crash kernel.
Quoted 7 lines
Add an optional configuration that allows redirecting panic execution to a designated target CPU before invoking kexec into the crash kernel.
When
CONFIG_PANIC_FORCE_CPUis enabled, the initial panic CPU will forward the panic to the configured CPU usingsmp_call_function_single(). If a panic is already in progress on another CPU, redirection is skipped and a warning is printed.
Requiring a recompile/reinstall isn't very user-friendly. Is it possible to do this with a kernel boot option?
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Pnina,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.19-rc3 next-20251219] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pnina-Feder/panic-kexec-Allow-forcing-panic-execution-on-a-specific-CPU/20260101-203448 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20260101123237.277411-1-pnina.feder%40mobileye.com patch subject: [PATCH] panic/kexec: Allow forcing panic execution on a specific CPU config: arm64-randconfig-r122-20260104 (https://download.01.org/0day-ci/archive/20260104/[email protected]/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260104/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> kernel/panic.c:349:69: warning: diagnostic behavior may be improved by adding the 'format(printf, 1, 0)' attribute to the declaration of 'panic_force_target_cpu' [-Wmissing-format-attribute]
321 | vsnprintf(panic_redirect_msg, sizeof(panic_redirect_msg), fmt, args);
| ^ kernel/panic.c:321:13: note: 'panic_force_target_cpu' declared here
321 | static bool panic_force_target_cpu(const char *fmt, va_list args)
| ^
1 warning generated.
vim +349 kernel/panic.c
308
309 /**
310 * panic_force_target_cpu - Redirect panic to a specific CPU for crash kernel
311 * @fmt: panic message format string
312 * @args: arguments for format string
313 *
314 * Some platforms require panic handling to occur on a specific CPU
315 * for the crash kernel to function correctly. This function redirects
316 * panic handling to CONFIG_PANIC_FORCE_CPU_ID before kexec.
317 *
318 * Returns true if panic should proceed on current CPU.
319 * Returns false (never returns) if panic was redirected.
320 */
321 static bool panic_force_target_cpu(const char *fmt, va_list args)
322 {
323 static char panic_redirect_msg[1024];
324 int cpu = raw_smp_processor_id();
325 int target_cpu = CONFIG_PANIC_FORCE_CPU_ID;
326
327 /* Already on target CPU - proceed normally */
328 if (cpu == target_cpu)
329 return true;
330
331 /* Target CPU is offline, can't redirect */
332 if (!cpu_online(target_cpu)) {
333 pr_warn("panic: CPU %d is offline, cannot redirect panic. "
334 "Crash kernel interrupts may be unavailable.\n", target_cpu);
335 return true;
336 }
337
338 /* Another panic already in progress */
339 if (panic_in_progress()) {
340 pr_warn("panic: Another panic in progress on CPU %d, cannot redirect to CPU %d. "
341 "Crash kernel interrupts may be unavailable.\n",
342 atomic_read(&panic_cpu), target_cpu);
343 return true;
344 }
345
346 pr_info("panic: Redirecting from CPU %d to CPU %d for crash kernel\n",
347 cpu, target_cpu);
348
> 349 vsnprintf(panic_redirect_msg, sizeof(panic_redirect_msg), fmt, args);
350
351 smp_call_function_single(target_cpu, do_panic_on_target_cpu, panic_redirect_msg, false);
352
353 return false;
354 }
355 #else
356 static inline bool panic_force_target_cpu(const char *fmt, va_list args)
357 {
358 return true;
359 }
360 #endif /* CONFIG_PANIC_FORCE_CPU */
361
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v2 1/1 panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina FederSome platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add support for redirecting panic execution to a designated CPU via a kernel command-line parameter. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v1:
- Replace Kconfig option with a kernel command-line parameter
- Fix clang format warning reported by kernel test robot
--- kernel/panic.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)
kernel/panic.c +93 -0
@@ -300,6 +300,92 @@ void __weak crash_smp_send_stop(void)atomic_t panic_cpu =ATOMIC_INIT (PANIC_CPU_INVALID ); +#ifdef CONFIG_SMP +/* CPU to redirect panic to, -1 means feature is disabled */ +static int panic_force_cpu =-1 ; + +static int __init panic_force_cpu_setup (char *str) +{ +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ; + } + + panic_force_cpu = cpu; +pr_info ("panic_force_cpu: panic will execute on CPU %d\n" , cpu); +return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) +{ +panic ("%s" , (char *)info); +} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for crash kernel +* @fmt: panic message format string +* @args: arguments for format string +* +* Some platforms require panic handling to occur on a specific CPU +* for the crash kernel to function correctly. This function redirects +* panic handling to the CPU specified via the panic_redirect_cpu= boot parameter. +* +* Returns true if panic should proceed on current CPU. +* Returns false (never returns) if panic was redirected. +*/ +__printf(1, 0) +static bool panic_force_target_cpu (const char *fmt,va_list args) +{ +static char panic_redirect_msg[1024 ]; +int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */ +if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; + +/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) { +pr_warn ("panic: target CPU %d is offline, proceeding on CPU %d.\n" +"Crash kernel console output may be unavailable.\n" , target_cpu, cpu); +return true; + } + +/* Another panic already in progress */ +if (panic_in_progress ()) { +pr_warn ("panic: Another panic in progress on CPU %d, cannot redirect to CPU %d.\n" +"Crash kernel console output may be unavailable.\n" , +atomic_read (&panic_cpu), target_cpu); +return true; + } + +pr_info ("panic: Redirecting from CPU %d to CPU %d for crash kernel\n" , + cpu, target_cpu); + +vsnprintf (panic_redirect_msg,sizeof (panic_redirect_msg), fmt, args); + +smp_call_function_single (target_cpu, do_panic_on_target_cpu, panic_redirect_msg, false); + +return false; +} +#else +__printf(1, 0) +static inline bool panic_force_target_cpu (const char *fmt,va_list args) +{ +return true; +} +#endif /* CONFIG_SMP */ +bool panic_try_start (void ) {int old_cpu, this_cpu;
@@ -451,6 +537,13 @@ void vpanic(const char *fmt, va_list args)local_irq_disable ();preempt_disable_notrace (); +/* +* Redirect panic to target CPU if configured via panic_force_cpu=. +* Returns false and never returns if panic was redirected. +*/ +if (!panic_force_target_cpu (fmt, args)) +panic_smp_self_stop (); +/* * It's possible to come here directly from a panic-assertion and * not have preempt disabled. Some functions called from here want
Signature · 1 line
2.43.0
Andrew Morton
maintainerRe: [PATCH v2] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 7 lines · On Sun, 4 Jan 2026 22:42:10 +0200 Pnina Feder <[email protected]> wrote:
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add support for redirecting panic execution to a designated CPU via a kernel command-line parameter.
Let's tell changelog readers what that command line parameter is called.
Quoted 7 lines
When the parameter is provided, the CPU
that initially triggers panic forwards the panic context to the target CPU, which then proceeds with the normal panic and kexec flow.If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Well I like it. Others may not ;)
Quoted 9 lines
Changes since v1:
- ReplaceKconfigoption with a kernel command-line parameter
- Fix clang format warning reported by kernel test robotReported-by kernel test robot <[email protected]>Signed-off-by Pnina Feder <[email protected]>--- kernel/panic.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++
Please update Documentation/admin-guide/kernel-parameters.txt?
kernel/panic.c void __weak crash_smp_send_stop(void) · line 345
Quoted 4 lines
kernel/panic.c +4
-0+__printf(1, 0) +static bool panic_force_target_cpu (const char *fmt,va_list args) +{ +static char panic_redirect_msg[1024 ];
It's sad to chew 1k of everyone's RAM for this. smp_call_function_single() is synchronous, yes? Can we reduce that message a lot and use automatic storage?
Or perhaps kmalloc the storage if the user provided the panic_force_cpu kernel parameter?
Quoted 4 lines
kernel/panic.c +4
-0+int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */
kernel/panic.c void __weak crash_smp_send_stop(void) · line 359
Quoted 10 lines
kernel/panic.c +10
-0+if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; + +/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) { + pr_warn("panic: target CPU %d is offline, proceeding on CPU %d.\n"
"panic: <lowercase>..."
kernel/panic.c void __weak crash_smp_send_stop(void) · line 366
Quoted 7 lines
kernel/panic.c +7
-0+ "Crash kernel console output may be unavailable.\n", target_cpu, cpu); +return true; + } + +/* Another panic already in progress */ +if (panic_in_progress ()) { + pr_warn("panic: Another panic in progress on CPU %d, cannot redirect to CPU %d.\n"
"panic: <uppercase>..."
boy, was that a nit!
Quoted 25 lines
kernel/panic.c +22
-0+"Crash kernel console output may be unavailable.\n" , + atomic_read(&panic_cpu), target_cpu); + return true; + } + +pr_info ("panic: Redirecting from CPU %d to CPU %d for crash kernel\n" , + cpu, target_cpu); + +vsnprintf (panic_redirect_msg,sizeof (panic_redirect_msg), fmt, args); + +smp_call_function_single (target_cpu, do_panic_on_target_cpu, panic_redirect_msg, false); + +return false; +} +#else +__printf(1, 0) +static inline bool panic_force_target_cpu (const char *fmt,va_list args) +{ +return true; +} +#endif /* CONFIG_SMP */ +bool panic_try_start (void ) {int old_cpu, this_cpu;
RE: [PATCH v2] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Hi Andrew,
Quoted 9 lines
Quoted 7 lines
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add support for redirecting panic execution to a designated CPU via a kernel command-line parameter.
Let's tell changelog readers what that command line parameter is called.
Will add "panic_force_cpu=" to the changelog in v4.
Quoted 9 lines
Quoted 7 lines
When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Well I like it. Others may not ;)
Thanks! Petr raised concerns about smp_call_function_single() safety - I've switched to smp_call_function_single_async() in v4.
Quoted 13 lines
Quoted 4 lines
Changes since v1:
- ReplaceKconfigoption with a kernel command-line parameter
- Fix clang format warning reported by kernel test robotQuoted 8 lines
Reported-by kernel test robot <[email protected]>Closes:
https://lore.kernel.org/oe-kbuild-all/202601041820.6M8cIq2e-lkp@intel.
com/Signed-off-by Pnina Feder <[email protected]>--- kernel/panic.c | 93++++++++++++++++++++++++++++++++++++++++++++++++++
Quoted 1 line
Please update
Documentation/admin-guide/kernel-parameters.txt?
Done in v4.
Quoted 8 lines
kernel/panic.c void __weak crash_smp_send_stop(void) · line 345
Quoted 3 lines
kernel/panic.c +3
-0+__printf(1, 0) +static bool panic_force_target_cpu (const char *fmt,va_list args) { +static char panic_redirect_msg[1024 ];It's sad to chew 1k of everyone's RAM for this.
smp_call_function_single()is synchronous, yes? Can we reduce that message a lot and use automatic storage?Or perhaps kmalloc the storage if the user provided the
panic_force_cpukernel parameter?
I'm now reusing vpanic()'s existing static buf[1024] - passing it as a parameter to panic_force_target_cpu(). This avoids any additional memory allocation.
Quoted 27 lines
Quoted 4 lines
kernel/panic.c +4
-0+int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */ kernel/panic.c void __weak crash_smp_send_stop(void) · line 359
Quoted 10 lines
kernel/panic.c +10
-0+if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; + +/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) { + pr_warn("panic: target CPU %d is offline, proceeding on CPU %d.\n""panic: <lowercase>..."
kernel/panic.c void __weak crash_smp_send_stop(void) · line 366
Quoted 7 lines
kernel/panic.c +7
-0+ "Crash kernel console output may be unavailable.\n", target_cpu, cpu); +return true; + } + +/* Another panic already in progress */ +if (panic_in_progress ()) { + pr_warn("panic: Another panic in progress on CPU %d, cannot redirect to CPU %d.\n""panic: <uppercase>..."
Quoted 2 lines
boy, was that a nit!
I've removed the verbose warning messages per Petr's feedback - the redirection will silently fall back to local panic, matching vpanic()'s behavior.
Thanks for the review!
Pnina
PATCH v3 1/1 panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina FederSome platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add support for redirecting panic execution to a designated CPU via a kernel command-line parameter. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v2:
- Make panic redirection warnings generic and platform-agnostic
--- kernel/panic.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)
kernel/panic.c +93 -0
@@ -300,6 +300,92 @@ void __weak crash_smp_send_stop(void)atomic_t panic_cpu =ATOMIC_INIT (PANIC_CPU_INVALID ); +#ifdef CONFIG_SMP +/* CPU to redirect panic to, -1 means feature is disabled */ +static int panic_force_cpu =-1 ; + +static int __init panic_force_cpu_setup (char *str) +{ +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ; + } + + panic_force_cpu = cpu; +pr_info ("panic_force_cpu: panic will execute on CPU %d\n" , cpu); +return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) +{ +panic ("%s" , (char *)info); +} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for crash kernel +* @fmt: panic message format string +* @args: arguments for format string +* +* Some platforms require panic handling to occur on a specific CPU +* for the crash kernel to function correctly. This function redirects +* panic handling to the CPU specified via the panic_redirect_cpu= boot parameter. +* +* Returns true if panic should proceed on current CPU. +* Returns false (never returns) if panic was redirected. +*/ +__printf(1, 0) +static bool panic_force_target_cpu (const char *fmt,va_list args) +{ +static char panic_redirect_msg[1024 ]; +int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */ +if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; + +/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) { +pr_warn ("panic: target CPU %d is offline, proceeding on CPU %d.\n" +"Crash kernel interrupts may be unavailable.\n" , target_cpu, cpu); +return true; + } + +/* Another panic already in progress */ +if (panic_in_progress ()) { +pr_warn ("panic: Another panic in progress on CPU %d, cannot redirect to CPU %d.\n" +"Crash kernel interrupts may be unavailable.\n" , +atomic_read (&panic_cpu), target_cpu); +return true; + } + +pr_info ("panic: Redirecting from CPU %d to CPU %d for crash kernel\n" , + cpu, target_cpu); + +vsnprintf (panic_redirect_msg,sizeof (panic_redirect_msg), fmt, args); + +smp_call_function_single (target_cpu, do_panic_on_target_cpu, panic_redirect_msg, false); + +return false; +} +#else +__printf(1, 0) +static inline bool panic_force_target_cpu (const char *fmt,va_list args) +{ +return true; +} +#endif /* CONFIG_SMP */ +bool panic_try_start (void ) {int old_cpu, this_cpu;
@@ -451,6 +537,13 @@ void vpanic(const char *fmt, va_list args)local_irq_disable ();preempt_disable_notrace (); +/* +* Redirect panic to target CPU if configured via panic_force_cpu=. +* Returns false and never returns if panic was redirected. +*/ +if (!panic_force_target_cpu (fmt, args)) +panic_smp_self_stop (); +/* * It's possible to come here directly from a panic-assertion and * not have preempt disabled. Some functions called from here want
Signature · 1 line
2.43.0
Re: [PATCH v3] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Adding more people into Cc. I doubt that smp_call_function_single() is reliable in panic().
Quoted 86 lines · Pnina Feder
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add support for redirecting panic execution to a designated CPU via a kernel command-line parameter. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v2:
- Make panic redirection warnings generic and platform-agnosticReported-by kernel test robot <[email protected]>Signed-off-by Pnina Feder <[email protected]>--- kernel/panic.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)kernel/panic.c +54
-0@@ -300,6 +300,92 @@ void __weak crash_smp_send_stop(void)atomic_t panic_cpu =ATOMIC_INIT (PANIC_CPU_INVALID ); +#ifdef CONFIG_SMP +/* CPU to redirect panic to, -1 means feature is disabled */ +static int panic_force_cpu =-1 ; + +static int __init panic_force_cpu_setup (char *str) +{ +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ; + } + + panic_force_cpu = cpu; +pr_info ("panic_force_cpu: panic will execute on CPU %d\n" , cpu); +return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) +{ +panic ("%s" , (char *)info); +} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for crash kernel +* @fmt: panic message format string +* @args: arguments for format string +* +* Some platforms require panic handling to occur on a specific CPU +* for the crash kernel to function correctly. This function redirects +* panic handling to the CPU specified via the panic_redirect_cpu= boot parameter. +* +* Returns true if panic should proceed on current CPU. +* Returns false (never returns) if panic was redirected. +*/ +__printf(1, 0) +static bool panic_force_target_cpu (const char *fmt,va_list args) +{ +static char panic_redirect_msg[1024 ]; +int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */ +if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; +
kernel/panic.c void __weak crash_smp_send_stop(void) · line 366
Quoted 10 lines
kernel/panic.c +10
-0+/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) { +pr_warn ("panic: target CPU %d is offline, proceeding on CPU %d.\n" +"Crash kernel interrupts may be unavailable.\n" , target_cpu, cpu); +return true; + } + +/* Another panic already in progress */ +if (panic_in_progress ()) { + pr_warn("panic: Another panic in progress on CPU %d, cannot redirect to CPU %d.\n"
IMHO, this message does not add much value and should be omitted. vpanic() does not print any message when panic_try_start() fails.
kernel/panic.c void __weak crash_smp_send_stop(void) · line 367
Quoted 1 line
kernel/panic.c +1
-0+ "Crash kernel interrupts may be unavailable.\n",
I am confused by this message.
kernel/panic.c void __weak crash_smp_send_stop(void) · line 375
Quoted 8 lines
kernel/panic.c +8
-0+ atomic_read(&panic_cpu), target_cpu); +return true; + } + +pr_info ("panic: Redirecting from CPU %d to CPU %d for crash kernel\n" , + cpu, target_cpu); + +vsnprintf (panic_redirect_msg,sizeof (panic_redirect_msg), fmt, args);
The "redirect" in "panic_redirect_msg" is confusing. It has nothing to do with redirection. It is just a buffer for the formatted panic message. I would call it "buf" or "panic_msg".
kernel/panic.c void __weak crash_smp_send_stop(void) · line 377
Quoted 1 line
kernel/panic.c +1
-0+smp_call_function_single (target_cpu, do_panic_on_target_cpu, panic_redirect_msg, false);
I doubt that this is safe and reliable in panic() context.
For a start, panic() might be called in NMI and this function takes csd_lock().
panic() code should avoid locks. Or is should use trylock and handle a failure gracefully.
BTW: The commit message says that this is needed for crash-dump
to work reliably. So, it does not make sense to do this when crash-dump is not configured.
Maybe, crash-dump should get fixed instead? What are the exact problems with the crash-dump, please?
Quoted 18 lines
kernel/panic.c +11
-0+ +return false; +} +#else +__printf(1, 0) +static inline bool panic_force_target_cpu (const char *fmt,va_list args) +{ +return true; +} +#endif /* CONFIG_SMP */ +bool panic_try_start (void ) {int old_cpu, this_cpu;@@ -451,6 +537,13 @@ void vpanic(const char *fmt, va_list args)local_irq_disable ();preempt_disable_notrace ();
kernel/panic.c void vpanic(const char *fmt, va_list args) · line 549
Quoted 10 lines
kernel/panic.c +7
-0+/* +* Redirect panic to target CPU if configured via panic_force_cpu=. +* Returns false and never returns if panic was redirected. +*/ +if (!panic_force_target_cpu (fmt, args)) +panic_smp_self_stop (); +/* * It's possible to come here directly from a panic-assertion and * not have preempt disabled. Some functions called from here want
Best Regards,
Petr
RE: [PATCH v3] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Hi Petr,
Quoted 1 line
Adding more people into Cc. I doubt that
smp_call_function_single()is reliable inpanic().
You're right. I've switched to smp_call_function_single_async() which uses trylock semantics and won't block if the CSD is busy.
Quoted 94 lines · Pnina Feder
Quoted 93 lines
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add support for redirecting panic execution to a designated CPU via a kernel command-line parameter. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v2:
- Make panic redirection warnings generic and platform-agnosticReported-by kernel test robot <[email protected]>Closes:
https://lore.kernel.org/oe-kbuild-all/202601041820.6M8cIq2e-lkp@intel.
com/Signed-off-by Pnina Feder <[email protected]>--- kernel/panic.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)kernel/panic.c index renamed from kernel/panic.c +0
-0
0d52210a9e2b..6239bcdc2463100644kernel/panic.c +58
-0@@ -300,6 +300,92 @@ void __weak crash_smp_send_stop(void)atomic_t panic_cpu =ATOMIC_INIT (PANIC_CPU_INVALID ); +#ifdef CONFIG_SMP +/* CPU to redirect panic to, -1 means feature is disabled */ static +int panic_force_cpu =-1 ; + +static int __init panic_force_cpu_setup (char *str) { +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ; + } + + panic_force_cpu = cpu; +pr_info ("panic_force_cpu: panic will execute on CPU %d\n" , cpu); +return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) { +panic ("%s" , (char *)info); +} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for +crash kernel +* @fmt: panic message format string +* @args: arguments for format string +* +* Some platforms require panic handling to occur on a specific CPU +* for the crash kernel to function correctly. This function +redirects +* panic handling to the CPU specified via the panic_redirect_cpu= boot parameter. +* +* Returns true if panic should proceed on current CPU. +* Returns false (never returns) if panic was redirected. +*/ +__printf(1, 0) +static bool panic_force_target_cpu (const char *fmt,va_list args) { +static char panic_redirect_msg[1024 ]; +int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */ +if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; + +/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) { +pr_warn ("panic: target CPU %d is offline, proceeding on CPU %d.\n" +"Crash kernel interrupts may be unavailable.\n" , target_cpu, cpu); +return true;
Quoted 8 lines
kernel/panic.c void __weak crash_smp_send_stop(void) · line 366
Quoted 5 lines
kernel/panic.c +5
-0+ } + +/* Another panic already in progress */ +if (panic_in_progress ()) { + pr_warn("panic: Another panic in progress on CPU %d, cannot redirect to CPU %d.\n"IMHO, this message does not add much value and should be omitted.
vpanic()does not print any message whenpanic_try_start()fails.
Agreed, removed in v4.
Quoted 3 lines
kernel/panic.c void __weak crash_smp_send_stop(void) · line 367
Quoted 1 line
kernel/panic.c +1
-0+ "Crash kernel interrupts may be unavailable.\n",I am confused by this message.
Removed along with other verbose warnings.
Quoted 11 lines
kernel/panic.c void __weak crash_smp_send_stop(void)
Quoted 9 lines
kernel/panic.c +9
-0+ atomic_read(&panic_cpu), target_cpu); +return true; + } + +pr_info ("panic: Redirecting from CPU %d to CPU %d for crash kernel\n" , + cpu, target_cpu); + +vsnprintf (panic_redirect_msg,sizeof (panic_redirect_msg), fmt, +args);The "redirect" in "
panic_redirect_msg" is confusing. It has nothing to do with redirection. It is just a buffer for the formatted panic message. I would call it "buf" or "panic_msg".
I'm now reusing vpanic()'s existing static buf[1024], passing it as a parameter. This also addresses Andrew's concern about the extra 1k memory allocation.
Quoted 7 lines
kernel/panic.c void __weak crash_smp_send_stop(void) · line 377
Quoted 2 lines
kernel/panic.c +2
-0+smp_call_function_single (target_cpu, do_panic_on_target_cpu, +panic_redirect_msg, false);I doubt that this is safe and reliable in
panic()context.
For a start,panic()might be called in NMI and this function takescsd_lock().
panic()code should avoid locks. Or is should use trylock and handle a failure gracefully.
Changed to smp_call_function_single_async() which returns error instead of blocking if the CSD is busy. On failure, panic continues locally.
Quoted 3 lines
BTW: The commit message says that this is needed for crash-dump
to work reliably. So, it does not make sense to do this when crash-dump is not configured.
Good point. I've added CONFIG_CRASH_DUMP to the #ifdef in v4.
Quoted 2 lines
Maybe, crash-dump should get fixed instead? What are the exact problems with the crash-dump, please?
On some platforms, the interrupt controller configuration for the crash kernel depends on which CPU executes the panic path. By the time the crash kernel starts, all secondary CPUs have already been stopped via smp_send_stop(), so it's too late to fix the routing at that point.
Thanks for the review!
Pnina
PATCH v4 1/1 panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina FederSome platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v3:
- Dump original CPU's stack before redirecting to preserve debug info
- Add Documentation/admin-guide/kernel-parameters.txt entry
- Use smp_call_function_single_async() to avoid blocking in csd_lock()
- Add CONFIG_CRASH_DUMP dependency
- Reuse vpanic()'s static buffer instead of separate allocation
- Remove verbose warning messages
--- .../admin-guide/kernel-parameters.txt | 13 +++ kernel/panic.c | 104 ++++++++++++++++++ 2 files changed, 117 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +13 -0
@@ -4753,6 +4753,19 @@ Kernel parameters panic_on_warn=1 panic() instead of WARN(). Useful to cause kdump on a WARN(). + panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routing + constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU. + panic_print= Bitmask for printing system info when panic happens. User can chose combination of the following bits: bit 0: print all tasks info
kernel/panic.c +104 -0
116 lines not on this page · raw message
Signature · 1 line
2.43.0
Andrew Morton
maintainerRe: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 14 lines · On Wed, 7 Jan 2026 23:56:59 +0200 Pnina Feder <[email protected]> wrote:
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Quoted 7 lines
Changes since v3:
- Dump original CPU's stack before redirecting to preserve debug info
- AddDocumentation/admin-guide/kernel-parameters.txtentry
- Usesmp_call_function_single_async()to avoid blocking incsd_lock()
- AddCONFIG_CRASH_DUMPdependency
- Reuse vpanic()'s static buffer instead of separate allocation
- Remove verbose warning messages
Looking nice to my eye.
Quoted 1 line
+#if
defined(CONFIG_SMP)&&defined(CONFIG_CRASH_DUMP)
Congrats on caring about uniprocessor ;)
Quoted 14 lines
kernel/panic.c +14
-0+/* CPU to redirect panic to, or -1 if disabled */ +static int panic_force_cpu =-1 ; +static call_single_data_t panic_csd; + +static int __init panic_force_cpu_setup (char *str) +{ +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ;
kernel/panic.c void __weak crash_smp_send_stop(void) · line 327
Quoted 10 lines
kernel/panic.c +10
-0+ } + + panic_force_cpu = cpu; +return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) +{ +panic ("%s" , (char *)info);
Probably the (char *) cast isn't needed?
kernel/panic.c void __weak crash_smp_send_stop(void) · line 333
Quoted 6 lines
kernel/panic.c +6
-0+} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for crash kernel +* @fmt: panic message format string +* @args: arguments for format string
make htmldocs' is going to get upset about missing docs for buf' and `buf_size'?
Quoted 9 lines
+ * Some platforms require panic handling to occur on a specific CPU
+ * for the crash kernel to function correctly. This function redirects
+ * panic handling to the CPU specified via the panic_redirect_cpu= boot parameter.
+ *
+ * Returns true if panic should proceed on current CPU.
+ * Returns false (never returns) if panic was redirected.
+ */kernel/panic.c +2
-0+__printf(3, 0) +static bool panic_force_target_cpu (char *buf,int buf_size,const char *fmt,va_list args)
RE: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 25 lines · On Wed, 7 Jan 2026 23:56:59 +0200 Pnina Feder <[email protected]> >…
Quoted 15 lines
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and > kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Quoted 8 lines
Changes since v3:
- Dump original CPU's stack before redirecting to preserve debug info
- AddDocumentation/admin-guide/kernel-parameters.txtentry
- Usesmp_call_function_single_async()to avoid blocking incsd_lock()
- AddCONFIG_CRASH_DUMPdependency
- Reuse vpanic()'s static buffer instead of separate allocation
- Remove verbose warning messages
Quoted 1 line
Looking nice to my eye.
Thanks!
Quoted 19 lines
Quoted 1 line
+#if
defined(CONFIG_SMP)&&defined(CONFIG_CRASH_DUMP)Congrats on caring about uniprocessor ;)
Quoted 15 lines
kernel/panic.c +15
-0+/* CPU to redirect panic to, or -1 if disabled */ static int +panic_force_cpu =-1 ;static call_single_data_t panic_csd; + +static int __init panic_force_cpu_setup (char *str) { +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ; + } + + panic_force_cpu = cpu;
Quoted 8 lines
kernel/panic.c void __weak crash_smp_send_stop(void) · line 327
Quoted 6 lines
kernel/panic.c +6
-0+return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) { +panic ("%s" , (char *)info);Probably the (char *) cast isn't needed?
You're right, removed.
Quoted 9 lines
kernel/panic.c void __weak crash_smp_send_stop(void) · line 333
Quoted 7 lines
kernel/panic.c +7
-0+} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for +crash kernel +* @fmt: panic message format string +* @args: arguments for format string
make htmldocs' is going to get upset about missing docs forbuf' and `buf_size'?
Fixed.
Will send v5 with these fixes.
Thanks,
Pnina
Re: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina FederQuoted 2 lines · Pnina Feder
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations,
Thanks for fixing this. Could you kindly reveal which platform this issue is from?
Quoted 11 lines
interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
What if both the original CPU and specified CPU are not able to function well on panic jumping? The crash dumping will fail in this case?
Quoted 164 lines
Changes since v3:
- Dump original CPU's stack before redirecting to preserve debug info
- AddDocumentation/admin-guide/kernel-parameters.txtentry
- Usesmp_call_function_single_async()to avoid blocking incsd_lock()
- AddCONFIG_CRASH_DUMPdependency
- Reuse vpanic()'s static buffer instead of separate allocation
- Remove verbose warning messagesSigned-off-by Pnina Feder <[email protected]>--- .../admin-guide/kernel-parameters.txt | 13 +++ kernel/panic.c | 104 ++++++++++++++++++ 2 files changed, 117 insertions(+)Documentation/admin-guide/kernel-parameters.txt +13
-0@@ -4753,6 +4753,19 @@ Kernel parameters panic_on_warn=1 panic() instead of WARN(). Useful to cause kdump on a WARN(). + panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routing + constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU. + panic_print= Bitmask for printing system info when panic happens. User can chose combination of the following bits: bit 0: print all tasks infokernel/panic.c +104
-0@@ -300,6 +300,103 @@ void __weak crash_smp_send_stop(void)atomic_t panic_cpu =ATOMIC_INIT (PANIC_CPU_INVALID ); +#if defined(CONFIG_SMP ) && defined(CONFIG_CRASH_DUMP ) +/* CPU to redirect panic to, or -1 if disabled */ +static int panic_force_cpu =-1 ; +static call_single_data_t panic_csd; + +static int __init panic_force_cpu_setup (char *str) +{ +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ; + } + + panic_force_cpu = cpu; +return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) +{ +panic ("%s" , (char *)info); +} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for crash kernel +* @fmt: panic message format string +* @args: arguments for format string +* +* Some platforms require panic handling to occur on a specific CPU +* for the crash kernel to function correctly. This function redirects +* panic handling to the CPU specified via the panic_redirect_cpu= boot parameter. +* +* Returns true if panic should proceed on current CPU. +* Returns false (never returns) if panic was redirected. +*/ +__printf(3, 0) +static bool panic_force_target_cpu (char *buf,int buf_size,const char *fmt,va_list args) +{ +int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */ +if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; + +/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) +return true; + +/* Another panic already in progress */ +if (panic_in_progress ()) +return true; + +vsnprintf (buf, buf_size, fmt, args); + +console_verbose (); +bust_spinlocks (1 ); + +pr_emerg ("panic: Redirecting from CPU %d to CPU %d for crash kernel\n" , + cpu, target_cpu); + +/* Dump original CPU's stack before redirecting */ +if (test_taint (TAINT_DIE ) || oops_in_progress >1 ) { + panic_this_cpu_backtrace_printed = true; + }else if (IS_ENABLED (CONFIG_DEBUG_BUGVERBOSE )) { +dump_stack (); + panic_this_cpu_backtrace_printed = true; + } + +printk_legacy_allow_panic_sync (); +console_flush_on_panic (CONSOLE_FLUSH_PENDING ); + + panic_csd.func = do_panic_on_target_cpu; + panic_csd.info = buf; + +/* Use smp_call_function_single_async() to avoid blocking in csd_lock(). */ +if (smp_call_function_single_async (target_cpu, &panic_csd) !=0 ) +return true; + +return false; +} +#else +__printf(3, 0) +static inline bool panic_force_target_cpu (char *buf,int buf_size,const char *fmt,va_list args) +{ +return true; +} +#endif /* CONFIG_SMP && CONFIG CRASH_DUMP */ +bool panic_try_start (void ) {int old_cpu, this_cpu;@@ -451,6 +548,13 @@ void vpanic(const char *fmt, va_list args)local_irq_disable ();preempt_disable_notrace (); +/* +* Redirect panic to target CPU if configured via panic_force_cpu=. +* Returns false and never returns if panic was redirected. +*/ +if (!panic_force_target_cpu (buf,sizeof (buf), fmt, args)) +panic_smp_self_stop (); +/* * It's possible to come here directly from a panic-assertion and * not have preempt disabled. Some functions called from here want Signature · 1 line
2.43.0
Re: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 15 lines · Baoquan He
Quoted 2 lines · Pnina Feder
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations,
Thanks for fixing this. Could you kindly reveal which platform this issue is from?
Quoted 8 lines
interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
Quoted 6 lines
Quoted 3 lines
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
What if both the original CPU and specified CPU are not able to function well on panic jumping? The crash dumping will fail in this case?
Yes.
RE: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Baoquan HeQuoted 4 lines
Quoted 2 lines
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations,
Thanks for fixing this. Could you kindly reveal which platform this issue is from?
This is for a custom SoC based on RISC-V, where the console/UART interrupt is routed exclusively to cluster 0 (CPU 0). Due to this hardware design, only CPU 0 can reliably handle console output during the crash kernel entry, making it necessary to redirect panic handling to that specific CPU.
Quoted 8 lines
Quoted 8 lines
interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
Quoted 5 lines
Quoted 3 lines
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
What if both the original CPU and specified CPU are not able to function well on panic > jumping? The crash dumping will fail in this case?
Yes, in that case crash dumping will fail. However, this is consistent with the existing behavior-if the original panicking CPU cannot function well enough to enter the crash kernel, the dump would fail anyway. This feature simply provides an additional option to attempt redirection to a known-good CPU when it is online and available. If the target CPU is offline or unreachable, we fall back to the regular flow and proceed with the crash on the current CPU, so we're not making the situation any worse.
Quoted 150 lines
Quoted 150 lines
Changes since v3:
- Dump original CPU's stack before redirecting to preserve debug info
- AddDocumentation/admin-guide/kernel-parameters.txtentry> - Use >smp_call_function_single_async()to avoid blocking incsd_lock()
- AddCONFIG_CRASH_DUMPdependency
- Reuse vpanic()'s static buffer instead of separate allocation
- Remove verbose warning messagesSigned-off-by Pnina Feder <[email protected]>--- .../admin-guide/kernel-parameters.txt | 13 +++ kernel/panic.c | 104 ++++++++++++++++++ 2 files changed, 117 insertions(+)Documentation/admin-guide/kernel-parameters.txt +13
-0@@ -4753,6 +4753,19 @@ Kernel parameters panic_on_warn=1 panic() instead of WARN(). Useful to cause kdump on a WARN(). + panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routing + constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU. + panic_print= Bitmask for printing system info when panic happens. User can chose combination of the following bits: bit 0: print all tasks infokernel/panic.c index renamed from kernel/panic.c +0
-0
0d52210a9e2b..414ef60d2306100644kernel/panic.c +96
-0@@ -300,6 +300,103 @@ void __weak crash_smp_send_stop(void)atomic_t panic_cpu =ATOMIC_INIT (PANIC_CPU_INVALID ); +#if defined(CONFIG_SMP ) && defined(CONFIG_CRASH_DUMP ) +/* CPU to redirect panic to, or -1 if disabled */ static int +panic_force_cpu =-1 ;static call_single_data_t panic_csd; + +static int __init panic_force_cpu_setup (char *str) { +int cpu; + +if (!str) +return -EINVAL ; + +if (kstrtoint (str,0 , &cpu) || cpu <0 ) { +pr_warn ("panic_force_cpu: invalid value '%s'\n" , str); +return -EINVAL ; + } + + panic_force_cpu = cpu; +return 0 ; +} +early_param ("panic_force_cpu" , panic_force_cpu_setup); + +static void do_panic_on_target_cpu (void *info) { +panic ("%s" , (char *)info); +} + +/** +* panic_force_target_cpu - Redirect panic to a specific CPU for +crash kernel +* @fmt: panic message format string +* @args: arguments for format string +* +* Some platforms require panic handling to occur on a specific CPU +* for the crash kernel to function correctly. This function +redirects +* panic handling to the CPU specified via the panic_redirect_cpu= boot parameter. +* +* Returns true if panic should proceed on current CPU. +* Returns false (never returns) if panic was redirected. +*/ +__printf(3, 0) +static bool panic_force_target_cpu (char *buf,int buf_size,const +char *fmt,va_list args) { +int cpu =raw_smp_processor_id (); +int target_cpu = panic_force_cpu; + +/* Feature not enabled via boot parameter */ +if (target_cpu <0 ) +return true; + +/* Already on target CPU - proceed normally */ +if (cpu == target_cpu) +return true; + +/* Target CPU is offline, can't redirect */ +if (!cpu_online (target_cpu)) +return true; + +/* Another panic already in progress */ +if (panic_in_progress ()) +return true; + +vsnprintf (buf, buf_size, fmt, args); + +console_verbose (); +bust_spinlocks (1 ); + +pr_emerg ("panic: Redirecting from CPU %d to CPU %d for crash kernel\n" , + cpu, target_cpu); + +/* Dump original CPU's stack before redirecting */ +if (test_taint (TAINT_DIE ) || oops_in_progress >1 ) { + panic_this_cpu_backtrace_printed = true; + }else if (IS_ENABLED (CONFIG_DEBUG_BUGVERBOSE )) { +dump_stack (); + panic_this_cpu_backtrace_printed = true; + } + +printk_legacy_allow_panic_sync (); +console_flush_on_panic (CONSOLE_FLUSH_PENDING ); + + panic_csd.func = do_panic_on_target_cpu; + panic_csd.info = buf; + +/* Use smp_call_function_single_async() to avoid blocking in csd_lock(). */ +if (smp_call_function_single_async (target_cpu, &panic_csd) !=0 ) +return true; + +return false; +} +#else +__printf(3, 0) +static inline bool panic_force_target_cpu (char *buf,int buf_size, +const char *fmt,va_list args) { +return true; +} +#endif /* CONFIG_SMP && CONFIG CRASH_DUMP */ +bool panic_try_start (void ) {int old_cpu, this_cpu;@@ -451,6 +548,13 @@ void vpanic(const char *fmt, va_list args)local_irq_disable ();preempt_disable_notrace ();
Quoted 13 lines
Quoted 11 lines
kernel/panic.c +7
-1+/* +* Redirect panic to target CPU if configured via panic_force_cpu=. +* Returns false and never returns if panic was redirected. +*/ +if (!panic_force_target_cpu (buf,sizeof (buf), fmt, args)) +panic_smp_self_stop (); +/* * It's possible to come here directly from a panic-assertion and * not have preempt disabled. Some functions called from here want -- Quoted 2 lines
2.43.0
Thanks,
Pnina
Re: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina FederQuoted 5 lines · Pnina Feder
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Quoted 8 lines
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
This seems exceedingly fragile to me. Who is saying the target CPU is even responsive? At the very least this should be an arch callback such that it can use NMIs where available.
Also, if this is a 'requirement' for kexec or the like, this shouldn't be a command line argument, but something that's set-up by kexec itself for functional reasons.
Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 4767
Quoted 12 lines
Documentation/admin-guide/kernel-parameters.txt +12
-0+ panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routing + constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU.
It this stays; it should have a warning that it makes the panic less reliable.
Re: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 6 lines · On Thu, 8 Jan 2026 08:48:57 +0100 Peter Zijlstra <[email protected]> wrote:
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routing
Quoted 8 lines
Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 4767
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU.It this stays; it should have a warning that it makes the panic less reliable.
Agreed. It should probably end with:
This option should only be used for systems with the above constraints as it will cause the panic operation to be less reliable.
-- Steve
RE: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Hi Steve,
Quoted 18 lines
Quoted 6 lines · On Thu, 8 Jan 2026 08:48:57 +0100 Peter Zijlstra <[email protected]> wrote:
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routingQuoted 8 lines
Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 4767
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU.It this stays; it should have a warning that it makes the panic less reliable.
Quoted 7 lines
Agreed. It should probably end with:
This option should only be used for systems with the above constraints as it will cause the panic operation to be less reliable.
-- Steve
I have added your suggestion to the documentation on v5.
Thanks,
Pnina
RE: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Peter ZijlstraHi Peter,
Thanks for the review.
Quoted 11 lines
Quoted 11 lines · Pnina Feder
Some platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
Quoted 5 lines
Quoted 3 lines
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
This seems exceedingly fragile to me. Who is saying the target CPU is even responsive? At the very least this should be an arch callback such that it can use NMIs where available.
You're right that this adds a dependency on the target CPU being responsive. However, for platforms where the crash kernel must run on a specific CPU, this is our best-effort solution. I've taken your advice and made the IPI delivery an overridable __weak function (panic_smp_redirect_cpu),
so architectures with NMI support can provide a more reliable implementation.
Quoted 1 line
Also, if this is a 'requirement' for kexec or the like, this shouldn't be a command line argument, but something that's set-up by kexec itself for functional reasons.
Since the redirection needs to happen before other CPUs are stopped, would a sysctl be preferable? The user could set it when loading the crash kernel.
Quoted 6 lines
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routing
Quoted 8 lines
Documentation/admin-guide/kernel-parameters.txt Kernel parameters · line 4767
Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +6
-0+ constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU.It this stays; it should have a warning that it makes the panic less reliable.
Agreed, I'll add a warning to the documentation in v5.
Thanks,
Pnina
Re: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 7 lines · Pnina Feder
Quoted 3 lines
Also, if this is a 'requirement' for kexec or the like, this shouldn't be a command line argument, but something that's set-up by kexec itself for functional reasons.
Since the redirection needs to happen before other CPUs are stopped, would a sysctl be preferable? The user could set it when loading the crash kernel.
I was more thinking about platform setup, it would set this on boot, and equally dis-allow hot-unplug of the magical CPU.
RE: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Hi,
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Also, if this is a 'requirement' for kexec or the like, this shouldn't be a command line argument, but something that's set-up by kexec itself for functional reasons.
Since the redirection needs to happen before other CPUs are stopped, would a sysctl be preferable? The user could set it when loading the crash kernel.
I was more thinking about platform setup, it would set this on boot, and equally dis-allow hot-unplug of the magical CPU.
Thanks for the suggestion.
I was thinking of this as a fixed platform requirement that is known at boot and needs to apply from the start of the panic path. Handling it via platform setup would likely involve additional CPU hotplug and lifecycle handling, which seemed unnecessary for this case. A boot-time parameter felt like a simple and explicit way to express that constraint.
Please let me know if this sounds reasonable.
Thanks,
Pnina
kernel test robot
build botRe: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina Federkernel test robot noticed the following build warnings:
Hi Pnina,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.19-rc4 next-20260108] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pnina-Feder/panic-add-panic_force_cpu-parameter-to-redirect-panic-to-a-specific-CPU/20260108-055823 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20260107215659.3619730-1-pnina.feder%40mobileye.com patch subject: [PATCH v4] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260109/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260109/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> Warning: kernel/panic.c:344 function parameter 'buf' not described in 'panic_force_target_cpu' >> Warning: kernel/panic.c:344 function parameter 'buf_size' not described in 'panic_force_target_cpu' >> Warning: kernel/panic.c:344 function parameter 'buf' not described in 'panic_force_target_cpu' >> Warning: kernel/panic.c:344 function parameter 'buf_size' not described in 'panic_force_target_cpu'
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v5 1/1 panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina FederSome platforms require panic handling to execute on a specific CPU for crash dump to work reliably. This can be due to firmware limitations, interrupt routing constraints, or platform-specific requirements where only a single CPU is able to safely enter the crash kernel.
Add the panic_force_cpu= kernel command-line parameter to redirect panic execution to a designated CPU. When the parameter is provided, the CPU that initially triggers panic forwards the panic context to the target CPU via IPI, which then proceeds with the normal panic and kexec flow.
The IPI delivery is implemented as a weak function (panic_smp_redirect_cpu) so architectures with NMI support can override it for more reliable delivery.
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v4:
- Make IPI delivery an overridable weak function (panic_smp_redirect_cpu) so architectures can use NMI where available
- Add declaration on include/linux/smp.h alongside other panic SMP functions
- Add warning to documentation about reduced reliability
- Address review comments from Andrew Morton (remove unnecessary cast, add missing kernel-doc parameters)
--- .../admin-guide/kernel-parameters.txt | 15 +++ include/linux/smp.h | 1 + kernel/panic.c | 122 ++++++++++++++++++ 3 files changed, 138 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +15 -0
@@ -4753,6 +4753,21 @@ Kernel parameters panic_on_warn=1 panic() instead of WARN(). Useful to cause kdump on a WARN(). + panic_force_cpu= + [KNL,SMP] Force panic handling to execute on a specific CPU. + Format: <cpu number> + Some platforms require panic handling to occur on a + specific CPU for the crash kernel to function correctly. + This can be due to firmware limitations, interrupt routing + constraints, or platform-specific requirements where only + a particular CPU can safely enter the crash kernel. + When set, panic() will redirect execution to the specified + CPU before proceeding with the normal panic and kexec flow. + If the target CPU is offline or unavailable, panic proceeds + on the current CPU. + This option should only be used for systems with the above + constraints as it might cause the panic operation to be less reliable. + panic_print= Bitmask for printing system info when panic happens. User can chose combination of the following bits: bit 0: print all tasks info
include/linux/smp.h +1 -0
@@ -62,6 +62,7 @@ int smp_call_function_single_async(int cpu, call_single_data_t *csd);void __noreturn panic_smp_self_stop (void );void __noreturn nmi_panic_self_stop (struct pt_regs *regs);void crash_smp_send_stop (void ); +int panic_smp_redirect_cpu (int target_cpu,void *msg);/* * Call a function on all processors
kernel/panic.c +122 -0
134 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v5] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
On Thu, 8 Jan 2026 22:36:12 +0200
Pnina Feder <[email protected]> wrote:
First, new versions of a patch or patch set should *always* be a new thread and not a reply to the old version. That makes it much harder on maintainers to see a new series.
Quoted 12 lines
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v4:
- Make IPI delivery an overridable weak function (panic_smp_redirect_cpu) so architectures can use NMI where available
- Add declaration oninclude/linux/smp.halongside other panic SMP functions
- Add warning to documentation about reduced reliability
- Address review comments from Andrew Morton (remove unnecessary cast, add missing kernel-doc parameters)
Quoted 2 lines
Signed-off-by Pnina Feder <[email protected]>---
The "Changes since" line should always be below the '---' otherwise it gets pulled into the git log and the maintainer needs to manually delete it (which is annoying).
Also, it is helpful to add a link to the previous version.
Quoted 2 lines
Signed-off-by Pnina Feder <[email protected]>---
Changes since v4: https://lore.kernel.org/all/[email protected]/
- Make IPI delivery an overridable weak function (panic_smp_redirect_cpu)
so architectures can use NMI where available
- Add declaration on include/linux/smp.h alongside other panic SMP functions
- Add warning to documentation about reduced reliability
- Address review comments from Andrew Morton (remove unnecessary cast,
add missing kernel-doc parameters)
This provides the continuity between versions without having to be replies of older versions.
-- Steve
RE: [PATCH v5] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Hi Steve,
Thanks for the guidance, will do.
Pnina
Quoted 38 lines
On Thu, 8 Jan 2026 22:36:12 +0200
Pnina Feder <[email protected]> wrote:First, new versions of a patch or patch set should *always* be a new thread and not a reply to the old version. That makes it much harder on maintainers to see a new series.
Quoted 13 lines
If the specified CPU is invalid, offline, or a panic is already in progress on another CPU, the redirection is skipped and panic continues on the current CPU.
Changes since v4:
- Make IPI delivery an overridable weak function (panic_smp_redirect_cpu) so architectures can use NMI where available
- Add declaration oninclude/linux/smp.halongside other panic SMP
functions
- Add warning to documentation about reduced reliability
- Address review comments from Andrew Morton (remove unnecessary cast, add missing kernel-doc parameters)Quoted 2 lines
Signed-off-by Pnina Feder <[email protected]>---
The "Changes since" line should always be below the '---' otherwise it gets pulled into the git log and the maintainer needs to manually delete it (which is annoying).
Also, it is helpful to add a link to the previous version.
Quoted 2 lines
Signed-off-by Pnina Feder <[email protected]>---
Changes since v4: Suspicious Link - Removed
- Make IPI delivery an overridable weak function (panic_smp_redirect_cpu) so architectures can use NMI where available
- Add declaration oninclude/linux/smp.halongside other panic SMP functions
- Add warning to documentation about reduced reliability
- Address review comments from Andrew Morton (remove unnecessary cast, add missing kernel-doc parameters)This provides the continuity between versions without having to be replies of older versions.
-- Steve
Re: [PATCH v5] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 15 lines · On Sun, 11 Jan 2026 10:05:05 +0000 Pnina Feder <[email protected]> wrote:
Hi Steve,
Thanks for the guidance, will do.
Quoted 11 lines
Quoted 3 lines
Signed-off-by Pnina Feder <[email protected]>---
The "Changes since" line should always be below the '---' otherwise it gets pulled into the git log and the maintainer needs to manually delete it (which is annoying).
Also, it is helpful to add a link to the previous version.
Quoted 2 lines
Signed-off-by Pnina Feder <[email protected]>---
Changes since v4: Suspicious Link - Removed
Of course it seems that your email server removes active links to old versions which defeats the purpose :-p
-- Steve
Quoted 2 lines
Quoted 2 lines
- Make IPI delivery an overridable weak function (
panic_smp_redirect_cpu) so architectures can use NMI where available
kernel test robot
build botRe: [PATCH v5] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
In reply to Pnina Federkernel test robot noticed the following build warnings:
Hi Pnina,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.19-rc4 next-20260109] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pnina-Feder/panic-add-panic_force_cpu-parameter-to-redirect-panic-to-a-specific-CPU/20260109-043725 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20260108203612.955769-1-pnina.feder%40mobileye.com patch subject: [PATCH v5] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260109/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260109/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
kernel/panic.c: In function 'do_panic_on_target_cpu':
>> kernel/panic.c:327:17: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'void *' [-Wformat=]
327 | panic("%s", info);
| ~^ ~~~~
| | |
| | void *
| char *
| %pvim +327 kernel/panic.c
324
325 static void do_panic_on_target_cpu(void *info)
326 {
> 327 panic("%s", info); 328 }
329
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Andrew Morton
maintainerRe: [PATCH v5] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 4 lines · On Fri, 9 Jan 2026 23:19:34 +0100 kernel test robot <[email protected]> wrote:
kernel/panic.c: In function 'do_panic_on_target_cpu':Quoted 1 line
Quoted 1 line
kernel/panic.c:327:17: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'void *' [-Wformat=]327 | panic("%s", info); | ~^ ~~~~
Thanks. That's what you get for listening to akpm ;)
Stupid compiler.
RE: [PATCH v5] panic: add panic_force_cpu= parameter to redirect panic to a specific CPU
Quoted 10 lines · On Fri, 9 Jan 2026 23:19:34 +0100 kernel test robot <[email protected]> wrote:
Quoted 5 lines
kernel/panic.c: In function 'do_panic_on_target_cpu':Quoted 1 line
Quoted 1 line
kernel/panic.c:327:17: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'void *' [-Wformat=]327 | panic("%s", info); | ~^ ~~~~Thanks. That's what you get for listening to akpm ;)
Stupid compiler.
I'll add the cast back in v6 :)
Pnina