All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Ben Gainey <ben.gainey@arm.com>,
	James Clark <james.clark@linaro.org>,
	Howard Chu <howardchu95@gmail.com>,
	Weilin Wang <weilin.wang@intel.com>,
	Levi Yun <yeoreum.yun@arm.com>,
	"Dr. David Alan Gilbert" <linux@treblig.org>,
	Zhongqiu Han <quic_zhonhan@quicinc.com>,
	Blake Jones <blakejones@google.com>,
	Yicong Yang <yangyicong@hisilicon.com>,
	Anubhav Shelat <ashelat@redhat.com>,
	Thomas Richter <tmricht@linux.ibm.com>,
	Jean-Philippe Romain <jean-philippe.romain@foss.st.com>,
	Song Liu <song@kernel.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 04/12] perf parse-events: Allow the cpu term to be a PMU
Date: Fri, 18 Jul 2025 10:56:12 -0700	[thread overview]
Message-ID: <aHqKvOfY2QQOEcjB@google.com> (raw)
In-Reply-To: <CAP-5=fVt4Nu3ZtKD+DWn9iT1XRzbbzvE3WXaO51V+8UGCE56cg@mail.gmail.com>

Hi Ian,

On Wed, Jul 16, 2025 at 01:25:17PM -0700, Ian Rogers wrote:
> On Wed, Jul 16, 2025 at 1:09 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Fri, Jun 27, 2025 at 12:24:09PM -0700, Ian Rogers wrote:
> > > On hybrid systems, events like msr/tsc/ will aggregate counts across
> > > all CPUs. Often metrics only want a value like msr/tsc/ for the cores
> > > on which the metric is being computed. Listing each CPU with terms
> > > cpu=0,cpu=1.. is laborious and would need to be encoded for all
> > > variations of a CPU model.
> > >
> > > Allow the cpumask from a PMU to be an argument to the cpu term. For
> > > example in the following the cpumask of the cstate_pkg PMU selects the
> > > CPUs to count msr/tsc/ counter upon:
> > > ```
> > > $ cat /sys/bus/event_source/devices/cstate_pkg/cpumask
> > > 0
> > > $ perf stat -A -e 'msr/tsc,cpu=cstate_pkg/' -a sleep 0.1
> >
> > It can be confusing if 'cpu' takes a number or a PMU name.  What about
> > adding a new term (maybe 'cpu_from') to handle this case?
> 
> So it is possible for terms to be defined in sysfs in the 'format/' folder:
> ```
> $ ls /sys/bus/event_source/devices/cpu_core/format/
> cmask  edge  event  frontend  inv  ldlat  offcore_rsp  pc  umask
> ```
> By not introducing a new term we leave 'cpu_from' open for use in this
> way. When I spoke to Kan we thought using the existing term made sense
> and fits the idea of leaving things open for the kernel/drivers to
> use. It is possible to add a new term though. Let me know and I can
> update the patch and documentation accordingly.

Oh, you thought about this already.  It's true that it's possible to
clash with PMU formats in sysfs unless we have a separate namespace for
tools somehow.  But that would add (maybe unnecessary) complexity.

So I'm not against with this change.  I just wanted to ring an alarm for
potential issues.  Up to you. :)

Thanks,
Namhyung

  reply	other threads:[~2025-07-18 17:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 19:24 [PATCH v1 00/12] CPU mask improvements/fixes particularly for hybrid Ian Rogers
2025-06-27 19:24 ` [PATCH v1 01/12] perf parse-events: Warn if a cpu term is unsupported by a CPU Ian Rogers
2025-06-27 19:24 ` [PATCH v1 02/12] perf stat: Avoid buffer overflow to the aggregation map Ian Rogers
2025-06-27 19:24 ` [PATCH v1 03/12] perf stat: Don't size aggregation ids from user_requested_cpus Ian Rogers
2025-06-27 19:24 ` [PATCH v1 04/12] perf parse-events: Allow the cpu term to be a PMU Ian Rogers
2025-07-16 20:09   ` Namhyung Kim
2025-07-16 20:25     ` Ian Rogers
2025-07-18 17:56       ` Namhyung Kim [this message]
2025-06-27 19:24 ` [PATCH v1 05/12] perf tool_pmu: Allow num_cpus(_online) to be specific to a cpumask Ian Rogers
2025-06-27 19:24 ` [PATCH v1 06/12] libperf evsel: Rename own_cpus to pmu_cpus Ian Rogers
2025-06-27 19:24 ` [PATCH v1 07/12] libperf evsel: Factor perf_evsel__exit out of perf_evsel__delete Ian Rogers
2025-06-27 19:24 ` [PATCH v1 08/12] perf evsel: Use libperf perf_evsel__exit Ian Rogers
2025-06-27 19:24 ` [PATCH v1 09/12] perf pmus: Factor perf_pmus__find_by_attr out of evsel__find_pmu Ian Rogers
2025-06-27 19:24 ` [PATCH v1 10/12] perf parse-events: Minor __add_event refactoring Ian Rogers
2025-06-27 19:24 ` [PATCH v1 11/12] perf evsel: Add evsel__open_per_cpu_and_thread Ian Rogers
2025-06-27 19:24 ` [PATCH v1 12/12] perf parse-events: Support user CPUs mixed with threads/processes Ian Rogers
2025-07-16 20:28   ` Namhyung Kim
2025-07-17  0:04     ` Ian Rogers
2025-07-15 19:55 ` [PATCH v1 00/12] CPU mask improvements/fixes particularly for hybrid Ian Rogers
2025-07-16 20:03   ` Falcon, Thomas
2025-07-21 16:13 ` James Clark
2025-07-21 17:44   ` Ian Rogers

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=aHqKvOfY2QQOEcjB@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ashelat@redhat.com \
    --cc=ben.gainey@arm.com \
    --cc=blakejones@google.com \
    --cc=howardchu95@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jean-philippe.romain@foss.st.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=quic_zhonhan@quicinc.com \
    --cc=song@kernel.org \
    --cc=thomas.falcon@intel.com \
    --cc=tmricht@linux.ibm.com \
    --cc=weilin.wang@intel.com \
    --cc=yangyicong@hisilicon.com \
    --cc=yeoreum.yun@arm.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.