[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0530f1e5-7716-413d-a7cb-9378aa120c18@arm.com>
Date: Wed, 16 Aug 2023 15:05:15 +0100
From: Suzuki K Poulose <suzuki.poulose@....com>
To: Ilkka Koskinen <ilkka@...amperecomputing.com>,
Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Besar Wicaksono <bwicaksono@...dia.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Mark Rutland <mark.rutland@....com>,
Jonathan Corbet <corbet@....net>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCH v6 3/4] perf: arm_cspmu: Support implementation specific
validation
On 15/08/2023 07:35, Ilkka Koskinen wrote:
> Some platforms may use e.g. different filtering mechanism and, thus,
> may need different way to validate the events and group.
>
> Signed-off-by: Ilkka Koskinen <ilkka@...amperecomputing.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@....com>
> ---
> drivers/perf/arm_cspmu/arm_cspmu.c | 8 +++++++-
> drivers/perf/arm_cspmu/arm_cspmu.h | 3 +++
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
> index 94f6856ec786..585ce96ac03f 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.c
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.c
> @@ -572,7 +572,7 @@ static void arm_cspmu_disable(struct pmu *pmu)
> static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
> struct perf_event *event)
> {
> - int idx;
> + int idx, ret;
> struct arm_cspmu *cspmu = to_arm_cspmu(event->pmu);
>
> if (supports_cycle_counter(cspmu)) {
> @@ -606,6 +606,12 @@ static int arm_cspmu_get_event_idx(struct arm_cspmu_hw_events *hw_events,
> if (idx >= cspmu->num_logical_ctrs)
> return -EAGAIN;
>
> + if (cspmu->impl.ops.validate_event) {
> + ret = cspmu->impl.ops.validate_event(cspmu, event);
> + if (ret)
> + return ret;
> + }
> +
> set_bit(idx, hw_events->used_ctrs);
>
> return idx;
> diff --git a/drivers/perf/arm_cspmu/arm_cspmu.h b/drivers/perf/arm_cspmu/arm_cspmu.h
> index 274ca3d10578..05577f74b8a0 100644
> --- a/drivers/perf/arm_cspmu/arm_cspmu.h
> +++ b/drivers/perf/arm_cspmu/arm_cspmu.h
> @@ -107,6 +107,9 @@ struct arm_cspmu_impl_ops {
> /* Set event filter */
> void (*set_ev_filter)(struct arm_cspmu *cspmu,
> struct hw_perf_event *hwc, u32 filter);
> + /* Implementation specific event validation */
> + int (*validate_event)(struct arm_cspmu *cspmu,
> + struct perf_event *event);
> /* Hide/show unsupported events */
> umode_t (*event_attr_is_visible)(struct kobject *kobj,
> struct attribute *attr, int unused);
Powered by blists - more mailing lists