powerpc/watchdog: read TB close to where it is used
authorNicholas Piggin <npiggin@gmail.com>
Wed, 10 Nov 2021 02:50:56 +0000 (12:50 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 25 Nov 2021 00:25:34 +0000 (11:25 +1100)
commit1f01bf90765fa5f88fbae452c131c1edf5cda7ba
tree4ac3efdd608cf7f5e6599f88adc142d1e029e732
parent76521c4b0291ad25723638ade5a0ff4d5f659771
powerpc/watchdog: read TB close to where it is used

When taking watchdog actions, printing messages, comparing and
re-setting wd_smp_last_reset_tb, etc., read TB close to the point of use
and under wd_smp_lock or printing lock (if applicable).

This should keep timebase mostly monotonic with kernel log messages, and
could prevent (in theory) a laggy CPU updating wd_smp_last_reset_tb to
something a long way in the past, and causing other CPUs to appear to be
stuck.

These additional TB reads are all slowpath (lockup has been detected),
so performance does not matter.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211110025056.2084347-5-npiggin@gmail.com
arch/powerpc/kernel/watchdog.c