From: Xiongfeng Wang <wangxiongfeng2(a)huawei.com>
commit 07789defcdf8b42ded9c39ad78f65c2a91830315 openEuler-1.0.
When we modify '/proc/sys/kernel/watchdog_thresh', kernel will call
'watchdog_nmi_disable' before change 'watchdog_thresh'. If firmware does
not support SDEI, we will get 'SDEI NMI Watchdog: Disable NMI Watchdog
failed on cpuX'. It is because we failed to disable sdei_watchdog event.
It has no bad effect.
This patch add a flag to record whether we have registered sdei_watchdog
successfully and do not disable sdei_watchdog event if we failed to
register sdei_watchdog event.
Signed-off-by: Xiongfeng Wang <wangxiongfeng2(a)huawei.com>
Reviewed-by: Hanjun Guo <guohanjun(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Xin Hao <haoxing990(a)gmail.com>
---
arch/arm64/kernel/watchdog_sdei.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/watchdog_sdei.c b/arch/arm64/kernel/watchdog_sdei.c
index 4fd1419729c2..e36c4d398893 100644
--- a/arch/arm64/kernel/watchdog_sdei.c
+++ b/arch/arm64/kernel/watchdog_sdei.c
@@ -21,11 +21,15 @@
static int sdei_watchdog_event_num;
static bool disable_sdei_nmi_watchdog;
+static bool sdei_watchdog_registered;
int watchdog_nmi_enable(unsigned int cpu)
{
int ret;
+ if (!sdei_watchdog_registered)
+ return -EINVAL;
+
refresh_hld_last_timestamp();
ret = sdei_api_event_enable(sdei_watchdog_event_num);
@@ -42,6 +46,9 @@ void watchdog_nmi_disable(unsigned int cpu)
{
int ret;
+ if (!sdei_watchdog_registered)
+ return;
+
ret = sdei_api_event_disable(sdei_watchdog_event_num);
if (ret)
pr_err("Disable NMI Watchdog failed on cpu%d\n",
@@ -87,7 +94,7 @@ int __init watchdog_nmi_probe(void)
sdei_watchdog_event_num = sdei_api_event_interrupt_bind(SDEI_NMI_WATCHDOG_HWIRQ);
if (sdei_watchdog_event_num < 0) {
- pr_err("bind interrupt failed !\n");
+ pr_err("Bind interrupt failed. Firmware may not support SDEI !\n");
return sdei_watchdog_event_num;
}
@@ -100,6 +107,7 @@ int __init watchdog_nmi_probe(void)
return ret;
}
+ sdei_watchdog_registered = true;
pr_info("SDEI Watchdog registered successfully\n");
return 0;
--
2.31.0