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

Configure Feed

Select the types of activity you want to include in your feed.

perf pmu: Avoid passing format list to perf_pmu__format_bits()

Pass the PMU so the format list can be better abstracted and later
lazily loaded.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
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: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
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>
Link: https://lore.kernel.org/r/20230823080828.1460376-8-irogers@google.com
[ Did missing conversions in tools/perf/arch/arm*/util/cs-etm.c ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
da6a5afd 7eb54733

+15 -16
+6 -6
tools/perf/arch/arm/util/cs-etm.c
··· 79 79 int err; 80 80 u32 val; 81 81 u64 contextid = evsel->core.attr.config & 82 - (perf_pmu__format_bits(&cs_etm_pmu->format, "contextid") | 83 - perf_pmu__format_bits(&cs_etm_pmu->format, "contextid1") | 84 - perf_pmu__format_bits(&cs_etm_pmu->format, "contextid2")); 82 + (perf_pmu__format_bits(cs_etm_pmu, "contextid") | 83 + perf_pmu__format_bits(cs_etm_pmu, "contextid1") | 84 + perf_pmu__format_bits(cs_etm_pmu, "contextid2")); 85 85 86 86 if (!contextid) 87 87 return 0; ··· 106 106 } 107 107 108 108 if (contextid & 109 - perf_pmu__format_bits(&cs_etm_pmu->format, "contextid1")) { 109 + perf_pmu__format_bits(cs_etm_pmu, "contextid1")) { 110 110 /* 111 111 * TRCIDR2.CIDSIZE, bit [9-5], indicates whether contextID 112 112 * tracing is supported: ··· 122 122 } 123 123 124 124 if (contextid & 125 - perf_pmu__format_bits(&cs_etm_pmu->format, "contextid2")) { 125 + perf_pmu__format_bits(cs_etm_pmu, "contextid2")) { 126 126 /* 127 127 * TRCIDR2.VMIDOPT[30:29] != 0 and 128 128 * TRCIDR2.VMIDSIZE[14:10] == 0b00100 (32bit virtual contextid) ··· 151 151 u32 val; 152 152 153 153 if (!(evsel->core.attr.config & 154 - perf_pmu__format_bits(&cs_etm_pmu->format, "timestamp"))) 154 + perf_pmu__format_bits(cs_etm_pmu, "timestamp"))) 155 155 return 0; 156 156 157 157 if (!cs_etm_is_etmv4(itr, cpu)) {
+1 -1
tools/perf/arch/arm64/util/arm-spe.c
··· 230 230 * inform that the resulting output's SPE samples contain physical addresses 231 231 * where applicable. 232 232 */ 233 - bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable"); 233 + bit = perf_pmu__format_bits(arm_spe_pmu, "pa_enable"); 234 234 if (arm_spe_evsel->core.attr.config & bit) 235 235 evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR); 236 236
+3 -4
tools/perf/arch/x86/util/intel-pt.c
··· 122 122 123 123 *res = 0; 124 124 125 - mask = perf_pmu__format_bits(&intel_pt_pmu->format, str); 125 + mask = perf_pmu__format_bits(intel_pt_pmu, str); 126 126 if (!mask) 127 127 return -EINVAL; 128 128 ··· 346 346 intel_pt_parse_terms(intel_pt_pmu, "tsc", &tsc_bit); 347 347 intel_pt_parse_terms(intel_pt_pmu, "noretcomp", &noretcomp_bit); 348 348 intel_pt_parse_terms(intel_pt_pmu, "mtc", &mtc_bit); 349 - mtc_freq_bits = perf_pmu__format_bits(&intel_pt_pmu->format, 350 - "mtc_period"); 349 + mtc_freq_bits = perf_pmu__format_bits(intel_pt_pmu, "mtc_period"); 351 350 intel_pt_parse_terms(intel_pt_pmu, "cyc", &cyc_bit); 352 351 353 352 intel_pt_tsc_ctc_ratio(&tsc_ctc_ratio_n, &tsc_ctc_ratio_d); ··· 501 502 502 503 valid |= 1; 503 504 504 - bits = perf_pmu__format_bits(&intel_pt_pmu->format, name); 505 + bits = perf_pmu__format_bits(intel_pt_pmu, name); 505 506 506 507 config &= bits; 507 508
+1 -1
tools/perf/util/parse-events.c
··· 1162 1162 type = perf_pmu__format_type(pmu, term->config); 1163 1163 if (type != PERF_PMU_FORMAT_VALUE_CONFIG) 1164 1164 continue; 1165 - bits |= perf_pmu__format_bits(&pmu->format, term->config); 1165 + bits |= perf_pmu__format_bits(pmu, term->config); 1166 1166 break; 1167 1167 case PARSE_EVENTS__TERM_TYPE_CONFIG: 1168 1168 bits = ~(u64)0;
+3 -3
tools/perf/util/pmu.c
··· 1000 1000 if (term) 1001 1001 user_bits = term->val.cfg_chg; 1002 1002 1003 - bits = perf_pmu__format_bits(&pmu->format, config_name); 1003 + bits = perf_pmu__format_bits(pmu, config_name); 1004 1004 1005 1005 /* Do nothing if the user changed the value */ 1006 1006 if (bits & user_bits) ··· 1023 1023 return NULL; 1024 1024 } 1025 1025 1026 - __u64 perf_pmu__format_bits(struct list_head *formats, const char *name) 1026 + __u64 perf_pmu__format_bits(struct perf_pmu *pmu, const char *name) 1027 1027 { 1028 - struct perf_pmu_format *format = pmu_find_format(formats, name); 1028 + struct perf_pmu_format *format = pmu_find_format(&pmu->format, name); 1029 1029 __u64 bits = 0; 1030 1030 int fbit; 1031 1031
+1 -1
tools/perf/util/pmu.h
··· 221 221 struct perf_event_attr *attr, 222 222 struct list_head *head_terms, 223 223 bool zero, struct parse_events_error *error); 224 - __u64 perf_pmu__format_bits(struct list_head *formats, const char *name); 224 + __u64 perf_pmu__format_bits(struct perf_pmu *pmu, const char *name); 225 225 int perf_pmu__format_type(struct perf_pmu *pmu, const char *name); 226 226 int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, 227 227 struct perf_pmu_info *info);