The patch titled Subject: watchdog/hardlockup: style changes to watchdog_hardlockup_check() / is_hardlockup() has been added to the -mm mm-nonmm-unstable branch. Its filename is watchdog-hardlockup-style-changes-to-watchdog_hardlockup_check-is_hardlockup.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/watchdog-hardlockup-style-changes-to-watchdog_hardlockup_check-is_hardlockup.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Douglas Anderson <dianders@xxxxxxxxxxxx> Subject: watchdog/hardlockup: style changes to watchdog_hardlockup_check() / is_hardlockup() Date: Fri, 19 May 2023 10:18:33 -0700 These are tiny style changes: - Add a blank line before a "return". - Renames two globals to use the "watchdog_hardlockup" prefix. - Store processor id in "unsigned int" rather than "int". - Minor comment rewording. - Use "else" rather than extra returns since it seemed more symmetric. Link: https://lkml.kernel.org/r/20230519101840.v5.9.I818492c326b632560b09f20d2608455ecf9d3650@changeid Reviewed-by: Petr Mladek <pmladek@xxxxxxxx> Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Chen-Yu Tsai <wens@xxxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: Colin Cross <ccross@xxxxxxxxxxx> Cc: Daniel Thompson <daniel.thompson@xxxxxxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Guenter Roeck <groeck@xxxxxxxxxxxx> Cc: Ian Rogers <irogers@xxxxxxxxxx> Cc: Lecopzer Chen <lecopzer.chen@xxxxxxxxxxxx> Cc: Marc Zyngier <maz@xxxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Masayoshi Mizuma <msys.mizuma@xxxxxxxxx> Cc: Matthias Kaehlcke <mka@xxxxxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Nicholas Piggin <npiggin@xxxxxxxxx> Cc: Pingfan Liu <kernelfans@xxxxxxxxx> Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> Cc: "Ravi V. Shankar" <ravi.v.shankar@xxxxxxxxx> Cc: Ricardo Neri <ricardo.neri@xxxxxxxxx> Cc: Stephane Eranian <eranian@xxxxxxxxxx> Cc: Stephen Boyd <swboyd@xxxxxxxxxxxx> Cc: Sumit Garg <sumit.garg@xxxxxxxxxx> Cc: Tzung-Bi Shih <tzungbi@xxxxxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/watchdog.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) --- a/kernel/watchdog.c~watchdog-hardlockup-style-changes-to-watchdog_hardlockup_check-is_hardlockup +++ a/kernel/watchdog.c @@ -89,8 +89,8 @@ __setup("nmi_watchdog=", hardlockup_pani static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts); static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved); -static DEFINE_PER_CPU(bool, hard_watchdog_warn); -static unsigned long hardlockup_allcpu_dumped; +static DEFINE_PER_CPU(bool, watchdog_hardlockup_warned); +static unsigned long watchdog_hardlockup_all_cpu_dumped; static bool is_hardlockup(void) { @@ -100,6 +100,7 @@ static bool is_hardlockup(void) return true; __this_cpu_write(hrtimer_interrupts_saved, hrint); + return false; } @@ -110,21 +111,20 @@ static void watchdog_hardlockup_kick(voi void watchdog_hardlockup_check(struct pt_regs *regs) { - /* check for a hardlockup - * This is done by making sure our timer interrupt - * is incrementing. The timer interrupt should have - * fired multiple times before we overflow'd. If it hasn't + /* + * Check for a hardlockup by making sure the CPU's timer + * interrupt is incrementing. The timer interrupt should have + * fired multiple times before we overflow'd. If it hasn't * then this is a good indication the cpu is stuck */ if (is_hardlockup()) { - int this_cpu = smp_processor_id(); + unsigned int this_cpu = smp_processor_id(); - /* only print hardlockups once */ - if (__this_cpu_read(hard_watchdog_warn) == true) + /* Only print hardlockups once. */ + if (__this_cpu_read(watchdog_hardlockup_warned)) return; - pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", - this_cpu); + pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", this_cpu); print_modules(); print_irqtrace_events(current); if (regs) @@ -137,18 +137,16 @@ void watchdog_hardlockup_check(struct pt * generating interleaving traces */ if (sysctl_hardlockup_all_cpu_backtrace && - !test_and_set_bit(0, &hardlockup_allcpu_dumped)) + !test_and_set_bit(0, &watchdog_hardlockup_all_cpu_dumped)) trigger_allbutself_cpu_backtrace(); if (hardlockup_panic) nmi_panic(regs, "Hard LOCKUP"); - __this_cpu_write(hard_watchdog_warn, true); - return; + __this_cpu_write(watchdog_hardlockup_warned, true); + } else { + __this_cpu_write(watchdog_hardlockup_warned, false); } - - __this_cpu_write(hard_watchdog_warn, false); - return; } #else /* CONFIG_HARDLOCKUP_DETECTOR_PERF */ _ Patches currently in -mm which might be from dianders@xxxxxxxxxxxx are migrate_pages-avoid-blocking-for-io-in-migrate_sync_light.patch watchdog-perf-define-dummy-watchdog_update_hrtimer_threshold-on-correct-config.patch watchdog-perf-more-properly-prevent-false-positives-with-turbo-modes.patch watchdog-hardlockup-add-comments-to-touch_nmi_watchdog.patch watchdog-perf-rename-watchdog_hldc-to-watchdog_perfc.patch watchdog-hardlockup-move-perf-hardlockup-checking-panic-to-common-watchdogc.patch watchdog-hardlockup-style-changes-to-watchdog_hardlockup_check-is_hardlockup.patch watchdog-hardlockup-add-a-cpu-param-to-watchdog_hardlockup_check.patch 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