Re: [PATCH 1/1] watchdog: avoid extra sys_info dumps for all_bt
From: Petr Mladek
Date: Tue Jun 23 2026 - 08:37:24 EST
On Sat 2026-06-20 22:01:40, Bradley Morgan wrote:
> The watchdog handles SYS_INFO_ALL_BT itself. When that is the only
> watchdog specific bit, sys_info(0) falls back to kernel_sys_info.
Great catch!
> Skip sys_info() for that case.
>
> Fixes: a9af76a78760 ("watchdog: add sys_info sysctls to dump sys info on system lockup")
> Signed-off-by: Bradley Morgan <include@xxxxxxxxx>
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -54,6 +54,16 @@ static int __read_mostly watchdog_hardlockup_available;
> struct cpumask watchdog_cpumask __read_mostly;
> unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask);
>
Similar problem exists also in kernel/panic.c. It would make
sense to put this variant into lib/sys_info.c and use a generic name,
e.g. sys_info_without_all_bt().
> +static void watchdog_sys_info(unsigned long si_mask)
> +{
> + unsigned long dump_mask = si_mask & ~SYS_INFO_ALL_BT;
> +
This looks like an optimization. The real reason is not obvious.
It would deserve a comment, something like:
/*
* Do not call sys_info() when the caller context required
* only backtraces from all CPUs. Otherwise, sys_info()
* would fall back to the generic "kernel_si_mask".
*/
> + if (si_mask && !dump_mask)
> + return;
> +
> + sys_info(dump_mask);
> +}
Alternative solution would be to remove the custom
trigger_all*_cpu_backtrace() calls from both watchdog and panic
code and rely on sys_info() API. But it is not easy, especially
in panic().
Otherwise, the changes make sense.
Best Regards,
Petr