[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0532c12-e682-a72c-baa0-11b208a639e4@linux.intel.com>
Date: Thu, 27 Apr 2023 16:12:40 -0400
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Ian Rogers <irogers@...gle.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Ahmad Yasin <ahmad.yasin@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Stephane Eranian <eranian@...gle.com>,
Andi Kleen <ak@...ux.intel.com>,
Perry Taylor <perry.taylor@...el.com>,
Samantha Alt <samantha.alt@...el.com>,
Caleb Biggers <caleb.biggers@...el.com>,
Weilin Wang <weilin.wang@...el.com>,
Edward Baker <edward.baker@...el.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Florian Fischer <florian.fischer@...q.space>,
Rob Herring <robh@...nel.org>,
Zhengjun Xing <zhengjun.xing@...ux.intel.com>,
John Garry <john.g.garry@...cle.com>,
Kajol Jain <kjain@...ux.ibm.com>,
Sumanth Korikkar <sumanthk@...ux.ibm.com>,
Thomas Richter <tmricht@...ux.ibm.com>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
Ravi Bangoria <ravi.bangoria@....com>,
Leo Yan <leo.yan@...aro.org>,
Yang Jihong <yangjihong1@...wei.com>,
James Clark <james.clark@....com>,
Suzuki Poulouse <suzuki.poulose@....com>,
Kang Minchul <tegongkang@...il.com>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 17/40] perf evsel: Modify group pmu name for software
events
On 2023-04-26 3:00 a.m., Ian Rogers wrote:
> If we have a group of {cycles,faults} then we need the faults software
> event to appear to be on the same PMU as cycles so that we don't split
> the group in parse_events__sort_events_and_fix_groups. This case is
> relatively easy as cycles is the leader and will have a PMU name. In
> the reverse case, {faults,cycles} we still need faults to appear to
> have the PMU name of cycles but the old behavior is just to return
> "cpu". For hybrid this fails as cycles will be on "cpu_core" or
> "cpu_atom", causing faults to be split into a different group.
>
> Change the behavior for software events so that the whole group is
> searched for the named PMU.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
Reviewed-by: Kan Liang <kan.liang@...ux.intel.com>
Thanks,
Kan
> ---
> tools/perf/util/evsel.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 1cd04b5998d2..63522322e118 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -829,23 +829,26 @@ bool evsel__name_is(struct evsel *evsel, const char *name)
>
> const char *evsel__group_pmu_name(const struct evsel *evsel)
> {
> - const struct evsel *leader;
> + struct evsel *leader, *pos;
>
> /* If the pmu_name is set use it. pmu_name isn't set for CPU and software events. */
> if (evsel->pmu_name)
> return evsel->pmu_name;
> /*
> * Software events may be in a group with other uncore PMU events. Use
> - * the pmu_name of the group leader to avoid breaking the software event
> - * out of the group.
> + * the pmu_name of the first non-software event to avoid breaking the
> + * software event out of the group.
> *
> * Aux event leaders, like intel_pt, expect a group with events from
> * other PMUs, so substitute the AUX event's PMU in this case.
> */
> leader = evsel__leader(evsel);
> - if ((evsel->core.attr.type == PERF_TYPE_SOFTWARE || evsel__is_aux_event(leader)) &&
> - leader->pmu_name) {
> - return leader->pmu_name;
> + if (evsel->core.attr.type == PERF_TYPE_SOFTWARE || evsel__is_aux_event(leader)) {
> + /* Starting with the leader, find the first event with a named PMU. */
> + for_each_group_evsel(pos, leader) {
> + if (pos->pmu_name)
> + return pos->pmu_name;
> + }
> }
>
> return "cpu";
Powered by blists - more mailing lists