Skip to content

Commit 3e43d79

Browse files
stkidacmel
authored andcommitted
perf tools: No need to cache the PMUs in ARM SPE auxtrace init routine
- auxtrace_record__init() is called only once, so there is no point in using a static variable to cache the results of find_all_arm_spe_pmus(), make it local and free the results after use. - Another reason is, even though SPE is micro-architecture dependent, but so far it only supports "statistical-profiling-extension-v1" and we have no chance to use multiple SPE's PMU events in Perf command. So remove the useless check code to make it clear. Signed-off-by: Wei Li <liwei391@huawei.com> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Hanjun Guo <guohanjun@huawei.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Kim Phillips <kim.phillips@arm.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: linux-arm-kernel@lists.infradead.org Link: http://lore.kernel.org/lkml/20200724071111.35593-3-liwei391@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 31e81e0 commit 3e43d79

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎tools/perf/arch/arm/util/auxtrace.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,15 @@ struct auxtrace_record
5757
struct evsel *evsel;
5858
bool found_etm = false;
5959
struct perf_pmu *found_spe = NULL;
60-
static struct perf_pmu **arm_spe_pmus = NULL;
61-
static int nr_spes = 0;
60+
struct perf_pmu **arm_spe_pmus = NULL;
61+
int nr_spes = 0;
6262
int i = 0;
6363

6464
if (!evlist)
6565
return NULL;
6666

6767
cs_etm_pmu = perf_pmu__find(CORESIGHT_ETM_PMU_NAME);
68-
69-
if (!arm_spe_pmus)
70-
arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err);
68+
arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err);
7169

7270
evlist__for_each_entry(evlist, evsel) {
7371
if (cs_etm_pmu &&
@@ -84,6 +82,7 @@ struct auxtrace_record
8482
}
8583
}
8684
}
85+
free(arm_spe_pmus);
8786

8887
if (found_etm && found_spe) {
8988
pr_err("Concurrent ARM Coresight ETM and SPE operation not currently supported\n");

0 commit comments

Comments
 (0)