]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
watchdog/hardlockup/perf: Warn if watchdog_ev is leaked
authorLi Huafei <lihuafei1@huawei.com>
Mon, 21 Oct 2024 19:30:04 +0000 (03:30 +0800)
committerIngo Molnar <mingo@kernel.org>
Thu, 6 Mar 2025 11:07:39 +0000 (12:07 +0100)
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 <lihuafei1@huawei.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241021193004.308303-2-lihuafei1@huawei.com
kernel/watchdog_perf.c

index 2fdb96eaf49336e7a33a927d2f838c88da8b66cb..a78ff092d63603bfc5c7b5a1e27712302b9f7287 100644 (file)
@@ -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;
 }