Re: [PATCH] panic/kexec: Allow forcing panic execution on a specific CPU

kernel test robot
2026-01-04T10:45:11Z

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/202601041820.6M8cIq2e-lkp@intel.com/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/202601041820.6M8cIq2e-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601041820.6M8cIq2e-lkp@intel.com/

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

--
0-DAY CI Kernel Test Service