mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/etnaviv: Add GPU reset counters for robustness
@ 2026-07-09 14:57 Christian Gmeiner
  2026-07-09 14:57 ` [PATCH 1/2] drm/etnaviv: Reference count struct etnaviv_file_private Christian Gmeiner
  2026-07-09 14:57 ` [PATCH 2/2] drm/etnaviv: Add GPU reset counters Christian Gmeiner
  0 siblings, 2 replies; 7+ messages in thread
From: Christian Gmeiner @ 2026-07-09 14:57 UTC (permalink / raw)
  To: Lucas Stach, Russell King, Christian Gmeiner, David Airlie,
	Simona Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: etnaviv, dri-devel, linux-kernel, kernel-dev, Christian Gmeiner

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, exposed through GET_PARAM, following the
model already used by msm and v3d:

- ETNAVIV_PARAM_GLOBAL_RESET_COUNTER counts every reset of a GPU core.
- ETNAVIV_PARAM_CONTEXT_RESET_COUNTER counts only 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>
---
Christian Gmeiner (2):
      drm/etnaviv: Reference count struct etnaviv_file_private
      drm/etnaviv: Add GPU reset counters

 drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 22 +++++++++++++++++++---
 drivers/gpu/drm/etnaviv/etnaviv_drv.h        | 12 ++++++++++++
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c |  5 ++++-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c        | 12 +++++++++++-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.h        |  6 +++++-
 drivers/gpu/drm/etnaviv/etnaviv_sched.c      |  3 +++
 include/uapi/drm/etnaviv_drm.h               |  2 ++
 7 files changed, 56 insertions(+), 6 deletions(-)
---
base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda
change-id: 20260708-etnaviv-reset-notification-b037153a1aab

Best regards,
-- 
Christian Gmeiner <cgmeiner@igalia.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-10  8:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-09 14:57 [PATCH 0/2] drm/etnaviv: Add GPU reset counters for robustness Christian Gmeiner
2026-07-09 14:57 ` [PATCH 1/2] drm/etnaviv: Reference count struct etnaviv_file_private Christian Gmeiner
2026-07-09 14:57 ` [PATCH 2/2] drm/etnaviv: Add GPU reset counters Christian Gmeiner
2026-07-09 15:48   ` Lucas Stach
2026-07-09 19:41     ` Christian Gmeiner
2026-07-10  8:10       ` Lucas Stach
2026-07-10  8:02   ` Lucas Stach

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®