Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Make matching_pmu effective

The perf_pmu_test_event.matching_pmu didn't work. No matter what its
value is, it does not affect the test results. So let matching_pmu be
used for matching perf_pmu_test_pmu.pmu.name.

Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Shuai Xue <xueshuai@linux.alibaba.com>
Cc: Zhuo Song <zhuo.song@linux.alibaba.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-doc@vger.kernel.org
Link: https://lore.kernel.org/r/1695794391-34817-5-git-send-email-renyu.zj@linux.alibaba.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Jing Zhang and committed by
Namhyung Kim
3bb59e75 e3e42e23

+8 -2
+8 -2
tools/perf/tests/pmu-events.c
··· 245 245 }, 246 246 .alias_str = "event=0x2b", 247 247 .alias_long_desc = "ddr write-cycles event", 248 - .matching_pmu = "uncore_sys_ddr_pmu", 248 + .matching_pmu = "uncore_sys_ddr_pmu0", 249 249 }; 250 250 251 251 static const struct perf_pmu_test_event sys_ccn_pmu_read_cycles = { ··· 259 259 }, 260 260 .alias_str = "config=0x2c", 261 261 .alias_long_desc = "ccn read-cycles event", 262 - .matching_pmu = "uncore_sys_ccn_pmu", 262 + .matching_pmu = "uncore_sys_ccn_pmu4", 263 263 }; 264 264 265 265 static const struct perf_pmu_test_event *sys_events[] = { ··· 614 614 .test_event = &test_event, 615 615 .count = &matched_count, 616 616 }; 617 + 618 + if (strcmp(pmu_name, test_event.matching_pmu)) { 619 + pr_debug("testing aliases uncore PMU %s: mismatched matching_pmu, %s vs %s\n", 620 + pmu_name, test_event.matching_pmu, pmu_name); 621 + return -1; 622 + } 617 623 618 624 err = perf_pmu__find_event(pmu, event->name, &args, 619 625 test_core_pmu_event_aliases_cb);