lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231127063415.996831-1-xu.yang_2@nxp.com>
Date:   Mon, 27 Nov 2023 14:34:15 +0800
From:   Xu Yang <xu.yang_2@....com>
To:     peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...nel.org, namhyung@...nel.org, irogers@...gle.com
Cc:     adrian.hunter@...el.com, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [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.

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ