hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/tools/perf/arch/arm/util/auxtrace.c
....@@ -6,8 +6,10 @@
66
77 #include <stdbool.h>
88 #include <linux/coresight-pmu.h>
9
+#include <linux/zalloc.h>
910
1011 #include "../../util/auxtrace.h"
12
+#include "../../util/debug.h"
1113 #include "../../util/evlist.h"
1214 #include "../../util/pmu.h"
1315 #include "cs-etm.h"
....@@ -49,39 +51,38 @@
4951 }
5052
5153 struct auxtrace_record
52
-*auxtrace_record__init(struct perf_evlist *evlist, int *err)
54
+*auxtrace_record__init(struct evlist *evlist, int *err)
5355 {
5456 struct perf_pmu *cs_etm_pmu;
55
- struct perf_evsel *evsel;
57
+ struct evsel *evsel;
5658 bool found_etm = false;
57
- bool found_spe = false;
58
- static struct perf_pmu **arm_spe_pmus = NULL;
59
- static int nr_spes = 0;
59
+ struct perf_pmu *found_spe = NULL;
60
+ struct perf_pmu **arm_spe_pmus = NULL;
61
+ int nr_spes = 0;
6062 int i = 0;
6163
6264 if (!evlist)
6365 return NULL;
6466
6567 cs_etm_pmu = perf_pmu__find(CORESIGHT_ETM_PMU_NAME);
66
-
67
- if (!arm_spe_pmus)
68
- arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err);
68
+ arm_spe_pmus = find_all_arm_spe_pmus(&nr_spes, err);
6969
7070 evlist__for_each_entry(evlist, evsel) {
7171 if (cs_etm_pmu &&
72
- evsel->attr.type == cs_etm_pmu->type)
72
+ evsel->core.attr.type == cs_etm_pmu->type)
7373 found_etm = true;
7474
75
- if (!nr_spes)
75
+ if (!nr_spes || found_spe)
7676 continue;
7777
7878 for (i = 0; i < nr_spes; i++) {
79
- if (evsel->attr.type == arm_spe_pmus[i]->type) {
80
- found_spe = true;
79
+ if (evsel->core.attr.type == arm_spe_pmus[i]->type) {
80
+ found_spe = arm_spe_pmus[i];
8181 break;
8282 }
8383 }
8484 }
85
+ free(arm_spe_pmus);
8586
8687 if (found_etm && found_spe) {
8788 pr_err("Concurrent ARM Coresight ETM and SPE operation not currently supported\n");
....@@ -94,7 +95,7 @@
9495
9596 #if defined(__aarch64__)
9697 if (found_spe)
97
- return arm_spe_recording_init(err, arm_spe_pmus[i]);
98
+ return arm_spe_recording_init(err, found_spe);
9899 #endif
99100
100101 /*