From: Steven Price <steven.price@arm.com>
To: Lukas Zapolskas <lukas.zapolskas@arm.com>,
Daniel Almeida <daniel.almeida@collabora.com>,
Alice Ryhl <aliceryhl@google.com>,
Boris Brezillon <boris.brezillon@collabora.com>,
Liviu Dudau <liviu.dudau@arm.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
nd@arm.com, Mihail Atanassov <mihail.atanassov@arm.com>
Subject: Re: [PATCH v7 1/8] drm/panthor: Add performance counter uAPI
Date: Mon, 23 Nov 2026 14:30:51 +0000 [thread overview]
Message-ID: <9906d872-8e9c-46cf-b365-9f2d6ff0d61d@arm.com> (raw)
In-Reply-To: <20261011-panthor-performance-counters-v7-1-12c32495062f@arm.com>
On 11/10/2026 18:36, Lukas Zapolskas wrote:
> This patch extends the DEV_QUERY ioctl to return information about the
> performance counter setup for userspace, and introduces the new
> DRM_PANTHOR_PERF_SESSION ioctls in order to allow for the sampling of
> performance counters.
>
> The new design is inspired by the perf aux ringbuffer [0], with the
> insert and extract indices being mapped to userspace, allowing
> multiple samples to be exposed at any given time. The buffer is
> annotated to include sample metadata and block metadata inline with
> the elements they describe.
>
> Userspace is responsible for passing in resources for samples to be
> exposed, including the event file descriptor for notification of new
> sample availability, the ringbuffer BO to store samples, and the
> control BO.
>
> [0]: https://docs.kernel.org/userspace-api/perf_ring_buffer.html
>
> Co-developed-by: Mihail Atanassov <mihail.atanassov@arm.com>
> Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
> Signed-off-by: Lukas Zapolskas <lukas.zapolskas@arm.com>
I think we need a little more documentation on how these new ioctls
work. Ideally you shouldn't need to dig through the code to figure this out.
E.g. DRM_PANTHOR_PERF_SESSION_CREATE apparently returns a session handle
- but that's not mentioned anywhere here. There's also no information on
the range that session handles can take. Again digging through the code
it appears that <0 is an error but >=0 is valid. Although digging harder
it seems like in the current implementation only 0 is actually returned?
You also have a shared "control BO" but there's no information about
memory barriers. It would be good to document what user space is
required to do between reading the insert_idx, reading the samples and
writing extract_idx.
One more minor point below...
> ---
> include/uapi/drm/panthor_drm.h | 370 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 370 insertions(+)
>
> diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
> index a2ff0f4ec691..e45f75b76245 100644
> --- a/include/uapi/drm/panthor_drm.h
> +++ b/include/uapi/drm/panthor_drm.h
[...]
> +/**
> + * struct drm_panthor_perf_session_create - Arguments passed to DRM_PANTHOR_PERF_SESSION_CREATE.
> + */
> +struct drm_panthor_perf_session_create {
> + /**
> + * @block_set: Set of performance counter blocks, member of
> + * enum drm_panthor_perf_counter_set.
> + *
> + * This is a global configuration and only one set can be active at a time. If
> + * another client has already requested a counter set, any further requests
> + * for a different counter set will fail and return an -EBUSY.
> + *
> + * If the requested set does not exist, the request will fail and return an -EINVAL.
> + *
> + * Some sets have additional requirements to be enabled, and the setup request will
> + * fail with an -EACCES if these requirements are not satisfied.
> + */
> + __u8 block_set;
> +
> + /** @pad: MBZ. */
> + __u8 pad[7];
> +
> + /** @fd: eventfd for signalling the availability of a new sample. */
> + __u32 fd;
> +
> + /** @ringbuf_handle: Handle to the BO to write perf counter sample to. */
> + __u32 ringbuf_handle;
> +
> + /**
> + * @control_handle: Handle to the BO containing a contiguous 16 byte range, used for the
> + * insert and extract indices for the ringbuffer.
> + */
> + __u32 control_handle;
> +
> + /**
> + * @sample_slots: The number of slots available in the userspace-provided BO. Must be
> + * a power of 2.
> + *
> + * If sample_slots * sample_size does not match the BO size, the setup request will fail.
Actually the BO size must be PFN_ALIGN(sample_slots * sample_size) -
i.e. rounded up to the nearest page size. I also wonder if this will
come back to bite us if we ever have to deal with multiple page sizes.
Is there a reason to enforce exact sizing rather than just 'big enough'?
Thanks,
Steve
next prev parent reply other threads:[~2026-11-23 14:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 17:36 [PATCH v7 0/8] drm/panthor: Performance counter implementation with single manual client support Lukas Zapolskas
2026-10-11 17:36 ` [PATCH v7 1/8] drm/panthor: Add performance counter uAPI Lukas Zapolskas
2026-10-22 12:15 ` Liviu Dudau
2026-11-23 14:30 ` Steven Price [this message]
2026-10-11 17:36 ` [PATCH v7 2/8] drm/panthor: Add register definitions for perf Lukas Zapolskas
2026-10-22 12:16 ` Liviu Dudau
2026-10-11 17:36 ` [PATCH v7 3/8] drm/panthor: Add DEV_QUERY.PERF_INFO handling Lukas Zapolskas
2026-10-23 13:54 ` Liviu Dudau
2026-10-11 17:36 ` [PATCH v7 4/8] drm/panthor: Add panthor perf initialization and termination Lukas Zapolskas
2026-10-23 13:58 ` Liviu Dudau
2026-10-11 17:36 ` [PATCH v7 5/8] drm/panthor: Introduce sampling sessions to handle userspace clients Lukas Zapolskas
2026-10-23 14:24 ` Liviu Dudau
2026-11-04 17:39 ` Ashley Smith
2026-11-23 15:11 ` Steven Price
2026-10-11 17:36 ` [PATCH v7 6/8] drm/panthor: Implement sample handling Lukas Zapolskas
2026-10-13 4:52 ` kernel test robot
2026-10-23 14:30 ` Liviu Dudau
2026-11-23 15:11 ` Steven Price
2026-10-11 17:36 ` [PATCH v7 7/8] drm/panthor: Add suspend, resume and reset handling Lukas Zapolskas
2026-10-23 14:32 ` Liviu Dudau
2026-10-11 17:36 ` [PATCH v7 8/8] drm/panthor: Expose the panthor perf ioctls Lukas Zapolskas
2026-10-23 14:33 ` Liviu Dudau
2026-11-23 15:11 ` Steven Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9906d872-8e9c-46cf-b365-9f2d6ff0d61d@arm.com \
--to=steven.price@arm.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=boris.brezillon@collabora.com \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=lukas.zapolskas@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mihail.atanassov@arm.com \
--cc=mripard@kernel.org \
--cc=nd@arm.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®