Skip to content

Commit f869075

Browse files
committed
perf tools: Fix up some comments and code to properly use the event_source bus
commit 0cced76 upstream. In sysfs, the perf events are all located in /sys/bus/event_source/devices/ but some places ended up hard-coding the location to be at the root of /sys/devices/ which could be very risky as you do not exactly know what type of device you are accessing in sysfs at that location. So fix this all up by properly pointing everything at the bus device list instead of the root of the sysfs devices/ tree. Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Kan Liang <[email protected]> Link: https://lore.kernel.org/r/2025021955-implant-excavator-179d@gregkh Signed-off-by: Namhyung Kim <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b094e8e commit f869075

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

tools/perf/Documentation/intel-hybrid.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ Part of events are available on core cpu, part of events are available
88
on atom cpu and even part of events are available on both.
99

1010
Kernel exports two new cpu pmus via sysfs:
11-
/sys/devices/cpu_core
12-
/sys/devices/cpu_atom
11+
/sys/bus/event_source/devices/cpu_core
12+
/sys/bus/event_source/devices/cpu_atom
1313

1414
The 'cpus' files are created under the directories. For example,
1515

16-
cat /sys/devices/cpu_core/cpus
16+
cat /sys/bus/event_source/devices/cpu_core/cpus
1717
0-15
1818

19-
cat /sys/devices/cpu_atom/cpus
19+
cat /sys/bus/event_source/devices/cpu_atom/cpus
2020
16-23
2121

2222
It indicates cpu0-cpu15 are core cpus and cpu16-cpu23 are atom cpus.
@@ -60,8 +60,8 @@ can't carry pmu information. So now this type is extended to be PMU aware
6060
type. The PMU type ID is stored at attr.config[63:32].
6161

6262
PMU type ID is retrieved from sysfs.
63-
/sys/devices/cpu_atom/type
64-
/sys/devices/cpu_core/type
63+
/sys/bus/event_source/devices/cpu_atom/type
64+
/sys/bus/event_source/devices/cpu_core/type
6565

6666
The new attr.config layout for PERF_TYPE_HARDWARE:
6767

tools/perf/Documentation/perf-list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ in the CPU vendor specific documentation.
188188

189189
The available PMUs and their raw parameters can be listed with
190190

191-
ls /sys/devices/*/format
191+
ls /sys/bus/event_source/devices/*/format
192192

193193
For example the raw event "LSD.UOPS" core pmu event above could
194194
be specified as

tools/perf/arch/x86/util/iostat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define MAX_PATH 1024
3333
#endif
3434

35-
#define UNCORE_IIO_PMU_PATH "devices/uncore_iio_%d"
35+
#define UNCORE_IIO_PMU_PATH "bus/event_source/devices/uncore_iio_%d"
3636
#define SYSFS_UNCORE_PMU_PATH "%s/"UNCORE_IIO_PMU_PATH
3737
#define PLATFORM_MAPPING_PATH UNCORE_IIO_PMU_PATH"/die%d"
3838

tools/perf/builtin-stat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
#include <internal/threadmap.h>
9797

9898
#define DEFAULT_SEPARATOR " "
99-
#define FREEZE_ON_SMI_PATH "devices/cpu/freeze_on_smi"
99+
#define FREEZE_ON_SMI_PATH "bus/event_source/devices/cpu/freeze_on_smi"
100100

101101
static void print_counters(struct timespec *ts, int argc, const char **argv);
102102

tools/perf/util/mem-events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static bool perf_pmu__mem_events_supported(const char *mnt, struct perf_pmu *pmu
189189
if (!e->event_name)
190190
return true;
191191

192-
scnprintf(path, PATH_MAX, "%s/devices/%s/events/%s", mnt, pmu->name, e->event_name);
192+
scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/events/%s", mnt, pmu->name, e->event_name);
193193

194194
return !stat(path, &st);
195195
}

tools/perf/util/pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
#define UNIT_MAX_LEN 31 /* max length for event unit name */
3434

3535
enum event_source {
36-
/* An event loaded from /sys/devices/<pmu>/events. */
36+
/* An event loaded from /sys/bus/event_source/devices/<pmu>/events. */
3737
EVENT_SRC_SYSFS,
3838
/* An event loaded from a CPUID matched json file. */
3939
EVENT_SRC_CPU_JSON,
4040
/*
41-
* An event loaded from a /sys/devices/<pmu>/identifier matched json
41+
* An event loaded from a /sys/bus/event_source/devices/<pmu>/identifier matched json
4242
* file.
4343
*/
4444
EVENT_SRC_SYS_JSON,

0 commit comments

Comments
 (0)