mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] watchdog/hardlockup: reassign last_timestamp when enable nmi event
@ 2019-10-12 10:23 Li RongQing
  2019-10-13 20:34 ` kbuild test robot
  2019-10-13 22:33 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Li RongQing @ 2019-10-12 10:23 UTC (permalink / raw)
  To: akpm, sergey.senozhatsky.work, linux-kernel, tglx

last_timestamp is not initialized and is zero after boot, or stop
to forward when nmi watchdog is disabled; and false positives still
is possible when restart NMI timer after stopping 120 seconds

so reassign last_timestamp always when enable nmi event

Fixes: 7edaeb6841df ("kernel/watchdog: Prevent false positives with turbo modes")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 kernel/watchdog_hld.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 247bf0b1582c..fc3a5c7ccd82 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -189,6 +189,8 @@ static int hardlockup_detector_event_create(void)
  */
 void hardlockup_detector_perf_enable(void)
 {
+	ktime_t now = ktime_get_mono_fast_ns();
+
 	if (hardlockup_detector_event_create())
 		return;
 
@@ -196,6 +198,7 @@ void hardlockup_detector_perf_enable(void)
 	if (!atomic_fetch_inc(&watchdog_cpus))
 		pr_info("Enabled. Permanently consumes one hw-PMU counter.\n");
 
+	this_cpu_write(last_timestamp, now);
 	perf_event_enable(this_cpu_read(watchdog_ev));
 }
 
@@ -274,8 +277,12 @@ void __init hardlockup_detector_perf_restart(void)
 	for_each_online_cpu(cpu) {
 		struct perf_event *event = per_cpu(watchdog_ev, cpu);
 
-		if (event)
+		if (event) {
+			ktime_t now = ktime_get_mono_fast_ns();
+
+			per_cpu(last_timestamp, cpu) = now;
 			perf_event_enable(event);
+		}
 	}
 }
 
-- 
2.16.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-13 22:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-12 10:23 [PATCH] watchdog/hardlockup: reassign last_timestamp when enable nmi event Li RongQing
2019-10-13 20:34 ` kbuild test robot
2019-10-13 22:33 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®