Skip to content

Commit 4917a25

Browse files
pmladekakpm00
authored andcommitted
watchdog/hardlockup: sort hardlockup detector related config values a logical way
Patch series "watchdog/hardlockup: Cleanup configuration of hardlockup detectors", v2. Clean up watchdog Kconfig after introducing the buddy detector. This patch (of 6): 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. As a first step, reorder the definitions of the various CONFIG variables. The logical order is: 1. HAVE_* variables define available variants. They are typically defined in the arch/ config files. 2. HARDLOCKUP_DETECTOR y/n variable defines whether the hardlockup detector is enabled at all. 3. HARDLOCKUP_DETECTOR_PREFER_BUDDY y/n variable defines whether the buddy detector should be preferred over the perf one. Note that the arch specific variants are always preferred when available. 4. HARDLOCKUP_DETECTOR_PERF/BUDDY variables define whether the given detector is enabled in the end. 5. HAVE_HARDLOCKUP_DETECTOR_NON_ARCH and HARDLOCKUP_DETECTOR_NON_ARCH are temporary variables that are going to be removed in a followup patch. This is a preparation step for further cleanup. It will change the logic without shuffling the definitions. This change temporary breaks the C-like ordering where the variables are declared or defined before they are used. It is not really needed for Kconfig. Also the following patches will rework the logic so that the ordering will be C-like in the end. The patch just shuffles the definitions. It should not change the existing behavior. Link: https://lkml.kernel.org/r/20230616150618.6073-1-pmladek@suse.com Link: https://lkml.kernel.org/r/20230616150618.6073-2-pmladek@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: "David S. Miller" <davem@davemloft.net> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 28168ec commit 4917a25

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

lib/Kconfig.debug

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,11 +1035,39 @@ config BOOTPARAM_SOFTLOCKUP_PANIC
10351035

10361036
Say N if unsure.
10371037

1038-
# Both the "perf" and "buddy" hardlockup detectors count hrtimer
1039-
# interrupts. This config enables functions managing this common code.
1040-
config HARDLOCKUP_DETECTOR_COUNTS_HRTIMER
1041-
bool
1042-
select SOFTLOCKUP_DETECTOR
1038+
#
1039+
# arch/ can define HAVE_HARDLOCKUP_DETECTOR_ARCH to provide their own hard
1040+
# lockup detector rather than the perf based detector.
1041+
#
1042+
config HARDLOCKUP_DETECTOR
1043+
bool "Detect Hard Lockups"
1044+
depends on DEBUG_KERNEL && !S390
1045+
depends on HAVE_HARDLOCKUP_DETECTOR_NON_ARCH || HAVE_HARDLOCKUP_DETECTOR_ARCH
1046+
select LOCKUP_DETECTOR
1047+
select HARDLOCKUP_DETECTOR_NON_ARCH if HAVE_HARDLOCKUP_DETECTOR_NON_ARCH
1048+
1049+
help
1050+
Say Y here to enable the kernel to act as a watchdog to detect
1051+
hard lockups.
1052+
1053+
Hardlockups are bugs that cause the CPU to loop in kernel mode
1054+
for more than 10 seconds, without letting other interrupts have a
1055+
chance to run. The current stack trace is displayed upon detection
1056+
and the system will stay locked up.
1057+
1058+
config HARDLOCKUP_DETECTOR_PREFER_BUDDY
1059+
bool "Prefer the buddy CPU hardlockup detector"
1060+
depends on HAVE_HARDLOCKUP_DETECTOR_PERF && SMP
1061+
help
1062+
Say Y here to prefer the buddy hardlockup detector over the perf one.
1063+
1064+
With the buddy detector, each CPU uses its softlockup hrtimer
1065+
to check that the next CPU is processing hrtimer interrupts by
1066+
verifying that a counter is increasing.
1067+
1068+
This hardlockup detector is useful on systems that don't have
1069+
an arch-specific hardlockup detector or if resources needed
1070+
for the hardlockup detector are better used for other things.
10431071

10441072
config HARDLOCKUP_DETECTOR_PERF
10451073
bool
@@ -1051,6 +1079,12 @@ config HARDLOCKUP_DETECTOR_BUDDY
10511079
depends on SMP
10521080
select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER
10531081

1082+
# Both the "perf" and "buddy" hardlockup detectors count hrtimer
1083+
# interrupts. This config enables functions managing this common code.
1084+
config HARDLOCKUP_DETECTOR_COUNTS_HRTIMER
1085+
bool
1086+
select SOFTLOCKUP_DETECTOR
1087+
10541088
# For hardlockup detectors you can have one directly provided by the arch
10551089
# or use a "non-arch" one. If you're using a "non-arch" one that is
10561090
# further divided the perf hardlockup detector (which, confusingly, needs
@@ -1063,20 +1097,6 @@ config HAVE_HARDLOCKUP_DETECTOR_NON_ARCH
10631097
depends on (HAVE_HARDLOCKUP_DETECTOR_PERF || SMP) && !HAVE_NMI_WATCHDOG
10641098
default y
10651099

1066-
config HARDLOCKUP_DETECTOR_PREFER_BUDDY
1067-
bool "Prefer the buddy CPU hardlockup detector"
1068-
depends on HAVE_HARDLOCKUP_DETECTOR_PERF && SMP
1069-
help
1070-
Say Y here to prefer the buddy hardlockup detector over the perf one.
1071-
1072-
With the buddy detector, each CPU uses its softlockup hrtimer
1073-
to check that the next CPU is processing hrtimer interrupts by
1074-
verifying that a counter is increasing.
1075-
1076-
This hardlockup detector is useful on systems that don't have
1077-
an arch-specific hardlockup detector or if resources needed
1078-
for the hardlockup detector are better used for other things.
1079-
10801100
# This will select the appropriate non-arch hardlockdup detector
10811101
config HARDLOCKUP_DETECTOR_NON_ARCH
10821102
bool
@@ -1091,26 +1111,6 @@ config HARDLOCKUP_DETECTOR_NON_ARCH
10911111
config HARDLOCKUP_CHECK_TIMESTAMP
10921112
bool
10931113

1094-
#
1095-
# arch/ can define HAVE_HARDLOCKUP_DETECTOR_ARCH to provide their own hard
1096-
# lockup detector rather than the perf based detector.
1097-
#
1098-
config HARDLOCKUP_DETECTOR
1099-
bool "Detect Hard Lockups"
1100-
depends on DEBUG_KERNEL && !S390
1101-
depends on HAVE_HARDLOCKUP_DETECTOR_NON_ARCH || HAVE_HARDLOCKUP_DETECTOR_ARCH
1102-
select LOCKUP_DETECTOR
1103-
select HARDLOCKUP_DETECTOR_NON_ARCH if HAVE_HARDLOCKUP_DETECTOR_NON_ARCH
1104-
1105-
help
1106-
Say Y here to enable the kernel to act as a watchdog to detect
1107-
hard lockups.
1108-
1109-
Hardlockups are bugs that cause the CPU to loop in kernel mode
1110-
for more than 10 seconds, without letting other interrupts have a
1111-
chance to run. The current stack trace is displayed upon detection
1112-
and the system will stay locked up.
1113-
11141114
config BOOTPARAM_HARDLOCKUP_PANIC
11151115
bool "Panic (Reboot) On Hard Lockups"
11161116
depends on HARDLOCKUP_DETECTOR

0 commit comments

Comments
 (0)