From: Li Huafei Date: Mon, 21 Oct 2024 19:30:04 +0000 (+0800) Subject: watchdog/hardlockup/perf: Warn if watchdog_ev is leaked X-Git-Tag: v6.15-rc1~217^2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05763885e327f0e257ee8b96b30ac1b95f7dd532;p=thirdparty%2Fkernel%2Flinux.git watchdog/hardlockup/perf: Warn if watchdog_ev is leaked When creating a new perf_event for the hardlockup watchdog, it should not happen that the old perf_event is not released. Introduce a WARN_ONCE() that should never trigger. [ mingo: Changed the type of the warning to WARN_ONCE(). ] Signed-off-by: Li Huafei Signed-off-by: Ingo Molnar Cc: Thomas Gleixner Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20241021193004.308303-2-lihuafei1@huawei.com --- diff --git a/kernel/watchdog_perf.c b/kernel/watchdog_perf.c index 2fdb96eaf4933..a78ff092d6360 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_ONCE(this_cpu_read(watchdog_ev), "unexpected watchdog_ev leak"); this_cpu_write(watchdog_ev, evt); return 0; }