[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240603092812.46616-1-yangyicong@huawei.com>
Date: Mon, 3 Jun 2024 17:28:09 +0800
From: Yicong Yang <yangyicong@...wei.com>
To: <will@...nel.org>, <mark.rutland@....com>, <acme@...nel.org>,
<namhyung@...nel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <peterz@...radead.org>, <mingo@...hat.com>,
<alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
<irogers@...gle.com>, <james.clark@....com>, <dongli.zhang@...cle.com>,
<jonathan.cameron@...wei.com>, <prime.zeng@...ilicon.com>,
<linuxarm@...wei.com>, <yangyicong@...ilicon.com>
Subject: [PATCH 0/3] Perf avoid opening events on offline CPUs
From: Yicong Yang <yangyicong@...ilicon.com>
If user doesn't specify the CPUs, perf will try to open events on CPUs
of the PMU which is initialized from the PMU's "cpumask" or "cpus" sysfs
attributes if provided. But we doesn't check whether the CPUs provided
by the PMU are all online. So we may open events on offline CPUs if PMU
driver provide offline CPUs and then we'll be rejected by the kernel:
[root@...alhost yang]# echo 0 > /sys/devices/system/cpu/cpu0/online
[root@...alhost yang]# ./perf_static stat -e armv8_pmuv3_0/cycles/ --timeout 100
Error:
The sys_perf_event_open() syscall returned with 19 (No such device) for event (cpu-clock).
/bin/dmesg | grep -i perf may provide additional information.
This patchset tries to avoid this case by:
- Double check the PMU's cpumask in the perf tool and only include online CPUs
- Trying to make the PMU drivers only export online CPUs in its "cpus" or "cpumask"
attributes
Previously discussion can be found at [1]. Will suggested to do it in userspace.
I think it makes sense to do a double check in the perf tool in case the driver
doesn't do this. So PATCH 1/3 is added in this version.
[1] https://lore.kernel.org/linux-arm-kernel/20240410095833.63934-1-yangyicong@huawei.com/
Yicong Yang (3):
perf pmu: Limit PMU cpumask to online CPUs
perf: arm_pmu: Only show online CPUs in device's "cpus" attribute
perf: arm_spe: Only show online CPUs in device's "cpumask" attribute
drivers/perf/arm_pmu.c | 24 +++++++++++++++++++++++-
drivers/perf/arm_spe_pmu.c | 22 +++++++++++++++++++++-
tools/perf/util/pmu.c | 13 +++++++++++--
3 files changed, 55 insertions(+), 4 deletions(-)
--
2.24.0
Powered by blists - more mailing lists