Skip to content

Commit 9d3bc45

Browse files
committed
Merge tag 'perf-tools-fixes-for-v6.7-2-2023-12-08' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools fixes from Namhyung Kim: "A random set of small bug fixes including: - Fix segfault on AmpereOne due to missing default metricgroup name - Fix segfault on `perf list --json` due to NULL pointer" * tag 'perf-tools-fixes-for-v6.7-2-2023-12-08' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: perf list: Fix JSON segfault by setting the used skip_duplicate_pmus callback perf vendor events arm64: AmpereOne: Add missing DefaultMetricgroupName fields perf metrics: Avoid segv if default metricgroup isn't set
2 parents 2099306 + b169374 commit 9d3bc45

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

tools/perf/builtin-list.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ static void json_print_metric(void *ps __maybe_unused, const char *group,
434434
strbuf_release(&buf);
435435
}
436436

437+
static bool json_skip_duplicate_pmus(void *ps __maybe_unused)
438+
{
439+
return false;
440+
}
441+
437442
static bool default_skip_duplicate_pmus(void *ps)
438443
{
439444
struct print_state *print_state = ps;
@@ -503,6 +508,7 @@ int cmd_list(int argc, const char **argv)
503508
.print_end = json_print_end,
504509
.print_event = json_print_event,
505510
.print_metric = json_print_metric,
511+
.skip_duplicate_pmus = json_skip_duplicate_pmus,
506512
};
507513
ps = &json_ps;
508514
} else {

tools/perf/pmu-events/arch/arm64/ampere/ampereone/metrics.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,15 @@
231231
"MetricName": "slots_lost_misspeculation_fraction",
232232
"MetricExpr": "100 * ((OP_SPEC - OP_RETIRED) / (CPU_CYCLES * #slots))",
233233
"BriefDescription": "Fraction of slots lost due to misspeculation",
234+
"DefaultMetricgroupName": "TopdownL1",
234235
"MetricGroup": "Default;TopdownL1",
235236
"ScaleUnit": "1percent of slots"
236237
},
237238
{
238239
"MetricName": "retired_fraction",
239240
"MetricExpr": "100 * (OP_RETIRED / (CPU_CYCLES * #slots))",
240241
"BriefDescription": "Fraction of slots retiring, useful work",
242+
"DefaultMetricgroupName": "TopdownL1",
241243
"MetricGroup": "Default;TopdownL1",
242244
"ScaleUnit": "1percent of slots"
243245
},

tools/perf/util/metricgroup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static struct metric *metric__new(const struct pmu_metric *pm,
225225

226226
m->pmu = pm->pmu ?: "cpu";
227227
m->metric_name = pm->metric_name;
228-
m->default_metricgroup_name = pm->default_metricgroup_name;
228+
m->default_metricgroup_name = pm->default_metricgroup_name ?: "";
229229
m->modifier = NULL;
230230
if (modifier) {
231231
m->modifier = strdup(modifier);

0 commit comments

Comments
 (0)