blob: 120fac9856f70e6effbab04245460e081b4492fe [file] [log] [blame]
From 0e725a96550c1fcf7af39a9e6e9a192ebc5823b9 Mon Sep 17 00:00:00 2001
From: "Srivatsa S. Bhat (VMware)" <>
Date: Thu, 10 Oct 2019 11:50:46 -0700
Subject: [PATCH] tracing/hwlat: Report total time spent in all NMIs during the
commit 98dc19c11470ee6048aba723d77079ad2cda8a52 upstream.
nmi_total_ts is supposed to record the total time spent in *all* NMIs
that occur on the given CPU during the (active portion of the)
sampling window. However, the code seems to be overwriting this
variable for each NMI, thereby only recording the time spent in the
most recent NMI. Fix it by accumulating the duration instead.
Fixes: 7b2c86250122 ("tracing: Add NMI tracing in hwlat detector")
Signed-off-by: Srivatsa S. Bhat (VMware) <>
Signed-off-by: Steven Rostedt (VMware) <>
Signed-off-by: Paul Gortmaker <>
diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index 1e6db9cbe4dc..1e9a404cee2b 100644
--- a/kernel/trace/trace_hwlat.c
+++ b/kernel/trace/trace_hwlat.c
@@ -150,7 +150,7 @@ void trace_hwlat_callback(bool enter)
if (enter)
nmi_ts_start = time_get();
- nmi_total_ts = time_get() - nmi_ts_start;
+ nmi_total_ts += time_get() - nmi_ts_start;
if (enter)