Re: [PATCH 2/5] rtla: Discard trace entries with cpu >= nr_cpus
From: sashiko-bot@kernel.org
Date: 2026-08-14 14:02:58
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The printf format strings incorrectly use `%lld` to print `unsigned long long` variables. --
--- Patch [2]: [PATCH 2/5] rtla: Discard trace entries with cpu >= nr_cpus ---commit 2e2ceb9161355aea34f26cdf4de0da20e2aa2e3d Author: Tomas Glozar [off-list ref] rtla: Discard trace entries with cpu >= nr_cpus This commit adds a bounds check to rtla to discard trace entries when the CPU index exceeds the known number of CPUs. It introduces an invalid_events counter and updates the tool's output to report when such events occur.
quoted hunk ↗ jump to hunk
diff --git a/tools/tracing/rtla/src/osnoise.c b/tools/tracing/rtla/src/osnoise.c index 4ff5dad013b10..b9bcbf9ee430c 100644 --- a/tools/tracing/rtla/src/osnoise.c +++ b/tools/tracing/rtla/src/osnoise.c
[ ... ]
+void
+osnoise_report_invalid_events(struct osnoise_tool *tool)
+{
+ unsigned long long total_events;
+
+ if (tool->trace.invalid_events > 0) {
+ if (tool->trace.missed_events != UINT64_MAX) {
+ total_events = tool->trace.processed_events + tool->trace.invalid_events +
+ tool->trace.missed_events;
+
+ printf("%lld (%.2f%%) invalid events, results might not be accurate\n",
+ tool->trace.invalid_events,
+ (double) tool->trace.invalid_events / total_events * 100.0);[Severity: Low] Since invalid_events is declared as an unsigned long long in struct trace_instance, should this printf format string use %llu instead of %lld? If the value were to somehow exceed LLONG_MAX, it would print as a negative number.
+ } else {
+ printf("%lld invalid events, results might not be accurate\n",
+ tool->trace.invalid_events);[Severity: Low] Does this format string also need to be updated to %llu to match the unsigned long long type of invalid_events?
+ } + } +}
-- Sashiko AI review · https://sashiko.dev/#/patchset/20260814135511.2207190-1-tglozar@redhat.com?part=2