Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 2/4] perf tool_pmu: Add network events
Date: Fri, 13 Nov 2026 23:59:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-213890@kernel.org> (raw)
In-Reply-To: <20261113233739.3626499-3-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] perf tool_pmu: grouped tool events stay disabled when
  enable_on_exec is set
--

commit 8a5f1d91c8102e028647607058772cadeb3a4c93
Author: Ian Rogers <irogers@google.com>

perf tool_pmu: Add network events

This commit adds system-wide network tool PMU events read from /proc/net/dev
and updates tool PMU enable, disable, and group leader handling.

> diff --git a/tools/perf/util/tool_pmu.c b/tools/perf/util/tool_pmu.c
> index 0ae08cd910bc4..655b221043201 100644
> --- a/tools/perf/util/tool_pmu.c
> +++ b/tools/perf/util/tool_pmu.c
[ ... ]
> @@ -539,40 +676,58 @@ static int open_memory_pid_dir(enum tool_pmu_event ev, int pid,
>  	return 0;
>  }
>  
> +static bool tool_pmu__is_initially_disabled(const struct evsel *evsel)
> +{
> +	const struct evsel *leader = evsel__leader(evsel);
> +
> +	return evsel->core.attr.disabled || (leader && leader->core.attr.disabled);
> +}
> +
>  static int evsel__tool_pmu_open_one(struct evsel *evsel, enum tool_pmu_event ev,
>  				    int pid, int idx, int thread,
>  				    int *seen_tgids, int *nr_seen_tgids)
>  {
[ ... ]
> -		if (evsel->core.attr.disabled) {
> +		if (tool_pmu__is_initially_disabled(evsel)) {
>  			evsel->disabled = true;
>  			*start_time = INVALID_START_TIME;
>  		} else {

[Severity: Medium]
Does tool_pmu__is_initially_disabled() leave grouped tool events permanently
disabled when profiling a forked workload?

When target__enable_on_exec(&target) is true (for example, perf stat -e
'{cycles,duration_time}' -- <workload>), create_perf_stat_counter() sets both
attr->disabled = 1 and attr->enable_on_exec = 1 on the group leader:

tools/perf/builtin-stat.c:create_perf_stat_counter() {
	...
	if (evsel__is_group_leader(evsel)) {
		attr->disabled = 1;

		if (target__enable_on_exec(&target))
			attr->enable_on_exec = 1;
	}
	...
}

With this change, tool_pmu__is_initially_disabled() returns true for the
grouped tool event, so evsel__tool_pmu_open() and evsel__tool_pmu_open_one()
set evsel->disabled = true and start_time = INVALID_START_TIME. Because
enable_counters() skips evlist__enable() when target__enable_on_exec(&target)
is true and userspace tool events have no kernel exec hook, evsel->disabled
remains true for the entire run and perf stat reports 0 for the grouped tool
counter.

Checking !leader->core.attr.enable_on_exec (and !evsel->core.attr.enable_on_exec)
in tool_pmu__is_initially_disabled() would avoid leaving these counters
disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113233739.3626499-1-irogers@google.com?part=2

  reply	other threads:[~2026-11-13 23:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 23:37 [PATCH v2 0/4] perf tool_pmu: Add procfs memory, network and schedstat events Ian Rogers
2026-11-13 23:37 ` [PATCH v2 1/4] perf tool_pmu: Add memory events Ian Rogers
2026-11-14  0:05   ` sashiko-bot
2026-11-13 23:37 ` [PATCH v2 2/4] perf tool_pmu: Add network events Ian Rogers
2026-11-13 23:59   ` sashiko-bot [this message]
2026-11-13 23:37 ` [PATCH v2 3/4] perf tool_pmu: Add schedstat events Ian Rogers
2026-11-13 23:51   ` sashiko-bot
2026-11-13 23:37 ` [PATCH v2 4/4] perf test tool_pmu: Add memory, network and schedstat tests Ian Rogers
2026-11-13 23:45   ` sashiko-bot

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=sashiko-outbox-213890@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.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