Re: [PATCH 09/13] drm/msm: Add per-context perfcntr state

From: Dmitry Baryshkov

Date: Tue Apr 21 2026 - 23:41:06 EST


On Mon, Apr 20, 2026 at 03:25:31PM -0700, Rob Clark wrote:
> The upcoming PERFCNTR_CONFIG ioctl will allow for both global counter
> collection, and per-context counter reservation for local (ie. within
> a single GEM_SUBMIT ioctl) counter collection.
>
> Any number of contexts can reserve the same counters, but we will need
> to ensure that counters reserved for local counter collection do not
> conflict with counters used for global counter collection.
>
> So add tracking for per-context local counter reservations.
>
> Signed-off-by: Rob Clark <robin.clark@xxxxxxxxxxxxxxxx>

>
> +struct msm_perfcntr_context_state {
> + /**
> + * @reserved_counters:
> + *
> + * The number of reserved counters indexed by perfcntr group.
> + */
> + unsigned reserved_counters[];
> +};

Fails here (Debian, trixie, gcc 14.2) with:

In file included from drivers/gpu/drm/msm/generated/a6xx_perfcntrs.json.c:7:
./drivers/gpu/drm/msm/msm_perfcntr.h:130:18: error: flexible array member in a struct with no named members
130 | unsigned reserved_counters[];
| ^~~~~~~~~~~~~~~~~

> +
> extern const struct msm_perfcntr_group a6xx_perfcntr_groups[];
> extern const unsigned a6xx_num_perfcntr_groups;
>

--
With best wishes
Dmitry