Skip to content

Commit 484b2b3

Browse files
committed
powerpc/watchdog: Fix wd_smp_last_reset_tb reporting
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Nicholas Piggin <npiggin@gmail.com> commit 3d030e3 wd_smp_last_reset_tb now gets reset by watchdog_smp_panic() as part of marking CPUs stuck and removing them from the pending mask before it begins any printing. This causes last reset times reported to be off. Fix this by reading it into a local variable before it gets reset. Fixes: 76521c4 ("powerpc/watchdog: Avoid holding wd_smp_lock over printk and smp_send_nmi_ipi") Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20211125103346.1188958-1-npiggin@gmail.com (cherry picked from commit 3d030e3) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 6ef9e44 commit 484b2b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/powerpc/kernel/watchdog.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,14 @@ static void watchdog_smp_panic(int cpu)
183183
{
184184
static cpumask_t wd_smp_cpus_ipi; // protected by reporting
185185
unsigned long flags;
186-
u64 tb;
186+
u64 tb, last_reset;
187187
int c;
188188

189189
wd_smp_lock(&flags);
190190
/* Double check some things under lock */
191191
tb = get_tb();
192-
if ((s64)(tb - wd_smp_last_reset_tb) < (s64)wd_smp_panic_timeout_tb)
192+
last_reset = wd_smp_last_reset_tb;
193+
if ((s64)(tb - last_reset) < (s64)wd_smp_panic_timeout_tb)
193194
goto out;
194195
if (cpumask_test_cpu(cpu, &wd_smp_cpus_pending))
195196
goto out;
@@ -214,8 +215,7 @@ static void watchdog_smp_panic(int cpu)
214215
pr_emerg("CPU %d detected hard LOCKUP on other CPUs %*pbl\n",
215216
cpu, cpumask_pr_args(&wd_smp_cpus_ipi));
216217
pr_emerg("CPU %d TB:%lld, last SMP heartbeat TB:%lld (%lldms ago)\n",
217-
cpu, tb, wd_smp_last_reset_tb,
218-
tb_to_ns(tb - wd_smp_last_reset_tb) / 1000000);
218+
cpu, tb, last_reset, tb_to_ns(tb - last_reset) / 1000000);
219219

220220
if (!sysctl_hardlockup_all_cpu_backtrace) {
221221
/*

0 commit comments

Comments
 (0)