[PATCH v4 -next 2/2] watchdog/hardlockup/perf: Warn if watchdog_ev is overwritten

From: Li Huafei
Date: Fri Sep 13 2024 - 05:39:39 EST


When we create a new perf_event, it should not happen that the old
perf_event is not released. If it does, make a warning to sense the
problem in time.

Signed-off-by: Li Huafei <lihuafei1@xxxxxxxxxx>
---
kernel/watchdog_perf.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/watchdog_perf.c b/kernel/watchdog_perf.c
index 2fdb96eaf493..09236586b8c3 100644
--- a/kernel/watchdog_perf.c
+++ b/kernel/watchdog_perf.c
@@ -144,6 +144,7 @@ static int hardlockup_detector_event_create(void)
PTR_ERR(evt));
return PTR_ERR(evt);
}
+ WARN_ON(this_cpu_read(watchdog_ev));
this_cpu_write(watchdog_ev, evt);
return 0;
}
--
2.25.1