RE: [PATCH v3 2/4] perf: arm_cspmu: Support implementation specific filters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Ilkka Koskinen <ilkka@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, June 7, 2023 3:32 PM
> To: Jonathan Corbet <corbet@xxxxxxx>; Will Deacon <will@xxxxxxxxxx>; Mark
> Rutland <mark.rutland@xxxxxxx>; Besar Wicaksono
> <bwicaksono@xxxxxxxxxx>; Suzuki K Poulose <suzuki.poulose@xxxxxxx>;
> Robin Murphy <robin.murphy@xxxxxxx>
> Cc: linux-doc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-arm-
> kernel@xxxxxxxxxxxxxxxxxxx; Ilkka Koskinen <ilkka@xxxxxxxxxxxxxxxxxxxxxx>
> Subject: [PATCH v3 2/4] perf: arm_cspmu: Support implementation specific
> filters
> 
> External email: Use caution opening links or attachments
> 
> 
> Generic filters aren't used in all the platforms. Instead, the platforms
> may use different means to filter events. Add support for implementation
> specific filters.
> 
> Signed-off-by: Ilkka Koskinen <ilkka@xxxxxxxxxxxxxxxxxxxxxx>

Reviewed-by: Besar Wicaksono <bwicaksono@xxxxxxxxxx>

> ---
>  drivers/perf/arm_cspmu/arm_cspmu.c | 8 ++++++--
>  drivers/perf/arm_cspmu/arm_cspmu.h | 4 ++++
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c
> b/drivers/perf/arm_cspmu/arm_cspmu.c
> index f8b4a149eb88..72ca4f56347c 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -122,6 +122,9 @@
> 
>  static unsigned long arm_cspmu_cpuhp_state;
> 
> +static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
> +                                   struct hw_perf_event *hwc, u32 filter);
> +
>  /*
>   * In CoreSight PMU architecture, all of the MMIO registers are 32-bit except
>   * counter register. The counter register can be implemented as 32-bit or 64-
> bit
> @@ -432,6 +435,7 @@ static int arm_cspmu_init_impl_ops(struct
> arm_cspmu *cspmu)
>         CHECK_DEFAULT_IMPL_OPS(impl_ops, event_type);
>         CHECK_DEFAULT_IMPL_OPS(impl_ops, event_filter);
>         CHECK_DEFAULT_IMPL_OPS(impl_ops, event_attr_is_visible);
> +       CHECK_DEFAULT_IMPL_OPS(impl_ops, set_ev_filter);
> 
>         return 0;
>  }
> @@ -798,7 +802,7 @@ static inline void arm_cspmu_set_event(struct
> arm_cspmu *cspmu,
>         writel(hwc->config, cspmu->base0 + offset);
>  }
> 
> -static inline void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
> +static void arm_cspmu_set_ev_filter(struct arm_cspmu *cspmu,
>                                            struct hw_perf_event *hwc,
>                                            u32 filter)
>  {
> @@ -832,7 +836,7 @@ static void arm_cspmu_start(struct perf_event
> *event, int pmu_flags)
>                 arm_cspmu_set_cc_filter(cspmu, filter);
>         } else {
>                 arm_cspmu_set_event(cspmu, hwc);
> -               arm_cspmu_set_ev_filter(cspmu, hwc, filter);
> +               cspmu->impl.ops.set_ev_filter(cspmu, hwc, filter);
>         }
> 
>         hwc->state = 0;
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h
> b/drivers/perf/arm_cspmu/arm_cspmu.h
> index 51323b175a4a..f89ae2077164 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.h
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.h
> @@ -102,6 +102,10 @@ struct arm_cspmu_impl_ops {
>         u32 (*event_type)(const struct perf_event *event);
>         /* Decode filter value from configs */
>         u32 (*event_filter)(const struct perf_event *event);
> +       /* Set event filter */
> +       void (*set_ev_filter)(struct arm_cspmu *cspmu,
> +                             struct hw_perf_event *hwc,
> +                             u32 filter);
>         /* Hide/show unsupported events */
>         umode_t (*event_attr_is_visible)(struct kobject *kobj,
>                                          struct attribute *attr, int unused);
> --
> 2.40.1





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux