2022-12-08 10:01:55

by Anshuman Khandual

[permalink] [raw]
Subject: [PATCH V6 7/7] drivers: perf: arm_pmu: Enable branch stack sampling event

Now that all the required pieces are already in place, just enable the perf
branch stack sampling event on supported platforms, removing the gate which
blocks it unconditionally in armpmu_event_init(). Instead a quick probe can
be initiated first via arm_pmu_branch_stack_supported().

Cc: Catalin Marinas <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Anshuman Khandual <[email protected]>
---
drivers/perf/arm_pmu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 66880a4bb248..52a93b9bcbda 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -510,8 +510,7 @@ static int armpmu_event_init(struct perf_event *event)
!cpumask_test_cpu(event->cpu, &armpmu->supported_cpus))
return -ENOENT;

- /* does not support taken branch sampling */
- if (has_branch_stack(event))
+ if (has_branch_stack(event) && !arm_pmu_branch_stack_supported(armpmu))
return -EOPNOTSUPP;

if (armpmu->map_event(event) == -ENOENT)
--
2.25.1


2022-12-08 12:39:06

by James Clark

[permalink] [raw]
Subject: Re: [PATCH V6 7/7] drivers: perf: arm_pmu: Enable branch stack sampling event



On 08/12/2022 08:44, Anshuman Khandual wrote:
> Now that all the required pieces are already in place, just enable the perf
> branch stack sampling event on supported platforms, removing the gate which
> blocks it unconditionally in armpmu_event_init(). Instead a quick probe can
> be initiated first via arm_pmu_branch_stack_supported().
>

All the issues from the previous versions seem to be resolved now:

Tested-by: James Clark <[email protected]>

> Cc: Catalin Marinas <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Anshuman Khandual <[email protected]>
> ---
> drivers/perf/arm_pmu.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 66880a4bb248..52a93b9bcbda 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -510,8 +510,7 @@ static int armpmu_event_init(struct perf_event *event)
> !cpumask_test_cpu(event->cpu, &armpmu->supported_cpus))
> return -ENOENT;
>
> - /* does not support taken branch sampling */
> - if (has_branch_stack(event))
> + if (has_branch_stack(event) && !arm_pmu_branch_stack_supported(armpmu))
> return -EOPNOTSUPP;
>
> if (armpmu->map_event(event) == -ENOENT)