[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB7PR04MB5146CA5E3126922635E181CC8CBDA@DB7PR04MB5146.eurprd04.prod.outlook.com>
Date: Mon, 27 Nov 2023 06:33:44 +0000
From: Xu Yang <xu.yang_2@....com>
To: "peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"acme@...nel.org" <acme@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"alexander.shishkin@...ux.intel.com"
<alexander.shishkin@...ux.intel.com>,
"jolsa@...nel.org" <jolsa@...nel.org>,
"namhyung@...nel.org" <namhyung@...nel.org>,
"irogers@...gle.com" <irogers@...gle.com>
CC: "adrian.hunter@...el.com" <adrian.hunter@...el.com>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] perf pmu: add loaded_json_aliases for non-core pmu when
get total events number
>
> After pmu_read_sysfs(), event aliases in json may be loaded for non-core
> pmu. And pmu->event_table is NULL for non-core pmu.
> If perf_pmu__num_events() didn't add loaded_json_aliases to the total
> number, perf list will show below error:
>
> Unexpected event imx8_ddr0/imx8_ddr0/write-command//
> ...
>
> This is because perf_pmu__num_events() didn't count correct events number.
> This will allow perf_pmu__num_events() to get corrent events number.
Not sure how, but previous thread about this issue is disconnected.
You can refer to: https://lore.kernel.org/all/20231010065738.2536751-1-xu.yang_2@nxp.com/
Thanks,
Xu Yang
>
> Signed-off-by: Xu Yang <xu.yang_2@....com>
> ---
> tools/perf/util/pmu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index d3c9aa4326be..646cf3351883 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -1631,8 +1631,8 @@ size_t perf_pmu__num_events(struct perf_pmu *pmu)
>
> nr = pmu->sysfs_aliases;
>
> - if (pmu->cpu_aliases_added)
> - nr += pmu->loaded_json_aliases;
> + if (pmu->cpu_aliases_added || pmu->is_uncore)
> + nr += pmu->loaded_json_aliases;
> else if (pmu->events_table)
> nr += pmu_events_table__num_events(pmu->events_table, pmu) - pmu->loaded_json_aliases;
>
> --
> 2.34.1
Powered by blists - more mailing lists