[PATCH 0/7] watchdog/hardlockup: Cleanup configuration of hardlockup detectors

Petr Mladek
2023-06-07T15:26:30Z

Hi,

this patchset is supposed to replace the last patch in the patchset cleaning
up after introducing the buddy detector, see
https://lore.kernel.org/r/20230526184139.10.I821fe7609e57608913fe05abd8f35b343e7a9aae@changeid

There are four possible variants of hardlockup detectors:

+ buddy: available when SMP is set.

+ perf: available when HAVE_HARDLOCKUP_DETECTOR_PERF is set.

+ arch-specific: available when HAVE_HARDLOCKUP_DETECTOR_ARCH is set.

+ sparc64 special variant: available when HAVE_NMI_WATCHDOG is set
and HAVE_HARDLOCKUP_DETECTOR_ARCH is not set.

Only one hardlockup detector can be compiled in. The selection is done
using quite complex dependencies between several CONFIG variables.
The following patches will try to make it more straightforward.

Before, the decision was done using the following variables:

+ HAVE_HARDLOCKUP_DETECTOR_PERF
+ HAVE_HARDLOCKUP_DETECTOR_BUDDY
+ HAVE_HARDLOCKUP_DETECTOR_ARCH
+ HAVE_NMI_WATCHDOG

+ HARDLOCKUP_DETECTOR
+ HARDLOCKUP_DETECTOR_PREFER_BUDDY

+ HAVE_HARDLOCKUP_DETECTOR_NON_ARCH
+ HARDLOCKUP_DETECTOR_NON_ARCH

+ HARDLOCKUP_DETECTOR_PERF
+ HARDLOCKUP_DETECTOR_BUDDY

and the particular watchdog was used when the following variables were set:

+ perf: HARDLOCKUP_DETECTOR_PERF
+ buddy: HARDLOCKUP_DETECTOR_BUDDY
+ arch-specific: HAVE_HARDLOCKUP_DETECTOR_ARCH
+ sparc64: HAVE_NMI_WATCHDOG && !HAVE_HARDLOCKUP_DETECTOR_ARCH

After, the decision is done using the following variables:

+ HAVE_HARDLOCKUP_DETECTOR_PERF
+ HAVE_HARDLOCKUP_DETECTOR_BUDDY
+ HAVE_HARDLOCKUP_DETECTOR_ARCH
+ HAVE_HARDLOCKUP_DETECTOR_SPARC64

+ HARDLOCKUP_DETECTOR
+ HARDLOCKUP_DETECTOR_PREFER_BUDDY

+ HARDLOCKUP_DETECTOR_PERF
+ HARDLOCKUP_DETECTOR_BUDDY
+ HARDLOCKUP_DETECTOR_ARCH
+ HARDLOCKUP_DETECTOR_SPARC64

and the particular watchdog is used when one of these variables is set:

+ perf: HARDLOCKUP_DETECTOR_PERF
+ buddy: HARDLOCKUP_DETECTOR_BUDDY
+ arch-specific: HARDLOCKUP_DETECTOR_ARCH
+ sparc64: HARDLOCKUP_DETECTOR_SPARC64

Plus, many checks are more straightforward and even self-explanatory.

I build and run tested it on x86_64. I only checked the generated
.config after using sparc_defconfig, sparc64_defconfig, ppc64_defconfig,
and ppc40x_defconfig.

Best Regards,
Petr

Petr Mladek (7):
watchdog/hardlockup: Sort hardlockup detector related config values a
logical way
watchdog/hardlockup: Make the config checks more straightforward
watchdog/hardlockup: Declare arch_touch_nmi_watchdog() only in
linux/nmi.h
watchdog/hardlockup: Enable HAVE_NMI_WATCHDOG only on sparc64
watchdog/sparc64: Rename HAVE_NMI_WATCHDOG to
HAVE_HARDLOCKUP_WATCHDOG_SPARC64
watchdog/sparc64: Define HARDLOCKUP_DETECTOR_SPARC64
watchdog/hardlockup: Define HARDLOCKUP_DETECTOR_ARCH

arch/Kconfig | 17 ++---
arch/powerpc/Kconfig | 5 +-
arch/powerpc/include/asm/nmi.h | 2 -
arch/sparc/Kconfig | 2 +-
arch/sparc/Kconfig.debug | 20 ++++++
arch/sparc/include/asm/nmi.h | 1 -
include/linux/nmi.h | 14 ++--
kernel/watchdog.c | 2 +-
lib/Kconfig.debug | 115 +++++++++++++++++++--------------
9 files changed, 104 insertions(+), 74 deletions(-)

--
2.35.3