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.

Merge tag 'perf-tools-fixes-v5.11-2-2021-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull more perf tools fixes from Arnaldo Carvalho de Melo:

- Fix id index used in Intel PT for heterogeneous systems

- Fix overrun issue in 'perf script' for dynamically-allocated PMU type
number

- Fix 'perf stat' metrics containing the 'duration_time' synthetic
event

- Fix system PMU 'perf stat' metrics

* tag 'perf-tools-fixes-v5.11-2-2021-01-22' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
perf script: Fix overrun issue for dynamically-allocated PMU type number
perf metricgroup: Fix system PMU metrics
perf metricgroup: Fix for metrics containing duration_time
perf evlist: Fix id index for heterogeneous systems

+32 -19
+4 -13
tools/lib/perf/evlist.c
··· 367 367 return map; 368 368 } 369 369 370 - static void perf_evlist__set_sid_idx(struct perf_evlist *evlist, 371 - struct perf_evsel *evsel, int idx, int cpu, 372 - int thread) 370 + static void perf_evsel__set_sid_idx(struct perf_evsel *evsel, int idx, int cpu, int thread) 373 371 { 374 372 struct perf_sample_id *sid = SID(evsel, cpu, thread); 375 373 376 374 sid->idx = idx; 377 - if (evlist->cpus && cpu >= 0) 378 - sid->cpu = evlist->cpus->map[cpu]; 379 - else 380 - sid->cpu = -1; 381 - if (!evsel->system_wide && evlist->threads && thread >= 0) 382 - sid->tid = perf_thread_map__pid(evlist->threads, thread); 383 - else 384 - sid->tid = -1; 375 + sid->cpu = perf_cpu_map__cpu(evsel->cpus, cpu); 376 + sid->tid = perf_thread_map__pid(evsel->threads, thread); 385 377 } 386 378 387 379 static struct perf_mmap* ··· 492 500 if (perf_evlist__id_add_fd(evlist, evsel, cpu, thread, 493 501 fd) < 0) 494 502 return -1; 495 - perf_evlist__set_sid_idx(evlist, evsel, idx, cpu, 496 - thread); 503 + perf_evsel__set_sid_idx(evsel, idx, cpu, thread); 497 504 } 498 505 } 499 506
+17 -1
tools/perf/builtin-script.c
··· 186 186 187 187 enum { 188 188 OUTPUT_TYPE_SYNTH = PERF_TYPE_MAX, 189 + OUTPUT_TYPE_OTHER, 189 190 OUTPUT_TYPE_MAX 190 191 }; 191 192 ··· 284 283 285 284 .invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT, 286 285 }, 286 + 287 + [OUTPUT_TYPE_OTHER] = { 288 + .user_set = false, 289 + 290 + .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | 291 + PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | 292 + PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | 293 + PERF_OUTPUT_SYM | PERF_OUTPUT_SYMOFFSET | 294 + PERF_OUTPUT_DSO | PERF_OUTPUT_PERIOD, 295 + 296 + .invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT, 297 + }, 287 298 }; 288 299 289 300 struct evsel_script { ··· 356 343 case PERF_TYPE_SYNTH: 357 344 return OUTPUT_TYPE_SYNTH; 358 345 default: 359 - return type; 346 + if (type < PERF_TYPE_MAX) 347 + return type; 360 348 } 349 + 350 + return OUTPUT_TYPE_OTHER; 361 351 } 362 352 363 353 static inline unsigned int attr_type(unsigned int type)
+11 -5
tools/perf/util/metricgroup.c
··· 162 162 return false; 163 163 } 164 164 165 + static bool evsel_same_pmu(struct evsel *ev1, struct evsel *ev2) 166 + { 167 + if (!ev1->pmu_name || !ev2->pmu_name) 168 + return false; 169 + 170 + return !strcmp(ev1->pmu_name, ev2->pmu_name); 171 + } 172 + 165 173 /** 166 174 * Find a group of events in perf_evlist that correspond to those from a parsed 167 175 * metric expression. Note, as find_evsel_group is called in the same order as ··· 288 280 */ 289 281 if (!has_constraint && 290 282 ev->leader != metric_events[i]->leader && 291 - !strcmp(ev->leader->pmu_name, 292 - metric_events[i]->leader->pmu_name)) 283 + evsel_same_pmu(ev->leader, metric_events[i]->leader)) 293 284 break; 294 285 if (!strcmp(metric_events[i]->name, ev->name)) { 295 286 set_bit(ev->idx, evlist_used); ··· 773 766 struct metricgroup_add_iter_data { 774 767 struct list_head *metric_list; 775 768 const char *metric; 776 - struct metric **m; 777 769 struct expr_ids *ids; 778 770 int *ret; 779 771 bool *has_match; ··· 1064 1058 void *data) 1065 1059 { 1066 1060 struct metricgroup_add_iter_data *d = data; 1061 + struct metric *m = NULL; 1067 1062 int ret; 1068 1063 1069 1064 if (!match_pe_metric(pe, d->metric)) 1070 1065 return 0; 1071 1066 1072 - ret = add_metric(d->metric_list, pe, d->metric_no_group, d->m, NULL, d->ids); 1067 + ret = add_metric(d->metric_list, pe, d->metric_no_group, &m, NULL, d->ids); 1073 1068 if (ret) 1074 1069 return ret; 1075 1070 ··· 1121 1114 .metric_list = &list, 1122 1115 .metric = metric, 1123 1116 .metric_no_group = metric_no_group, 1124 - .m = &m, 1125 1117 .ids = &ids, 1126 1118 .has_match = &has_match, 1127 1119 .ret = &ret,