[PATCH] tracing/hwlat: Store the maximum latency in nanoseconds

From: Wenwu Hou

Date: Tue Nov 10 2026 - 22:13:56 EST


tr->max_latency is expected to hold nanoseconds: tracing_max_lat_read()
converts it with nsecs_to_usecs() to print the usecs documented in
hwlat_detector.rst, and the other latency tracers store nanoseconds there
too.

Fixes: e7c15cd8a1133 ("tracing: Added hardware latency tracer")
Signed-off-by: Wenwu Hou <hwenwur@xxxxxxxxx>
---
kernel/trace/trace_hwlat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index 65e184d800ff1..701b6a542e51a 100644
--- a/kernel/trace/trace_hwlat.c
+++ b/kernel/trace/trace_hwlat.c
@@ -293,7 +293,7 @@ static int get_sample(void)
s.count = count;
trace_hwlat_sample(&s);

- latency = max(sample, outer_sample);
+ latency = max(sample, outer_sample) * NSEC_PER_USEC;

/* Keep a running maximum ever recorded hardware latency */
if (latency > tr->max_latency) {
--
2.43.0