Re: [PATCH v4] watchdog: Allow nmi watchdog to use "ref-cycles" event

From: Song Liu
Date: Thu Jun 08 2023 - 14:18:31 EST


Hi Peter,

> On Jun 2, 2023, at 4:15 PM, Song Liu <songliubraving@xxxxxxxx> wrote:

[...]

>>> nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels
>>> - Format: [panic,][nopanic,][num]
>>> + Format: [panic,][nopanic,][ref-cycles][num]
>>> Valid num: 0 or 1
>>> 0 - turn hardlockup detector in nmi_watchdog off
>>> 1 - turn hardlockup detector in nmi_watchdog on
>>> + ref-cycles - configure the watchdog with perf event
>>> + "ref-cycles" instead of "cycles"
>>> When panic is specified, panic when an NMI watchdog
>>> timeout occurs (or 'nopanic' to not panic on an NMI
>>> watchdog, if CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is set)
>>
>> I still hate the whole ref-cycles thing, at the very least powerpc also
>> has HAVE_HARDLOCKUP_DETECTOR_PERF and they don't have ref-cycles, but
>> perhaps them wants to use a different event when the moon is just so...
>>
>> What again was wrong with the option of specifying a raw event value and
>> falling back to cpu-cycles if that fails?
>
> The same raw event number may mean different events on different hardware.
> So it is more likely to make mistakes in configurations. For example, r300
> means ref-cycles on Intel CPUs, but it also means something else on AMD
> CPUs. I need to be very careful which hosts to run with nmi_watchdog=r300,
> as it may cause surprises. OTOH, nmi_watchdog=ref-cycles won't have this
> issue. Of course, this won't work for powerpc.

Does this make sense? Do we have other ideas to configure this?

Thanks,
Song