* [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
@ 2023-11-03 0:16 Ilkka Koskinen
2023-11-03 2:14 ` Besar Wicaksono
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Ilkka Koskinen @ 2023-11-03 0:16 UTC (permalink / raw)
To: Besar Wicaksono, Suzuki K Poulose, Robin Murphy, Will Deacon,
Mark Rutland, Raag Jadav, Ilkka Koskinen
Cc: linux-arm-kernel, linux-kernel
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.
Cc: stable@vger.kernel.org
Fixes: e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")
Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
---
drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
index 42b72042f6b3..2cc35dded007 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.c
+++ b/drivers/perf/arm_cspmu/arm_cspmu.c
@@ -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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* RE: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-03 0:16 [PATCH] perf: arm_cspmu: Reject events meant for other PMUs Ilkka Koskinen
@ 2023-11-03 2:14 ` Besar Wicaksono
2023-11-03 6:55 ` Anshuman Khandual
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Besar Wicaksono @ 2023-11-03 2:14 UTC (permalink / raw)
To: Ilkka Koskinen, Suzuki K Poulose, Robin Murphy, Will Deacon,
Mark Rutland, Raag Jadav
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Hi Ilkka,
Thanks for fixing it.
Reviewed-by: Besar Wicaksono <bwicaksono@nvidia.com>
Regards,
Besar
> -----Original Message-----
> From: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> Sent: Thursday, November 2, 2023 7:17 PM
> To: Besar Wicaksono <bwicaksono@nvidia.com>; Suzuki K Poulose
> <suzuki.poulose@arm.com>; Robin Murphy <robin.murphy@arm.com>; Will
> Deacon <will@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Raag
> Jadav <raag.jadav@intel.com>; Ilkka Koskinen
> <ilkka@os.amperecomputing.com>
> Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
>
> External 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 1
>
> made Coresight PMU driver to handle the event instead of letting
> Core PMU driver to deal with it.
>
> Cc: stable@vger.kernel.org
> Fixes: e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight
> PMU driver")
> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> ---
> drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c
> b/drivers/perf/arm_cspmu/arm_cspmu.c
> index 42b72042f6b3..2cc35dded007 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-03 0:16 [PATCH] perf: arm_cspmu: Reject events meant for other PMUs Ilkka Koskinen
2023-11-03 2:14 ` Besar Wicaksono
@ 2023-11-03 6:55 ` Anshuman Khandual
2023-11-03 11:37 ` Mark Rutland
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Anshuman Khandual @ 2023-11-03 6:55 UTC (permalink / raw)
To: Ilkka Koskinen, Besar Wicaksono, Suzuki K Poulose, Robin Murphy,
Will Deacon, Mark Rutland, Raag Jadav
Cc: linux-arm-kernel, linux-kernel
On 11/3/23 05:46, Ilkka Koskinen wrote:
> 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.
>
> Cc: stable@vger.kernel.org
> Fixes: e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")
> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> ---
> drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index 42b72042f6b3..2cc35dded007 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -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
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-03 0:16 [PATCH] perf: arm_cspmu: Reject events meant for other PMUs Ilkka Koskinen
2023-11-03 2:14 ` Besar Wicaksono
2023-11-03 6:55 ` Anshuman Khandual
@ 2023-11-03 11:37 ` Mark Rutland
2023-11-07 10:50 ` Will Deacon
2023-11-07 14:17 ` Catalin Marinas
4 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2023-11-03 11:37 UTC (permalink / raw)
To: Ilkka Koskinen, Will Deacon
Cc: Besar Wicaksono, Suzuki K Poulose, Robin Murphy, Raag Jadav,
linux-arm-kernel, linux-kernel
On Thu, Nov 02, 2023 at 05:16:54PM -0700, Ilkka Koskinen wrote:
> 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.
>
> Cc: stable@vger.kernel.org
> Fixes: e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")
> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Will, are you happy to pick this up?
Mark.
> ---
> drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index 42b72042f6b3..2cc35dded007 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -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
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-03 0:16 [PATCH] perf: arm_cspmu: Reject events meant for other PMUs Ilkka Koskinen
` (2 preceding siblings ...)
2023-11-03 11:37 ` Mark Rutland
@ 2023-11-07 10:50 ` Will Deacon
2023-11-07 14:17 ` Catalin Marinas
4 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2023-11-07 10:50 UTC (permalink / raw)
To: Ilkka Koskinen, catalin.marinas
Cc: Besar Wicaksono, Suzuki K Poulose, Robin Murphy, Mark Rutland,
Raag Jadav, linux-arm-kernel, linux-kernel
[+Catalin]
On Thu, Nov 02, 2023 at 05:16:54PM -0700, Ilkka Koskinen wrote:
> 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.
>
> Cc: stable@vger.kernel.org
> Fixes: e37dfd65731d ("perf: arm_cspmu: Add support for ARM CoreSight PMU driver")
> Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
> ---
> drivers/perf/arm_cspmu/arm_cspmu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index 42b72042f6b3..2cc35dded007 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -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;
> +
Acked-by: Will Deacon <will@kernel.org>
Catalin -- please can you pick this up as a fix in the arm64 tree?
Cheers,
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-03 0:16 [PATCH] perf: arm_cspmu: Reject events meant for other PMUs Ilkka Koskinen
` (3 preceding siblings ...)
2023-11-07 10:50 ` Will Deacon
@ 2023-11-07 14:17 ` Catalin Marinas
2023-11-07 22:12 ` Ilkka Koskinen
4 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2023-11-07 14:17 UTC (permalink / raw)
To: Besar Wicaksono, Suzuki K Poulose, Robin Murphy, Will Deacon,
Mark Rutland, Raag Jadav, Ilkka Koskinen
Cc: linux-arm-kernel, linux-kernel
On Thu, 02 Nov 2023 17:16:54 -0700, Ilkka Koskinen wrote:
> 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.
>
> [...]
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
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-07 14:17 ` Catalin Marinas
@ 2023-11-07 22:12 ` Ilkka Koskinen
2023-11-08 10:05 ` Catalin Marinas
0 siblings, 1 reply; 9+ messages in thread
From: Ilkka Koskinen @ 2023-11-07 22:12 UTC (permalink / raw)
To: Catalin Marinas
Cc: Besar Wicaksono, Suzuki K Poulose, Robin Murphy, Will Deacon,
Mark Rutland, Raag Jadav, Ilkka Koskinen, linux-arm-kernel,
linux-kernel
Hi Catalin,
On Tue, 7 Nov 2023, Catalin Marinas wrote:
> On Thu, 02 Nov 2023 17:16:54 -0700, Ilkka Koskinen wrote:
>> 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.
>>
>> [...]
>
> 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
>
> [1/1] perf: arm_cspmu: Reject events meant for other PMUs
> https://git.kernel.org/arm64/c/15c7ef7341a2
>
> --
> Catalin
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-07 22:12 ` Ilkka Koskinen
@ 2023-11-08 10:05 ` Catalin Marinas
2023-11-08 19:00 ` Ilkka Koskinen
0 siblings, 1 reply; 9+ messages in thread
From: Catalin Marinas @ 2023-11-08 10:05 UTC (permalink / raw)
To: Ilkka Koskinen
Cc: Besar Wicaksono, Suzuki K Poulose, Robin Murphy, Will Deacon,
Mark Rutland, Raag Jadav, linux-arm-kernel, linux-kernel
On Tue, Nov 07, 2023 at 02:12:58PM -0800, Ilkka Koskinen wrote:
> On Tue, 7 Nov 2023, Catalin Marinas wrote:
> > On Thu, 02 Nov 2023 17:16:54 -0700, Ilkka Koskinen wrote:
> > > 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.
> > >
> > > [...]
> >
> > 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).
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] perf: arm_cspmu: Reject events meant for other PMUs
2023-11-08 10:05 ` Catalin Marinas
@ 2023-11-08 19:00 ` Ilkka Koskinen
0 siblings, 0 replies; 9+ messages in thread
From: Ilkka Koskinen @ 2023-11-08 19:00 UTC (permalink / raw)
To: Catalin Marinas
Cc: Ilkka Koskinen, Besar Wicaksono, Suzuki K Poulose, Robin Murphy,
Will Deacon, Mark Rutland, Raag Jadav, linux-arm-kernel,
linux-kernel
On Wed, 8 Nov 2023, Catalin Marinas wrote:
> On Tue, Nov 07, 2023 at 02:12:58PM -0800, Ilkka Koskinen wrote:
>> On Tue, 7 Nov 2023, Catalin Marinas wrote:
>>> On Thu, 02 Nov 2023 17:16:54 -0700, Ilkka Koskinen wrote:
>>>> 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.
>>>>
>>>> [...]
>>>
>>> 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
>
> --
> Catalin
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-11-08 20:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-03 0:16 [PATCH] perf: arm_cspmu: Reject events meant for other PMUs Ilkka Koskinen
2023-11-03 2:14 ` Besar Wicaksono
2023-11-03 6:55 ` Anshuman Khandual
2023-11-03 11:37 ` Mark Rutland
2023-11-07 10:50 ` Will Deacon
2023-11-07 14:17 ` Catalin Marinas
2023-11-07 22:12 ` Ilkka Koskinen
2023-11-08 10:05 ` Catalin Marinas
2023-11-08 19:00 ` Ilkka Koskinen
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).