2024-02-27 17:06:46

by Vadim Shakirov

[permalink] [raw]
Subject: [PATCH v2,RESEND 0/2] drivers: perf: fix crash with the legacy riscv driver

This series fix crash with the legacy riscv driver when configs:
CONFIG_RISCV_PMU_LEGACY=y and CONFIG_RISCV_PMU_SBI=n and you try
to perf record

Vadim Shakirov (2):
drivers: perf: added capabilities for legacy PMU
drivers: perf: ctr_get_width function for legacy is not defined

drivers/perf/riscv_pmu.c | 18 +++++-------------
drivers/perf/riscv_pmu_legacy.c | 10 +++++++++-
2 files changed, 14 insertions(+), 14 deletions(-)

--
2.34.1



2024-02-27 18:20:29

by Vadim Shakirov

[permalink] [raw]
Subject: [PATCH v2,RESEND 1/2] drivers: perf: added capabilities for legacy PMU

Added the PERF_PMU_CAP_NO_INTERRUPT flag because the legacy pmu driver
does not provide sampling capabilities

Added the PERF_PMU_CAP_NO_EXCLUDE flag because the legacy pmu driver
does not provide the ability to disable counter incrementation in
different privilege modes

Suggested-by: Atish Patra <[email protected]>
Signed-off-by: Vadim Shakirov <[email protected]>
---
drivers/perf/riscv_pmu_legacy.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c
index 79fdd667922e..a85fc9a15f03 100644
--- a/drivers/perf/riscv_pmu_legacy.c
+++ b/drivers/perf/riscv_pmu_legacy.c
@@ -117,6 +117,8 @@ static void pmu_legacy_init(struct riscv_pmu *pmu)
pmu->event_mapped = pmu_legacy_event_mapped;
pmu->event_unmapped = pmu_legacy_event_unmapped;
pmu->csr_index = pmu_legacy_csr_index;
+ pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
+ pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;

perf_pmu_register(&pmu->pmu, "cpu", PERF_TYPE_RAW);
}
--
2.34.1


2024-02-27 19:29:15

by Alexandre Ghiti

[permalink] [raw]
Subject: Re: [PATCH v2,RESEND 1/2] drivers: perf: added capabilities for legacy PMU

On 27/02/2024 18:00, Vadim Shakirov wrote:
> Added the PERF_PMU_CAP_NO_INTERRUPT flag because the legacy pmu driver
> does not provide sampling capabilities
>
> Added the PERF_PMU_CAP_NO_EXCLUDE flag because the legacy pmu driver
> does not provide the ability to disable counter incrementation in
> different privilege modes
>
> Suggested-by: Atish Patra <[email protected]>
> Signed-off-by: Vadim Shakirov <[email protected]>
> ---
> drivers/perf/riscv_pmu_legacy.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c
> index 79fdd667922e..a85fc9a15f03 100644
> --- a/drivers/perf/riscv_pmu_legacy.c
> +++ b/drivers/perf/riscv_pmu_legacy.c
> @@ -117,6 +117,8 @@ static void pmu_legacy_init(struct riscv_pmu *pmu)
> pmu->event_mapped = pmu_legacy_event_mapped;
> pmu->event_unmapped = pmu_legacy_event_unmapped;
> pmu->csr_index = pmu_legacy_csr_index;
> + pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
> + pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
>
> perf_pmu_register(&pmu->pmu, "cpu", PERF_TYPE_RAW);
> }


I see here that Atish added its RB:
https://lore.kernel.org/linux-riscv/CAOnJCUJ-eE+zbXH0yBX_QBK2ep779q=wNCSrc+BJfzUb+zBCaw@mail.gmail.com/

So I add it here (hopefully b4 won't complain, I don't know):

Reviewed-by: Atish Patra <[email protected]>

And I'd say the fixes tag for this one is:

Fixes: 9b3e150e310e ("RISC-V: Add a simple platform driver for RISC-V
legacy perf")

Thanks,

Alex


2024-02-27 19:38:54

by Alexandre Ghiti

[permalink] [raw]
Subject: Re: [PATCH v2,RESEND 1/2] drivers: perf: added capabilities for legacy PMU


On 27/02/2024 20:26, Alexandre Ghiti wrote:
> On 27/02/2024 18:00, Vadim Shakirov wrote:
>> Added the PERF_PMU_CAP_NO_INTERRUPT flag because the legacy pmu driver
>> does not provide sampling capabilities
>>
>> Added the PERF_PMU_CAP_NO_EXCLUDE flag because the legacy pmu driver
>> does not provide the ability to disable counter incrementation in
>> different privilege modes
>>
>> Suggested-by: Atish Patra <[email protected]>
>> Signed-off-by: Vadim Shakirov <[email protected]>
>> ---
>>   drivers/perf/riscv_pmu_legacy.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/perf/riscv_pmu_legacy.c
>> b/drivers/perf/riscv_pmu_legacy.c
>> index 79fdd667922e..a85fc9a15f03 100644
>> --- a/drivers/perf/riscv_pmu_legacy.c
>> +++ b/drivers/perf/riscv_pmu_legacy.c
>> @@ -117,6 +117,8 @@ static void pmu_legacy_init(struct riscv_pmu *pmu)
>>       pmu->event_mapped = pmu_legacy_event_mapped;
>>       pmu->event_unmapped = pmu_legacy_event_unmapped;
>>       pmu->csr_index = pmu_legacy_csr_index;
>> +    pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
>> +    pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
>>         perf_pmu_register(&pmu->pmu, "cpu", PERF_TYPE_RAW);
>>   }
>
>
> I see here that Atish added its RB:
> https://lore.kernel.org/linux-riscv/CAOnJCUJ-eE+zbXH0yBX_QBK2ep779q=wNCSrc+BJfzUb+zBCaw@mail.gmail.com/
>
> So I add it here (hopefully b4 won't complain, I don't know):


FTR, b4 indeed complains:

NOTE: some trailers ignored due to from/email mismatches:
    ! Trailer: Reviewed-by: Atish Patra <[email protected]>
     Msg From: Alexandre Ghiti <[email protected]>


>
> Reviewed-by: Atish Patra <[email protected]>
>
> And I'd say the fixes tag for this one is:
>
> Fixes: 9b3e150e310e ("RISC-V: Add a simple platform driver for RISC-V
> legacy perf")
>
> Thanks,
>
> Alex
>
>
> _______________________________________________
> linux-riscv mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-riscv

2024-02-27 20:57:31

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v2,RESEND 1/2] drivers: perf: added capabilities for legacy PMU

On Tue, 27 Feb 2024 11:26:20 PST (-0800), [email protected] wrote:
> On 27/02/2024 18:00, Vadim Shakirov wrote:
>> Added the PERF_PMU_CAP_NO_INTERRUPT flag because the legacy pmu driver
>> does not provide sampling capabilities
>>
>> Added the PERF_PMU_CAP_NO_EXCLUDE flag because the legacy pmu driver
>> does not provide the ability to disable counter incrementation in
>> different privilege modes
>>
>> Suggested-by: Atish Patra <[email protected]>
>> Signed-off-by: Vadim Shakirov <[email protected]>
>> ---
>> drivers/perf/riscv_pmu_legacy.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c
>> index 79fdd667922e..a85fc9a15f03 100644
>> --- a/drivers/perf/riscv_pmu_legacy.c
>> +++ b/drivers/perf/riscv_pmu_legacy.c
>> @@ -117,6 +117,8 @@ static void pmu_legacy_init(struct riscv_pmu *pmu)
>> pmu->event_mapped = pmu_legacy_event_mapped;
>> pmu->event_unmapped = pmu_legacy_event_unmapped;
>> pmu->csr_index = pmu_legacy_csr_index;
>> + pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
>> + pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
>>
>> perf_pmu_register(&pmu->pmu, "cpu", PERF_TYPE_RAW);
>> }
>
>
> I see here that Atish added its RB:
> https://lore.kernel.org/linux-riscv/CAOnJCUJ-eE+zbXH0yBX_QBK2ep779q=wNCSrc+BJfzUb+zBCaw@mail.gmail.com/
>
> So I add it here (hopefully b4 won't complain, I don't know):
>
> Reviewed-by: Atish Patra <[email protected]>

It says

NOTE: some trailers ignored due to from/email mismatches:
! Trailer: Reviewed-by: Atish Patra <[email protected]>
Msg From: Alexandre Ghiti <[email protected]>
NOTE: Rerun with -S to apply them anyway

Should show up on fixes in a bit, assuming it gets through the testing.

>
> And I'd say the fixes tag for this one is:
>
> Fixes: 9b3e150e310e ("RISC-V: Add a simple platform driver for RISC-V
> legacy perf")
>
> Thanks,
>
> Alex

Subject: Re: [PATCH v2,RESEND 0/2] drivers: perf: fix crash with the legacy riscv driver

Hello:

This series was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:

On Tue, 27 Feb 2024 20:00:00 +0300 you wrote:
> This series fix crash with the legacy riscv driver when configs:
> CONFIG_RISCV_PMU_LEGACY=y and CONFIG_RISCV_PMU_SBI=n and you try
> to perf record
>
> Vadim Shakirov (2):
> drivers: perf: added capabilities for legacy PMU
> drivers: perf: ctr_get_width function for legacy is not defined
>
> [...]

Here is the summary with links:
- [v2,RESEND,1/2] drivers: perf: added capabilities for legacy PMU
https://git.kernel.org/riscv/c/65730fe8f4fb
- [v2,RESEND,2/2] drivers: perf: ctr_get_width function for legacy is not defined
https://git.kernel.org/riscv/c/682dc133f83e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html