public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Ian Rogers <irogers@google.com>
Cc: Breno Leitao <leitao@debian.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, Denis Yaroshevskiy <dyaroshev@meta.com>
Subject: Re: [PATCH] perf stat: Fix crash on arm64
Date: Thu, 5 Feb 2026 17:52:50 +0000	[thread overview]
Message-ID: <20260205175250.GC3529712@e132581.arm.com> (raw)
In-Reply-To: <20260205173918.GB3529712@e132581.arm.com>

On Thu, Feb 05, 2026 at 05:39:18PM +0000, Leo Yan wrote:

> > > The sorting function introduced by commit a745c0831c15c ("perf stat:
> > > Sort default events/metrics") compares events based on their individual
> > > properties. This can cause events from different groups to be
> > > interleaved, resulting in group members appearing before their leaders
> > > in the sorted evlist.
> > 
> > Hi, sorry for the issue. I can see what you're saying but why is this
> > an arm64 issue? The legacy Default metrics are common to all
> > architectures:
> > https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/arch/common/common/metrics.json?h=perf-tools-next
> 
> Since you are mentioning common metrics, I found the common metrics does
> not work on Arm64 platform (I built with NO_JEVENTS=1 or enabled jevnts
> but both don't work).
> 
> The latest perf will have no any output if the CPU type is missed in
> json and rallback to common metrics. The failure path is:
> 
>   add_default_events()
>     metricgroup__parse_groups()
>       pmu_metrics_table__find()  => return NULL
> 
> In my case, pmu_metrics_table__find() always return NULL, as a result,
> `perf stat sleep 1` directly bail out without any output.
> 
> I expect Breno's env might have the corresponding CPU json files, this
> is possible different from my test machine.

On my local env, I need a fix:

diff --git a/tools/perf/pmu-events/empty-pmu-events.c b/tools/perf/pmu-events/empty-pmu-events.c
index e4d00f6b2b5d..f74acc206856 100644
--- a/tools/perf/pmu-events/empty-pmu-events.c
+++ b/tools/perf/pmu-events/empty-pmu-events.c
@@ -3237,14 +3237,6 @@ const struct pmu_events_table *perf_pmu__default_core_events_table(void)
         return NULL;
 }
 
-const struct pmu_metrics_table *pmu_metrics_table__find(void)
-{
-        struct perf_cpu cpu = {-1};
-        const struct pmu_events_map *map = map_for_cpu(cpu);
-
-        return map ? &map->metric_table : NULL;
-}
-
 const struct pmu_metrics_table *pmu_metrics_table__default(void)
 {
         int i = 0;
@@ -3261,6 +3253,17 @@ const struct pmu_metrics_table *pmu_metrics_table__default(void)
         return NULL;
 }
 
+const struct pmu_metrics_table *pmu_metrics_table__find(void)
+{
+        struct perf_cpu cpu = {-1};
+        const struct pmu_events_map *map = map_for_cpu(cpu);
+
+       if (map)
+               return &map->metric_table;
+
+       return pmu_metrics_table__default();
+}
+

I have no deep understanding for jevents, seems to me, Breno's issue is
a different one from me.  Please kindly confirm.

Thanks,
Leo

  reply	other threads:[~2026-02-05 17:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 11:46 [PATCH] perf stat: Fix crash on arm64 Breno Leitao
2026-02-05 13:32 ` Dmitry Ilvokhin
2026-02-05 16:59 ` Ian Rogers
2026-02-05 17:39   ` Leo Yan
2026-02-05 17:52     ` Leo Yan [this message]
2026-02-05 18:22       ` Ian Rogers
2026-03-11 10:21         ` Breno Leitao
2026-03-11 11:50           ` Leo Yan
2026-03-23 14:21             ` Arnaldo Carvalho de Melo
2026-03-23 14:36               ` Arnaldo Carvalho de Melo
2026-03-23 15:21                 ` Leo Yan
2026-03-23 17:06             ` Ian Rogers
2026-03-24 11:00               ` Breno Leitao
2026-02-06 12:01   ` Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260205175250.GC3529712@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dyaroshev@meta.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox