[PATCH] perf arm64: Fix read PMU cpu slots

Haixin Yu yuhaixin.yhx at linux.alibaba.com
Sun Jul 23 22:06:54 PDT 2023


Commit f8ad6018ce3c ("perf pmu: Remove duplication around
 EVENT_SOURCE_DEVICE_PATH") uses sysfs__read_ull to read a full
sysfs path, which will never success. Fix it by read file directly.

Signed-off-by: Haixin Yu <yuhaixin.yhx at linux.alibaba.com>
---
 tools/perf/arch/arm64/util/pmu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/arm64/util/pmu.c b/tools/perf/arch/arm64/util/pmu.c
index 561de0cb6b95..512a8f13c4de 100644
--- a/tools/perf/arch/arm64/util/pmu.c
+++ b/tools/perf/arch/arm64/util/pmu.c
@@ -54,10 +54,11 @@ double perf_pmu__cpu_slots_per_cycle(void)
 		perf_pmu__pathname_scnprintf(path, sizeof(path),
 					     pmu->name, "caps/slots");
 		/*
-		 * The value of slots is not greater than 32 bits, but sysfs__read_int
-		 * can't read value with 0x prefix, so use sysfs__read_ull instead.
+		 * The value of slots is not greater than 32 bits, but
+		 * filename__read_int can't read value with 0x prefix,
+		 * so use filename__read_ull instead.
 		 */
-		sysfs__read_ull(path, &slots);
+		filename__read_ull(path, &slots);
 	}
 
 	return slots ? (double)slots : NAN;
-- 
2.34.1




More information about the linux-arm-kernel mailing list