mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>,
	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>,
	etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
		linux-kernel@vger.kernel.org, kernel-dev@igalia.com,
	Christian Gmeiner	 <cgmeiner@igalia.com>
Subject: Re: [PATCH 2/2] drm/etnaviv: Add GPU reset counters
Date: Fri, 10 Jul 2026 10:10:20 +0200	[thread overview]
Message-ID: <26876decb5bcf4df8bb01abe47f9e70a4e5d63ef.camel@pengutronix.de> (raw)
In-Reply-To: <CAH9NwWe9gDjg-6_e1KHdUQ8_Pi2sjhfDizZGzWavQAnnuymQ2g@mail.gmail.com>

Am Donnerstag, dem 09.07.2026 um 21:41 +0200 schrieb Christian Gmeiner:
> Hi Lucas,
> 
> > > The OpenGL and Vulkan robustness extensions let an application detect a
> > > GPU reset and check if its own context caused it, so the application can
> > > drop the broken context and build a new one. The kernel knows both
> > > facts, but etnaviv has no way to report them to userspace.
> > > 
> > > Add two counters and expose them through GET_PARAM: a per-GPU counter
> > > that counts every reset of that GPU, and a per-context counter that only
> > > counts the resets this context was guilty of. Userspace compares the
> > > counters with saved values: if the context counter moved the context was
> > > guilty, if only the GPU counter moved the context was an innocent
> > > victim.
> > 
> > I don't really agree with the design of exposing this through
> > GET_PARAM.
> > 
> > 
> > First it assumes that each etnaviv_file_private can only have a single
> > context, something that is true today but which I would very much like
> > to change to rid of false dependencies when the application uses
> > multiple GL contexts through the same screen. I have a rework to do
> > this in the pipe, which I didn't get around to finish, yet. While I
> > don't want to block any of your work on this rework, I also wouldn't
> > like to see UAPI land which bakes in the single context per file
> > private assumption.
> > 
> 
> Makes sense. I only picked it because msm and v3d expose their fault
> counters that way.
> 
> For v2 I have replaced the two params with a dedicated ioctl:
> 
> struct drm_etnaviv_reset_query {
>     __u32 pipe;            /* in */
>     __u32 flags;            /* in, must be 0 */
>     __u64 global_reset_counter;    /* out */
>     __u64 context_reset_counter;    /* out */
> };
> 
> flags must be zero for now and is rejected with EINVAL otherwise, so
> your multi context rework can later add a flag plus a context field to
> query a specific context.
> 
Looks good to me.

> > 
> > Second, with this design each userspace query incurs two roundtrips
> > into the kernel, as userspace needs to know both counter values to tell
> > innocent vs guilty resets apart.
> > 
> > My vote would be on adding a new ioctl to query both reset counters at
> > the same time, with a flags argument baked in, so it can be extended
> > once I manage to finish the multi context rework.
> > 
> 
> One thing to note: the global counter is per GPU core, so a context
> that uses more than one pipe still needs one query per pipe. I think
> that is fine for the robustness use case, but tell me if you would
> rather have a variant that returns all pipes at once.

I think the current design is fine. While there might be some
configurations where a context uses multiple pipes (2D GPU texture
upload or one of those chips with multiple 3D GPUs), I think that those
are sufficiently rare that we might want to deal with the additional
kernel transitions for those rather than complicating the ioctl for the
common case of a context using a single pipe.

Regards,
Lucas

  reply	other threads:[~2026-07-10  8:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-07-10  8:02   ` 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=26876decb5bcf4df8bb01abe47f9e70a4e5d63ef.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=airlied@gmail.com \
    --cc=cgmeiner@igalia.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --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®