Re: [PATCH v3 3/4] powerpc/watchdog: use sys_info_with_filter() to avoid duplicate backtraces

From: Petr Mladek

Date: Fri Jun 26 2026 - 05:43:58 EST


On Thu 2026-06-25 15:25:57, Bradley Morgan wrote:
> The powerpc watchdog prints all CPU backtraces itself. When the watchdog
> mask contains only SYS_INFO_ALL_BT, stripping that bit leaves zero and
> sys_info(0) falls back to kernel_sys_info.
>
> Use sys_info_with_filter() so an explicit all_bt mask does not request
> the global default.
>
> --- a/arch/powerpc/kernel/watchdog.c
> +++ b/arch/powerpc/kernel/watchdog.c
> @@ -418,11 +421,12 @@ DEFINE_INTERRUPT_HANDLER_NMI(soft_nmi_interrupt)
>
> xchg(&__wd_nmi_output, 1); // see wd_lockup_ipi
>
> + si_mask = READ_ONCE(hardlockup_si_mask);
> if (sysctl_hardlockup_all_cpu_backtrace ||
> - (hardlockup_si_mask & SYS_INFO_ALL_BT))
> + (si_mask & SYS_INFO_ALL_BT))
> trigger_allbutcpu_cpu_backtrace(cpu);
>
> - sys_info(hardlockup_si_mask & ~SYS_INFO_ALL_BT);
> + sys_info_with_filter(si_mask, SYS_INFO_ALL_BT);
> if (hardlockup_panic)
> nmi_panic(regs, "Hard LOCKUP");

I thought more about it and it is even more complicated.

Even if we prevent the duplicated output with sys_info_with_filter()
here. Then nmi_panic() might still trigger it once again.

We could say that this patch is a step in the right direction and
fix the other problem later. But I am not sure. We might need
a completely different approach and this is just a step aside.

And there is another problem in the panic() code. I am going to
comment in it in the 4th patch.

Best Regards,
Petr