All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Chun-Tse Shao <ctshao@google.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	James Clark <james.clark@linaro.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf stat: Fix aggregation of cgroup events
Date: Wed, 14 Oct 2026 11:14:06 -0700	[thread overview]
Message-ID: <as_GbmeRJ3MtwaVD@google.com> (raw)
In-Reply-To: <CAJpZYjXK2qhkCn_ixge_1vEKjXzn_4tzPT=i9NqYg6HbYdWG6Q@mail.gmail.com>

On Fri, Oct 02, 2026 at 10:13:29AM -0700, Chun-Tse Shao wrote:
> On Thu, Oct 1, 2026 at 10:48 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > I got a report that perf stat with BPF and cgroup is broken with
> > aggregation like per-socket or node.  On my machine, running the
> > following command shows the problem.
> >
> >   $ sudo perf stat -a --bpf-counters --per-socket -e cycles \
> >     --for-each-cgroup /user.slice,/system.slice  sleep 1
> >
> >    Performance counter stats for 'system wide':
> >
> >   S0       12      <not counted>      cpu_atom/cycles/                 user.slice
> >   S0       16      <not counted>      cpu_core/cycles/                 user.slice
> >   S0       12      <not counted>      cpu_atom/cycles/                 system.slice
> >   S0       16      <not counted>      cpu_core/cycles/                 system.slice
> >
> >          1.002798147 seconds time elapsed
> >
> > That's because there's a logic to make the whole event failed if result
> > from any CPU looks bad when aggregation is enabled.  Normally it
> > considers bad when an event has no enabled and running time.  But it's
> > possible for a cgroup event to have no chance to run on some CPU during
> > the window and then it will have 0 enabled and running time.  Let's not
> > treat them as errors.
> >
> > After the fix, the same command produces:
> >
> >    Performance counter stats for 'system wide':
> >
> >   S0       12          5,094,112      cpu_atom/cycles/                 user.slice
> >   S0       16         28,075,944      cpu_core/cycles/                 user.slice
> >   S0       12          1,516,568      cpu_atom/cycles/                 system.slice
> >   S0       16          5,569,575      cpu_core/cycles/                 system.slice
> >
> >          1.003231856 seconds time elapsed
> >
> > Reported-by: Chun-Tse Shao <ctshao@google.com>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> Tested-by: Chun-Tse Shao <ctshao@google.com>

Thanks for the test!

Arnaldo, can you please take this?

Thanks,
Namhyung


      reply	other threads:[~2026-10-14 18:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  5:48 [PATCH] perf stat: Fix aggregation of cgroup events Namhyung Kim
2026-10-02  9:14 ` sashiko-bot
2026-10-02 17:13 ` Chun-Tse Shao
2026-10-14 18:14   ` Namhyung Kim [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=as_GbmeRJ3MtwaVD@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ctshao@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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.