public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: "Michel Dänzer" <michel.daenzer@mailbox.org>,
	"Marek Olšák" <maraeo@gmail.com>
Cc: pierre-eric.pelloux-prayer@amd.com,
	amd-gfx@lists.freedesktop.org,
	"Pekka Paalanen" <pekka.paalanen@collabora.com>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	linux-kernel@vger.kernel.org,
	"Samuel Pitoiset" <samuel.pitoiset@gmail.com>,
	"Pekka Paalanen" <ppaalanen@gmail.com>,
	dri-devel@lists.freedesktop.org, kernel-dev@igalia.com,
	alexander.deucher@amd.com,
	"André Almeida" <andrealmeid@igalia.com>,
	christian.koenig@amd.com
Subject: Re: Non-robust apps and resets (was Re: [PATCH v5 1/1] drm/doc: Document DRM device reset expectations)
Date: Wed, 26 Jul 2023 09:55:08 +0200	[thread overview]
Message-ID: <3e38ebb1695d0b5df8c2ebbae37eccab2fcfdc39.camel@gmail.com> (raw)
In-Reply-To: <36bc5f30-dc72-10a3-c9cb-de9cb5400eb3@mailbox.org>

On Tue, 2023-07-25 at 19:00 +0200, Michel Dänzer wrote:
> On 7/25/23 17:05, Marek Olšák wrote:
> > On Tue, Jul 25, 2023 at 4:03 AM Michel Dänzer
> > <michel.daenzer@mailbox.org> wrote:
> > > On 7/25/23 04:55, André Almeida wrote:
> > > > Hi everyone,
> > > > 
> > > > It's not clear what we should do about non-robust OpenGL apps
> > > > after GPU resets, so I'll try to summarize the topic, show some
> > > > options and my proposal to move forward on that.
> > > > 
> > > > Em 27/06/2023 10:23, André Almeida escreveu:
> > > > > +Robustness
> > > > > +----------
> > > > > +
> > > > > +The only way to try to keep an application working after a
> > > > > reset is if it
> > > > > +complies with the robustness aspects of the graphical API
> > > > > that it is using.
> > > > > +
> > > > > +Graphical APIs provide ways to applications to deal with
> > > > > device resets. However,
> > > > > +there is no guarantee that the app will use such features
> > > > > correctly, and the
> > > > > +UMD can implement policies to close the app if it is a
> > > > > repeating offender,
> > > > > +likely in a broken loop. This is done to ensure that it does
> > > > > not keep blocking
> > > > > +the user interface from being correctly displayed. This
> > > > > should be done even if
> > > > > +the app is correct but happens to trigger some bug in the
> > > > > hardware/driver.
> > > > > +
> > > > Depending on the OpenGL version, there are different robustness
> > > > API available:
> > > > 
> > > > - OpenGL ABR extension [0]
> > > > - OpenGL KHR extension [1]
> > > > - OpenGL ES extension  [2]
> > > > 
> > > > Apps written in OpenGL should use whatever version is available
> > > > for them to make the app robust for GPU resets. That usually
> > > > means calling GetGraphicsResetStatusARB(), checking the status,
> > > > and if it encounter something different from NO_ERROR, that
> > > > means that a reset has happened, the context is considered lost
> > > > and should be recreated. If an app follow this, it will likely
> > > > succeed recovering a reset.
> > > > 
> > > > What should non-robustness apps do then? They certainly will
> > > > not be notified if a reset happens, and thus can't recover if
> > > > their context is lost. OpenGL specification does not explicitly
> > > > define what should be done in such situations[3], and I believe
> > > > that usually when the spec mandates to close the app, it would
> > > > explicitly note it.
> > > > 
> > > > However, in reality there are different types of device resets,
> > > > causing different results. A reset can be precise enough to
> > > > damage only the guilty context, and keep others alive.
> > > > 
> > > > Given that, I believe drivers have the following options:
> > > > 
> > > > a) Kill all non-robust apps after a reset. This may lead to
> > > > lose work from innocent applications.
> > > > 
> > > > b) Ignore all non-robust apps OpenGL calls. That means that
> > > > applications would still be alive, but the user interface would
> > > > be freeze. The user would need to close it manually anyway, but
> > > > in some corner cases, the app could autosave some work or the
> > > > user might be able to interact with it using some alternative
> > > > method (command line?).
> > > > 
> > > > c) Kill just the affected non-robust applications. To do that,
> > > > the driver need to be 100% sure on the impact of its resets.
> > > > 
> > > > RadeonSI currently implements a), as can be seen at [4], while
> > > > Iris implements what I think it's c)[5].
> > > > 
> > > > For the user experience point-of-view, c) is clearly the best
> > > > option, but it's the hardest to archive. There's not much gain
> > > > on having b) over a), perhaps it could be an optional env var
> > > > for such corner case applications.
> > > 
> > > I disagree on these conclusions.
> > > 
> > > c) is certainly better than a), but it's not "clearly the best"
> > > in all cases. The OpenGL UMD is not a privileged/special
> > > component and is in no position to decide whether or not the
> > > process as a whole (only some thread(s) of which may use OpenGL
> > > at all) gets to continue running or not.
> > 
> > That's not true.
> 
> Which part of what I wrote are you referring to?
> 
> 
> > I recommend that you enable b) with your driver and then hang the
> > GPU under different scenarios and see the result.
> 
> I've been doing GPU driver development for over two decades, I'm
> perfectly aware what it means. It doesn't change what I wrote above.
> 

Michel, I understand that you disagree with the proposed solutions in
this email thread but from your mails it is unclear to me what exactly
is the solution that you would actually recommend, can you please
clarify?

Thanks,
Timur


  reply	other threads:[~2023-07-26  8:04 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 13:23 [PATCH v5 1/1] drm/doc: Document DRM device reset expectations André Almeida
2023-06-27 16:09 ` Randy Dunlap
2023-06-27 17:47 ` Christian König
2023-06-27 21:17   ` André Almeida
2023-06-29 13:11     ` André Almeida
     [not found] ` <CAAxE2A4Hquz9bJNSEaUtBoJC3qbLBPYXd8i3JX9AhNUx_iUKpg@mail.gmail.com>
2023-06-27 21:31   ` André Almeida
2023-06-30 14:48 ` Sebastian Wick
2023-06-30 14:59   ` Alex Deucher
2023-06-30 15:11     ` Michel Dänzer
     [not found]       ` <CAAxE2A5C96k5ua+r938VA_+w7gHHNTdF3n8LwDb98W0Bf9wCVA@mail.gmail.com>
2023-07-03  7:12         ` Michel Dänzer
2023-07-03  8:49           ` Pekka Paalanen
2023-07-03 15:00             ` André Almeida
2023-07-04  7:42               ` Pekka Paalanen
     [not found]           ` <CAAxE2A7RGDY4eRC85CsqfszNzyKvMU2MX1wa+3HZ1hgNeAw3cQ@mail.gmail.com>
2023-07-04  2:38             ` Randy Dunlap
     [not found]               ` <CAAxE2A5UizddTTBWtuL480bDxgniVcBq7fjRGQhoC-5FG9vKpA@mail.gmail.com>
2023-07-04  2:48                 ` Randy Dunlap
2023-07-04  7:54             ` Michel Dänzer
     [not found]               ` <CAAxE2A7tNCWkL_M2YcE=RN+nqqcokgBR4hcD2sR3fGAY2t4uLg@mail.gmail.com>
2023-07-05  7:32                 ` Michel Dänzer
2023-07-05 15:53                   ` Marek Olšák
2023-06-30 15:21     ` Sebastian Wick
2023-07-25  2:55 ` Non-robust apps and resets (was Re: [PATCH v5 1/1] drm/doc: Document DRM device reset expectations) André Almeida
2023-07-25  7:02   ` Simon Ser
2023-07-25  8:03   ` Michel Dänzer
2023-07-25 13:02     ` André Almeida
2023-07-26  8:07       ` Michel Dänzer
2023-08-02  7:38         ` Marek Olšák
2023-08-02  8:34           ` Michel Dänzer
2023-07-25 15:05     ` Marek Olšák
2023-07-25 17:00       ` Michel Dänzer
2023-07-26  7:55         ` Timur Kristóf [this message]
2023-08-04 13:03 ` [PATCH v5 1/1] drm/doc: Document DRM device reset expectations Daniel Vetter
2023-08-08 12:13   ` Sebastian Wick
2023-08-08 17:03     ` Marek Olšák
2023-08-09  7:35       ` Michel Dänzer
2023-08-09 19:15         ` Marek Olšák
2023-08-10  7:33           ` Michel Dänzer

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=3e38ebb1695d0b5df8c2ebbae37eccab2fcfdc39.camel@gmail.com \
    --to=timur.kristof@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrealmeid@igalia.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maraeo@gmail.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=pekka.paalanen@collabora.com \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=ppaalanen@gmail.com \
    --cc=rdunlap@infradead.org \
    --cc=samuel.pitoiset@gmail.com \
    /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