perf: arm_cspmu: Reject events meant for other PMUs
PATCH 1/1 perf: arm_cspmu: Reject events meant for other PMUs
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
$ perf stat -e r2 sleep 1
made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
--- drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/perf/arm_cspmu/arm_cspmu.c +3 -0
@@ -676,6 +676,9 @@ static int arm_cspmu_event_init(struct perf_event *event) cspmu =to_arm_cspmu (event->pmu); +if (event->attr.type != event->pmu->type) +return -ENOENT ; +/* * Following other "uncore" PMUs, we do not support sampling mode or * attach to a task (per-process mode).
Signature · 1 line
2.40.1
Hi Ilkka,
Thanks for fixing it.
Regards,
Besar
Quoted 49 lines
-----Original Message-----
From: Ilkka Koskinen <[email protected]>
Sent: Thursday, November 2, 2023 7:17 PM
To: Besar Wicaksono <[email protected]>; Suzuki K Poulose <[email protected]>; Robin Murphy <[email protected]>; Will Deacon <[email protected]>; Mark Rutland <[email protected]>; Raag Jadav <[email protected]>; Ilkka Koskinen <[email protected]>
Cc: [email protected]; [email protected]
Subject: [PATCH] perf:arm_cspmu: Reject events meant for other PMUsExternal email: Use caution opening links or attachments
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
Fixes e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSightPMU driver")
Signed-off-by Ilkka Koskinen <[email protected]>--- drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++ 1 file changed, 3 insertions(+)drivers/perf/arm_cspmu/arm_cspmu.c +3
-0@@ -676,6 +676,9 @@ static int arm_cspmu_event_init(struct perf_event *event) cspmu =to_arm_cspmu (event->pmu); +if (event->attr.type != event->pmu->type) +return -ENOENT ; +/* * Following other "uncore" PMUs, we do not support sampling mode or * attach to a task (per-process mode).
--
2.40.1
Quoted 21 lines · Ilkka Koskinen
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
Fixes e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")Signed-off-by Ilkka Koskinen <[email protected]>--- drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++ 1 file changed, 3 insertions(+)drivers/perf/arm_cspmu/arm_cspmu.c +0
-0
drivers/perf/arm_cspmu/arm_cspmu.c static int arm_cspmu_event_init(struct perf_event *event) · line 684
Quoted 9 lines
drivers/perf/arm_cspmu/arm_cspmu.c +3
-0@@ -676,6 +676,9 @@ static int arm_cspmu_event_init(struct perf_event *event) cspmu =to_arm_cspmu (event->pmu); +if (event->attr.type != event->pmu->type) +return -ENOENT ; +/* * Following other "uncore" PMUs, we do not support sampling mode or * attach to a task (per-process mode).
LGTM
Quoted 4 lines · Ilkka Koskinen
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
Quoted 8 lines
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
Fixes e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")Signed-off-by Ilkka Koskinen <[email protected]>
Will, are you happy to pick this up?
Mark.
Quoted 21 lines
--- drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++ 1 file changed, 3 insertions(+)drivers/perf/arm_cspmu/arm_cspmu.c +3
-0@@ -676,6 +676,9 @@ static int arm_cspmu_event_init(struct perf_event *event) cspmu =to_arm_cspmu (event->pmu); +if (event->attr.type != event->pmu->type) +return -ENOENT ; +/* * Following other "uncore" PMUs, we do not support sampling mode or * attach to a task (per-process mode). Signature · 1 line
2.40.1
[+Catalin]
Quoted 21 lines · Ilkka Koskinen
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
Fixes e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")Signed-off-by Ilkka Koskinen <[email protected]>--- drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++ 1 file changed, 3 insertions(+)drivers/perf/arm_cspmu/arm_cspmu.c +0
-0
drivers/perf/arm_cspmu/arm_cspmu.c static int arm_cspmu_event_init(struct perf_event *event) · line 681
Quoted 6 lines
drivers/perf/arm_cspmu/arm_cspmu.c +3
-0@@ -676,6 +676,9 @@ static int arm_cspmu_event_init(struct perf_event *event) cspmu =to_arm_cspmu (event->pmu); +if (event->attr.type != event->pmu->type) +return -ENOENT ; +
Catalin -- please can you pick this up as a fix in the arm64 tree?
Cheers,
Will
Catalin Marinas
AppliedQuoted 10 lines · Ilkka Koskinen
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
[...]
Applied to arm64 (for-next/core), thanks!
[1/1] perf: arm_cspmu: Reject events meant for other PMUs
https://git.kernel.org/arm64/c/15c7ef7341a2
Signature · 1 line
Catalin
Hi Catalin,
Quoted 5 lines · Catalin Marinas
Quoted 4 lines · Ilkka Koskinen
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
Quoted 8 lines
Quoted 6 lines
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
[...]
Applied to arm64 (for-next/core), thanks!
Just wanted to ask if you are planning to submit this patch for 6.7-rcX as a fix? We have found out that one can even crash AmpereOne by running "perf stat -C 1 sleep 1" without the patch.
Cheers, Ilkka
Quoted 8 lines
[1/1] perf:
arm_cspmu: Reject events meant for other PMUshttps://git.kernel.org/arm64/c/15c7ef7341a2Signature · 1 line
Catalin
Quoted 11 lines · Ilkka Koskinen
Quoted 10 lines · Catalin Marinas
Quoted 9 lines · Ilkka Koskinen
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
[...]
Applied to arm64 (for-next/core), thanks!
Just wanted to ask if you are planning to submit this patch for 6.7-rcX as a fix? We have found out that one can even crash AmpereOne by running "perf stat -C 1 sleep 1" without the patch.
Yes, I'll send it for 6.7-rc1 (probably tomorrow).
Signature · 1 line
Catalin
Quoted 14 lines · Catalin Marinas
Quoted 13 lines · Ilkka Koskinen
Quoted 12 lines · Catalin Marinas
Quoted 10 lines · Ilkka Koskinen
Coresight PMU driver didn't reject events meant for other PMUs. This caused some of the Core PMU events disappearing from the output of "perf list". In addition, trying to run e.g.
$ perf stat -e r2 sleep 1made Coresight PMU driver to handle the event instead of letting Core PMU driver to deal with it.
[...]
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied to arm64 (for-next/core), thanks!
Just wanted to ask if you are planning to submit this patch for 6.7-rcX as a fix? We have found out that one can even crash AmpereOne by running "perf stat -C 1 sleep 1" without the patch.
Yes, I'll send it for 6.7-rc1 (probably tomorrow).
Sounds perfert. Thanks a lot!
--Ilkka
Quoted 4 lines
Signature · 2 lines
-- Catalin