Skip to content

Commit 9754353

Browse files
Haixin Yuacmel
authored andcommitted
perf pmu arm64: Fix reading the PMU cpu slots in sysfs
Commit f8ad601 ("perf pmu: Remove duplication around EVENT_SOURCE_DEVICE_PATH") uses sysfs__read_ull() to read a full sysfs path, which will never succeeds as it already comes with the sysfs mount point in it, which sysfs__read_ull() will add again. Fix it by reading the file using filename__read_ull(), that will not add the sysfs mount point. Fixes: f8ad601 ("perf pmu: Remove duplication around EVENT_SOURCE_DEVICE_PATH") Signed-off-by: Haixin Yu <[email protected]> Tested-by: Jing Zhang <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 6eaae19 commit 9754353

File tree

1 file changed

+4
-3
lines changed
  • tools/perf/arch/arm64/util

1 file changed

+4
-3
lines changed

tools/perf/arch/arm64/util/pmu.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ double perf_pmu__cpu_slots_per_cycle(void)
5454
perf_pmu__pathname_scnprintf(path, sizeof(path),
5555
pmu->name, "caps/slots");
5656
/*
57-
* The value of slots is not greater than 32 bits, but sysfs__read_int
58-
* can't read value with 0x prefix, so use sysfs__read_ull instead.
57+
* The value of slots is not greater than 32 bits, but
58+
* filename__read_int can't read value with 0x prefix,
59+
* so use filename__read_ull instead.
5960
*/
60-
sysfs__read_ull(path, &slots);
61+
filename__read_ull(path, &slots);
6162
}
6263

6364
return slots ? (double)slots : NAN;

0 commit comments

Comments
 (0)