All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tomas Glozar" <tglozar@redhat.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] rtla: Discard trace entries with cpu >= nr_cpus
Date: Fri, 14 Aug 2026 14:02:58 +0000	[thread overview]
Message-ID: <20260814140258.7A6C81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814135511.2207190-3-tglozar@redhat.com>

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 <tglozar@redhat.com>

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.

> 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

  reply	other threads:[~2026-08-14 14:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 13:55 [PATCH 0/5] rtla: Implement more robust nr_cpus handling Tomas Glozar
2026-08-14 13:55 ` [PATCH 1/5] rtla: Replace get_nprocs_conf() with sysfs possible cpus Tomas Glozar
2026-08-14 13:55 ` [PATCH 2/5] rtla: Discard trace entries with cpu >= nr_cpus Tomas Glozar
2026-08-14 14:02   ` sashiko-bot [this message]
2026-08-14 13:55 ` [PATCH 3/5] rtla: Abort on nr_cpus mismatch with tracer Tomas Glozar
2026-08-14 13:55 ` [PATCH 4/5] rtla/tests: Add unit test for cpu_list_iterate() Tomas Glozar
2026-08-14 13:55 ` [PATCH 5/5] rtla/tests: Add unit test for get_max_cpu_from_list() Tomas Glozar
2026-08-14 14:30 ` [PATCH 0/5] rtla: Implement more robust nr_cpus handling Steven Rostedt
2026-08-14 17:49   ` Tomas Glozar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260814140258.7A6C81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tglozar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.