Commit 94f9eb95 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo
Browse files

perf pmus: Remove perf_pmus__has_hybrid



perf_pmus__has_hybrid was used to detect when there was >1 core PMU,
this can be achieved with perf_pmus__num_core_pmus that doesn't depend
upon is_pmu_hybrid and PMU name comparisons. When modifying the
function calls take the opportunity to improve comments,
enable/simplify tests that were previously failing for hybrid but now
pass and to simplify generic code.

Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ali Saidi <alisaidi@amazon.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kang Minchul <tegongkang@gmail.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Ming Wang <wangming01@loongson.cn>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230527072210.2900565-34-irogers@google.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 002c4845
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ static int test_events(const struct evlist_test *events, int cnt)

int test__hybrid(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{
	if (!perf_pmus__has_hybrid())
	if (perf_pmus__num_core_pmus() == 1)
		return TEST_SKIP;

	return test_events(test__hybrid_events, ARRAY_SIZE(test__hybrid_events));
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ static int ___evlist__add_default_attrs(struct evlist *evlist,
	for (i = 0; i < nr_attrs; i++)
		event_attr_init(attrs + i);

	if (!perf_pmus__has_hybrid())
	if (perf_pmus__num_core_pmus() == 1)
		return evlist__add_attrs(evlist, attrs, nr_attrs);

	for (i = 0; i < nr_attrs; i++) {
+1 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ uint64_t arch__intr_reg_mask(void)
	 */
	attr.sample_period = 1;

	if (perf_pmus__has_hybrid()) {
	if (perf_pmus__num_core_pmus() > 1) {
		struct perf_pmu *pmu = NULL;
		__u64 type = PERF_TYPE_RAW;

+2 −2
Original line number Diff line number Diff line
@@ -1294,7 +1294,7 @@ static int record__open(struct record *rec)
	 * of waiting or event synthesis.
	 */
	if (opts->target.initial_delay || target__has_cpu(&opts->target) ||
	    perf_pmus__has_hybrid()) {
	    perf_pmus__num_core_pmus() > 1) {
		pos = evlist__get_tracking_event(evlist);
		if (!evsel__is_dummy_event(pos)) {
			/* Set up dummy event. */
@@ -2193,7 +2193,7 @@ static void record__uniquify_name(struct record *rec)
	char *new_name;
	int ret;

	if (!perf_pmus__has_hybrid())
	if (perf_pmus__num_core_pmus() == 1)
		return;

	evlist__for_each_entry(evlist, pos) {
+8 −1
Original line number Diff line number Diff line
@@ -185,8 +185,15 @@ static int test__attr(struct test_suite *test __maybe_unused, int subtest __mayb
	char path_dir[PATH_MAX];
	char *exec_path;

	if (perf_pmus__has_hybrid())
	if (perf_pmus__num_core_pmus() > 1) {
		/*
		 * TODO: Attribute tests hard code the PMU type. If there are >1
		 * core PMU then each PMU will have a different type whic
		 * requires additional support.
		 */
		pr_debug("Skip test on hybrid systems");
		return TEST_SKIP;
	}

	/* First try development tree tests. */
	if (!lstat("./tests", &st))
Loading