linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf parse-events: Use strcmp to compare the PMU name
@ 2020-04-30  0:36 Jin Yao
  2020-04-30  8:45 ` Jiri Olsa
  0 siblings, 1 reply; 13+ messages in thread
From: Jin Yao @ 2020-04-30  0:36 UTC (permalink / raw)
  To: acme, jolsa, peterz, mingo, alexander.shishkin
  Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao

A big uncore event group is split into multiple small groups which
only include the uncore events from the same PMU. This has been
supported in the commit 3cdc5c2cb924a ("perf parse-events: Handle
uncore event aliases in small groups properly").

If the event's PMU name starts to repeat, it must be a new event.
That can be used to distinguish the leader from other members.
But now it only compares the pointer of pmu_name
(leader->pmu_name == evsel->pmu_name).

If we use "perf stat -M LLC_MISSES.PCIE_WRITE -a" on cascadelakex,
the event list is:

evsel->name					evsel->pmu_name
---------------------------------------------------------------
unc_iio_data_req_of_cpu.mem_write.part0		uncore_iio_4 (as leader)
unc_iio_data_req_of_cpu.mem_write.part0		uncore_iio_2
unc_iio_data_req_of_cpu.mem_write.part0		uncore_iio_0
unc_iio_data_req_of_cpu.mem_write.part0		uncore_iio_5
unc_iio_data_req_of_cpu.mem_write.part0		uncore_iio_3
unc_iio_data_req_of_cpu.mem_write.part0		uncore_iio_1
unc_iio_data_req_of_cpu.mem_write.part1		uncore_iio_4
......

For the event "unc_iio_data_req_of_cpu.mem_write.part1" with
"uncore_iio_4", it should be the event from PMU "uncore_iio_4".
It's not a new leader for this PMU.

But if we use "(leader->pmu_name == evsel->pmu_name)", the check
would be failed and the event is stored to leaders[] as a new
PMU leader.

So this patch uses strcmp to compare the PMU name between events.

Fixes: 3cdc5c2cb924a ("perf parse-events: Handle uncore event aliases in small groups properly")
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/util/parse-events.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 10107747b361..786eddb6a097 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1629,12 +1629,11 @@ parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list,
 		 * event. That can be used to distinguish the leader from
 		 * other members, even they have the same event name.
 		 */
-		if ((leader != evsel) && (leader->pmu_name == evsel->pmu_name)) {
+		if ((leader != evsel) &&
+		    !strcmp(leader->pmu_name, evsel->pmu_name)) {
 			is_leader = false;
 			continue;
 		}
-		/* The name is always alias name */
-		WARN_ON(strcmp(leader->name, evsel->name));
 
 		/* Store the leader event for each PMU */
 		leaders[nr_pmu++] = (uintptr_t) evsel;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-05-07 17:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30  0:36 [PATCH] perf parse-events: Use strcmp to compare the PMU name Jin Yao
2020-04-30  8:45 ` Jiri Olsa
2020-04-30  8:54   ` John Garry
2020-04-30 11:15     ` Jiri Olsa
2020-04-30 11:48       ` John Garry
2020-04-30 13:38         ` Jin, Yao
2020-05-07 16:46           ` Arnaldo Carvalho de Melo
2020-05-07 17:24             ` Ian Rogers
2020-04-30 13:45   ` Jin, Yao
2020-04-30 15:32     ` Jiri Olsa
2020-05-06 22:45       ` Ian Rogers
2020-05-06 23:46         ` Arnaldo Carvalho de Melo
2020-05-07 16:44   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).