From: Christian Gmeiner <christian.gmeiner@gmail.com>
To: Lucas Stach <l.stach@pengutronix.de>,
Russell King <linux+etnaviv@armlinux.org.uk>,
Christian Gmeiner <christian.gmeiner@gmail.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: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-dev@igalia.com,
Christian Gmeiner <cgmeiner@igalia.com>
Subject: [PATCH v3 0/2] drm/etnaviv: Add GPU reset counters for robustness
Date: Fri, 10 Jul 2026 14:03:41 +0200 [thread overview]
Message-ID: <20260710-etnaviv-reset-notification-v3-0-7a145c8a1d01@igalia.com> (raw)
The OpenGL robustness extensions (GL_KHR_robustness) and Vulkan
(VK_ERROR_DEVICE_LOST) let an application detect a GPU reset and check
whether its own context caused it, so it can throw away the broken
context and build a new one. etnaviv already resets the GPU after a
hang, but userspace has no way to learn about it.
This series adds two counters and a RESET_QUERY ioctl that returns both
in one call:
- a global counter that counts every reset of a GPU core.
- a context counter that only counts the resets the calling context was
guilty of.
Userspace samples both values and compares them later: if the context
counter moved the context was guilty, if only the global counter moved
the context was an innocent victim. That is all that is needed to
implement glGetGraphicsResetStatus() and Vulkan device loss.
The global counter is kept per GPU core and not per device, so a hang
on one pipe does not look like an innocent reset to contexts that only
use another pipe.
The first patch is preparation: the counters are updated from the
scheduler timeout worker, which can race with the DRM file being
closed, so struct etnaviv_file_private becomes reference counted and
every submit holds a reference.
Link to the Mesa MR implementing the userspace side:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42826
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
---
Changes in v3:
- Update the reset counters and read them back under the GPU lock, so
the RESET_QUERY ioctl cannot run between the two updates and report
an innocent reset to the guilty context (Lucas).
- Link to v2: https://lore.kernel.org/r/20260710-etnaviv-reset-notification-v2-0-90cfebcf22a2@igalia.com
Changes in v2:
- Replace the two GET_PARAM values with a dedicated RESET_QUERY ioctl
that returns both counters in one call. The ioctl has a flags field
that must be zero for now, so the query can later be extended to name
a specific context once a DRM file can hold more than one context
(Lucas).
- Make the reset counters plain u32 instead of atomics (Lucas).
- Use __u32 for the ioctl counter fields to match the internal
counters, following i915 GET_RESET_STATS.
- Link to v1: https://lore.kernel.org/r/20260709-etnaviv-reset-notification-v1-0-64c617496958@igalia.com
---
Christian Gmeiner (2):
drm/etnaviv: Reference count struct etnaviv_file_private
drm/etnaviv: Add GPU reset counters
drivers/gpu/drm/etnaviv/etnaviv_drv.c | 46 ++++++++++++++++++++++++++--
drivers/gpu/drm/etnaviv/etnaviv_drv.h | 12 ++++++++
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 5 ++-
drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 2 ++
drivers/gpu/drm/etnaviv/etnaviv_sched.c | 5 +++
include/uapi/drm/etnaviv_drm.h | 19 +++++++++++-
6 files changed, 85 insertions(+), 4 deletions(-)
---
base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda
change-id: 20260708-etnaviv-reset-notification-b037153a1aab
Best regards,
--
Christian Gmeiner <cgmeiner@igalia.com>
next reply other threads:[~2026-07-10 12:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 12:03 Christian Gmeiner [this message]
2026-07-10 12:03 ` [PATCH v3 1/2] drm/etnaviv: Reference count struct etnaviv_file_private Christian Gmeiner
2026-07-10 12:45 ` Lucas Stach
2026-07-10 12:03 ` [PATCH v3 2/2] drm/etnaviv: Add GPU reset counters Christian Gmeiner
2026-07-10 12:45 ` Lucas Stach
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=20260710-etnaviv-reset-notification-v3-0-7a145c8a1d01@igalia.com \
--to=christian.gmeiner@gmail.com \
--cc=airlied@gmail.com \
--cc=cgmeiner@igalia.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=kernel-dev@igalia.com \
--cc=l.stach@pengutronix.de \
--cc=linux+etnaviv@armlinux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--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®