From: Leo Yan <leo.yan@arm.com>
To: Ian Rogers <irogers@google.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@arm.com>,
John Garry <john.g.garry@oracle.com>,
Will Deacon <will@kernel.org>, Leo Yan <leo.yan@linux.dev>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Yicong Yang <yangyicong@huawei.com>
Subject: Re: [PATCH v1] perf arm: Workaround ARM PMUs cpu maps having offline cpus
Date: Mon, 10 Jun 2024 14:29:55 +0100 [thread overview]
Message-ID: <23ee1734-7e65-4f11-aede-fea44ada3cc4@arm.com> (raw)
In-Reply-To: <20240607065343.695369-1-irogers@google.com>
Hi Ian,
On 6/7/24 07:53, Ian Rogers wrote:
[...]
> diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c
> index 8b7cb68ba1a8..6b544edbd3f6 100644
> --- a/tools/perf/arch/arm/util/pmu.c
> +++ b/tools/perf/arch/arm/util/pmu.c
> @@ -11,12 +11,15 @@
>
> #include "arm-spe.h"
> #include "hisi-ptt.h"
> +#include "../../../util/cpumap.h"
> #include "../../../util/pmu.h"
> #include "../../../util/cs-etm.h"
> #include "../../arm64/util/mem-events.h"
>
> -void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
> +void perf_pmu__arch_init(struct perf_pmu *pmu)
> {
> + struct perf_cpu_map *intersect;
> +
> #ifdef HAVE_AUXTRACE_SUPPORT
> if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) {
> /* add ETM default config here */
> @@ -33,6 +36,9 @@ void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused)
> pmu->selectable = true;
> #endif
> }
> -
> #endif
> + /* Workaround some ARM PMU's failing to correctly set CPU maps for online processors. */
> + intersect = perf_cpu_map__intersect(cpu_map__online(), pmu->cpus);
> + perf_cpu_map__put(pmu->cpus);
> + pmu->cpus = intersect;
I did a test for this patch, it works well for me.
Tested-by: Leo Yan <leo.yan@arm.com>
Just a nitpick and I think it is not an issue caused by this patch.
After hotplug off one CPU and then if specify the CPU with option '-C',
the 'perf stat' command still continues to run. This is inconsistent
with the 'perf record' which exits with failures immediately.
Maybe consider to send an extra patch to address this issue?
The test steps are:
# echo 0 > /sys/devices/system/cpu0/online
# perf stat -C 0 -e armv9_cortex_a520/cycles/ -- sleep 1
WARNING: A requested CPU in '0' is not supported by PMU
'armv9_cortex_a520' (CPUs 5) for event 'armv9_cortex_a520/cycles/'
Performance counter stats for 'CPU(s) 0':
<not supported> armv9_cortex_a520/cycles/
1.001223060 seconds time elapsed
Thanks,
Leo
> }
> --
> 2.45.2.505.gda0bf45e8d-goog
>
>
next prev parent reply other threads:[~2024-06-10 13:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 6:53 [PATCH v1] perf arm: Workaround ARM PMUs cpu maps having offline cpus Ian Rogers
2024-06-10 13:29 ` Leo Yan [this message]
2024-06-10 17:33 ` Ian Rogers
2024-06-12 20:32 ` Leo Yan
2024-06-12 20:59 ` Ian Rogers
2024-06-12 10:16 ` Yicong Yang
2024-06-12 11:52 ` Ian Rogers
2024-06-24 17:50 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23ee1734-7e65-4f11-aede-fea44ada3cc4@arm.com \
--to=leo.yan@arm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yangyicong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).