Re: [PATCH 00/13] drm/msm: Add PERFCNTR_CONFIG ioctl

From: Rob Clark

Date: Wed Apr 22 2026 - 13:31:54 EST


On Tue, Apr 21, 2026 at 6:54 PM Dmitry Baryshkov
<dmitry.baryshkov@xxxxxxxxxxxxxxxx> wrote:
>
> On Mon, Apr 20, 2026 at 03:25:22PM -0700, Rob Clark wrote:
> > Add a new PERFCNTR_CONFIG ioctl, serving two functions:
> >
> > 1. Global counter collection (restricted to perfmon_capable()) using the
> > MSM_PERFCNTR_STREAM flag. Global counter sampling is, global, across
> > contexts. Only a single global counter stream is allowed at a time.
> > 2. Reserve counters for local counter collection. Local counter
> > collection is local to a cmdstream (GEM_SUBMIT), and as such is
> > allowed in all processes without additional privileges.
> >
> > The kernel enforces that counters assigned for global counter collection
> > do not conflict with counters reserved for local counter collection, and
> > visa versa. Since local counter collection is scoped to a single cmd-
> > stream, multiple UMD processes can overlap in their reserved counters.
> > But cannot conflict with global counter usage.
> >
> > In the case of local counter collection, the UMD is still responsible
> > for programming the corresponding SELect registers, and sampling the
> > counter values, from it's cmdstream. But by performing the reservation
> > step, the UMD protects itself from the kernel trying to use the same
> > SEL/counter regs for global counter collection.
> >
> > For global counter collection, the kernel programs SEL regs, and sets up
> > a timer for counter sampling. Userspace reads out the sampled values
> > from the returned perfcntr stream fd. Releasing the global perfcntr
> > stream is simply a matter of close()ing the fd.
> >
> > Since the counter sampling is done in the kernel, this prepares us for
> > not having to disable IFPC while global counter sampling is active. But
> > wiring this up will come in a later patch.
> >
> > The mesa side of this is at:
> > https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40522
> >
> > Rob Clark (13):
> > drm/msm: Remove obsolete perf infrastructure
> > drm/msm/adreno: Sync registers from mesa
> > drm/msm/registers: Sync gen_header.py from mesa
> > drm/msm/registers: Add perfcntr json
> > drm/msm: Allow CAP_PERFMON for setting SYSPROF
> > drm/msm: Add a6xx+ perfcntr tables
> > drm/msm: Add sysprof accessors
> > drm/msm/a6xx: Add yield & flush helper
> > drm/msm: Add per-context perfcntr state
> > drm/msm: Add basic perfcntr infrastructure
> > drm/msm/a6xx+: Add support to configure perfcntrs
> > drm/msm/a8xx: Add perfcntr flush sequence
> > drm/msm: Add PERFCNTR_CONFIG ioctl
> >
> The series doesn't apply to linux-next. Please switch to b4 and use b4
> --edit-deps to specify dependencies.

fwiw 20260411150312.257937-1-robin.clark@xxxxxxxxxxxxxxxx is the thing
missing from linux-next

BR,
-R