Skip to contentSkip to conversation

watchdog-hardlockup-add-a-cpu-param-to-watchdog_hardlockup_check.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Jun 10, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: watchdog/hardlockup: add a "cpu" param to watchdog_hardlockup_check()
has been removed from the -mm tree. Its filename was
watchdog-hardlockup-add-a-cpu-param-to-watchdog_hardlockup_check.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Douglas Anderson <[email protected]>
Subject: watchdog/hardlockup: add a "cpu" param to watchdog_hardlockup_check()
Date: Fri, 19 May 2023 10:18:34 -0700

In preparation for the buddy hardlockup detector where the CPU checking for lockup might not be the currently running CPU, add a "cpu" parameter to watchdog_hardlockup_check().

As part of this change, make hrtimer_interrupts an atomic_t since now the CPU incrementing the value and the CPU reading the value might be different. Technially this could also be done with just READ_ONCE and WRITE_ONCE, but atomic_t feels a little cleaner in this case.

While hrtimer_interrupts is made atomic_t, we change hrtimer_interrupts_saved from "unsigned long" to "int". The "int" is needed to match the data type backing atomic_t for hrtimer_interrupts. Even if this changes us from 64-bits to 32-bits (which I don't think is true for most compilers), it doesn't really matter. All we ever do is increment it every few seconds and compare it to an old value so 32-bits is fine (even 16-bits would be). The "signed" vs "unsigned" also doesn't matter for simple equality comparisons.

hrtimer_interrupts_saved is _not_ switched to atomic_t nor even accessed with READ_ONCE / WRITE_ONCE. The hrtimer_interrupts_saved is always consistently accessed with the same CPU. NOTE: with the upcoming "buddy" detector there is one special case. When a CPU goes offline/online then we can change which CPU is the one to consistently access a given instance of hrtimer_interrupts_saved. We still can't end up with a partially updated hrtimer_interrupts_saved, however, because we end up petting all affected CPUs to make sure the new and old CPU can't end up somehow read/write hrtimer_interrupts_saved at the same time.

Cc Andi Kleen <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Christophe Leroy <[email protected]>
Cc Colin Cross <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Lecopzer Chen <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Masayoshi Mizuma <[email protected]>
Cc Matthias Kaehlcke <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Petr Mladek <[email protected]>
Cc Pingfan Liu <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc "Ravi V. Shankar" <[email protected]>
Cc Ricardo Neri <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Sumit Garg <[email protected]>
Cc Tzung-Bi Shih <[email protected]>
Cc Will Deacon <[email protected]>

---

 include/linux/nmi.h    |    2 -
 kernel/watchdog.c      |   52 ++++++++++++++++++++++++---------------
 kernel/watchdog_perf.c |    2 -
 3 files changed, 34 insertions(+), 22 deletions(-)
include/linux/nmi.h renamed from include/linux/nmi.h~watchdog-hardlockup-add-a-cpu-param-to-watchdog_hardlockup_check +1 -1
@@ -88,7 +88,7 @@ static inline void hardlockup_detector_d
 #endif
 
 #if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
-void watchdog_hardlockup_check(struct pt_regs *regs);
+void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs);
 #endif
 
 #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
kernel/watchdog.c renamed from kernel/watchdog.c~watchdog-hardlockup-add-a-cpu-param-to-watchdog_hardlockup_check +32 -20

96 lines not on this page · raw message

kernel/watchdog_perf.c renamed from kernel/watchdog_perf.c~watchdog-hardlockup-add-a-cpu-param-to-watchdog_hardlockup_check +1 -1
@@ -120,7 +120,7 @@ static void watchdog_overflow_callback(s
 		return;
 	}
 
-	watchdog_hardlockup_check(regs);
+	watchdog_hardlockup_check(smp_processor_id(), regs);
 }
 
 static int hardlockup_detector_event_create(void)

_

Patches currently in -mm which might be from [email protected] are

watchdog-hardlockup-move-perf-hardlockup-watchdog-petting-to-watchdogc.patch watchdog-hardlockup-rename-some-nmi-watchdog-constants-function.patch watchdog-hardlockup-have-the-perf-hardlockup-use-__weak-functions-more-cleanly.patch watchdog-hardlockup-detect-hard-lockups-using-secondary-buddy-cpus.patch watchdog-perf-add-a-weak-function-for-an-arch-to-detect-if-perf-can-use-nmis.patch arm64-enable-perf-events-based-hard-lockup-detector.patch