Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Namhyung Kim" <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 1/2] perf stat: Fix duplicate output with --for-each-cgroup
Date: Wed, 08 Jul 2026 23:42:45 +0000	[thread overview]
Message-ID: <20260708234245.C66011F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708233103.1359713-1-namhyung@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete state cloning in `evsel__clone()` breaks TPEBS latency fallback metrics and BPF counters for duplicated events.
--

--- Patch [1]: [PATCH v1 1/2] perf stat: Fix duplicate output with --for-each-cgroup ---
commit 10359224b851cd21a00edee0e074af745faf63be
Author: Namhyung Kim <namhyung@kernel.org>

perf stat: Fix duplicate output with --for-each-cgroup

This commit fixes duplicate event output in perf stat when using the
--for-each-cgroup option. It addresses the issue by copying several
fields that were previously missed during evsel__clone().

> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index ea9fa04429f08..ee0b5b4c536c8 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -610,12 +610,18 @@ struct evsel *evsel__clone(struct evsel *dest, struct evsel *orig)
>  	evsel->percore = orig->percore;
>  	evsel->precise_max = orig->precise_max;
>  	evsel->is_libpfm_event = orig->is_libpfm_event;
> +	evsel->skippable = orig->skippable;
> +	evsel->retire_lat = orig->retire_lat;

[Severity: Medium]
When copying the retire_lat flag, do we also need to copy the associated
retirement_latency struct and the bpf_counter flag to avoid a regression?

Without copying the retirement_latency struct (mean, min, max), a cloned
event falling back to TPEBS might use a zeroed struct and incorrectly
calculate 0.0 latency instead of using the parsed values. 

Similarly, omitting the bpf_counter flag might cause cloned BPF events
to silently bypass BPF counting.

> +	evsel->dont_regroup = orig->dont_regroup;
>  
>  	evsel->exclude_GH = orig->exclude_GH;
>  	evsel->sample_read = orig->sample_read;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708233103.1359713-1-namhyung@kernel.org?part=1

      parent reply	other threads:[~2026-07-08 23:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 23:31 [PATCH v1 1/2] perf stat: Fix duplicate output with --for-each-cgroup Namhyung Kim
2026-07-08 23:31 ` [PATCH v1 2/2] perf evsel: Arrange some fields that should be cloned Namhyung Kim
2026-07-08 23:42 ` sashiko-bot [this message]

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=20260708234245.C66011F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox