]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rtla/timerlat: Fix histogram ALL for zero samples
authorTomas Glozar <tglozar@redhat.com>
Wed, 27 Nov 2024 13:41:30 +0000 (14:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Jan 2025 09:34:22 +0000 (10:34 +0100)
commit4c0f79cbc42d48a00acc4d77586b38250a3d3178
treee9a41b2ad0df7b2002bface94bbf7166fbbf66e9
parent1cca920af19df5dd91254e5ff35e68e911683706
rtla/timerlat: Fix histogram ALL for zero samples

commit 6cc45f8c1f898570916044f606be9890d295e129 upstream.

rtla timerlat hist currently computers the minimum, maximum and average
latency even in cases when there are zero samples. This leads to
nonsensical values being calculated for maximum and minimum, and to
divide by zero for average.

A similar bug is fixed by 01b05fc0e5f3 ("rtla/timerlat: Fix histogram
report when a cpu count is 0") but the bug still remains for printing
the sum over all CPUs in timerlat_print_stats_all.

The issue can be reproduced with this command:

$ rtla timerlat hist -U -d 1s
Index
over:
count:
min:
avg:
max:
Floating point exception (core dumped)

(There are always no samples with -U unless the user workload is
created.)

Fix the bug by omitting max/min/avg when sample count is zero,
displaying a dash instead, just like we already do for the individual
CPUs. The logic is moved into a new function called
format_summary_value, which is used for both the individual CPUs
and for the overall summary.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/20241127134130.51171-1-tglozar@redhat.com
Fixes: 1462501c7a8 ("rtla/timerlat: Add a summary for hist mode")
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/tracing/rtla/src/timerlat_hist.c