watchdog/hardlockup: move hardlock_notifier before panic

And update the cpu regs when it is soft lock.

Fixes: d851edc401 ("watchdog/hardlockup: add hardlock_notifier_list")
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: Id695ee4e7a80bfde2c15891f19e98af092f74a01
This commit is contained in:
Huibin Hong
2023-09-19 08:18:48 +00:00
committed by Tao Huang
parent 4f54d93469
commit 0fd461243b

View File

@@ -27,6 +27,10 @@
#include <asm/irq_regs.h>
#include <linux/kvm_para.h>
#if IS_ENABLED(CONFIG_ROCKCHIP_MINIDUMP)
#include <soc/rockchip/rk_minidump.h>
#endif
static DEFINE_MUTEX(watchdog_mutex);
#if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG)
@@ -424,12 +428,13 @@ static void watchdog_check_hardlockup_other_cpu(void)
if (per_cpu(hard_watchdog_warn, next_cpu) == true)
return;
atomic_notifier_call_chain(&hardlock_notifier_list, next_cpu, NULL);
if (hardlockup_panic)
panic("Watchdog detected hard LOCKUP on cpu %u", next_cpu);
else
WARN(1, "Watchdog detected hard LOCKUP on cpu %u", next_cpu);
atomic_notifier_call_chain(&hardlock_notifier_list, 0, NULL);
per_cpu(hard_watchdog_warn, next_cpu) = true;
} else {
per_cpu(hard_watchdog_warn, next_cpu) = false;
@@ -557,6 +562,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
}
add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK);
#if IS_ENABLED(CONFIG_ROCKCHIP_MINIDUMP)
rk_minidump_update_cpu_regs(regs);
#endif
if (softlockup_panic)
panic("softlockup: hung tasks");
}