From: "Timur Kristóf" <timur.kristof@gmail.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: "Christian König" <christian.koenig@amd.com>,
"André Almeida" <andrealmeid@igalia.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
"amd-gfx list" <amd-gfx@lists.freedesktop.org>,
linux-kernel@vger.kernel.org, "Pelloux-Prayer,
Pierre-Eric" <pierre-eric.pelloux-prayer@amd.com>,
"Marek Olšák" <maraeo@gmail.com>,
michel.daenzer@mailbox.org,
"Samuel Pitoiset" <samuel.pitoiset@gmail.com>,
kernel-dev@igalia.com,
"Bas Nieuwenhuizen" <bas@basnieuwenhuizen.nl>,
"Deucher, Alexander" <alexander.deucher@amd.com>
Subject: Re: [RFC PATCH 0/1] Add AMDGPU_INFO_GUILTY_APP ioctl
Date: Tue, 02 May 2023 17:22:46 +0200 [thread overview]
Message-ID: <c54414482b685af0991a6b095cbfb7534d998afc.camel@gmail.com> (raw)
In-Reply-To: <CADnq5_NHtFbwT=x8u7GYc4ESL_HVFzjgtOd3AnVFBYMrjZq55w@mail.gmail.com>
On Tue, 2023-05-02 at 09:45 -0400, Alex Deucher wrote:
> On Tue, May 2, 2023 at 9:35 AM Timur Kristóf
> <timur.kristof@gmail.com> wrote:
> >
> > Hi,
> >
> > On Tue, 2023-05-02 at 13:14 +0200, Christian König wrote:
> > > >
> > > > Christian König <christian.koenig@amd.com> ezt írta (időpont:
> > > > 2023.
> > > > máj. 2., Ke 9:59):
> > > >
> > > > > Am 02.05.23 um 03:26 schrieb André Almeida:
> > > > > > Em 01/05/2023 16:24, Alex Deucher escreveu:
> > > > > >> On Mon, May 1, 2023 at 2:58 PM André Almeida
> > > > > <andrealmeid@igalia.com>
> > > > > >> wrote:
> > > > > >>>
> > > > > >>> I know that devcoredump is also used for this kind of
> > > > > information,
> > > > > >>> but I believe
> > > > > >>> that using an IOCTL is better for interfacing Mesa +
> > > > > Linux
> > > > > rather
> > > > > >>> than parsing
> > > > > >>> a file that its contents are subjected to be changed.
> > > > > >>
> > > > > >> Can you elaborate a bit on that? Isn't the whole point
> > > > > of
> > > > > devcoredump
> > > > > >> to store this sort of information?
> > > > > >>
> > > > > >
> > > > > > I think that devcoredump is something that you could use
> > > > > to
> > > > > submit to
> > > > > > a bug report as it is, and then people can read/parse as
> > > > > they
> > > > > want,
> > > > > > not as an interface to be read by Mesa... I'm not sure
> > > > > that
> > > > > it's
> > > > > > something that I would call an API. But I might be wrong,
> > > > > if
> > > > > you know
> > > > > > something that uses that as an API please share.
> > > > > >
> > > > > > Anyway, relying on that for Mesa would mean that we would
> > > > > need
> > > > > to
> > > > > > ensure stability for the file content and format, making
> > > > > it
> > > > > less
> > > > > > flexible to modify in the future and probe to bugs, while
> > > > > the
> > > > > IOCTL is
> > > > > > well defined and extensible. Maybe the dump from Mesa +
> > > > > devcoredump
> > > > > > could be complementary information to a bug report.
> > > > >
> > > > > Neither using an IOCTL nor devcoredump is a good approach
> > > > > for
> > > > > this since
> > > > > the values read from the hw register are completely
> > > > > unreliable.
> > > > > They
> > > > > could not be available because of GFXOFF or they could be
> > > > > overwritten or
> > > > > not even updated by the CP in the first place because of a
> > > > > hang
> > > > > etc....
> > > > >
> > > > > If you want to track progress inside an IB what you do
> > > > > instead
> > > > > is to
> > > > > insert intermediate fence write commands into the IB. E.g.
> > > > > something
> > > > > like write value X to location Y when this executes.
> > > > >
> > > > > This way you can not only track how far the IB processed,
> > > > > but
> > > > > also in
> > > > > which stages of processing we where when the hang occurred.
> > > > > E.g.
> > > > > End of
> > > > > Pipe, End of Shaders, specific shader stages etc...
> > > > >
> > > > >
> > > >
> > > > Currently our biggest challenge in the userspace driver is
> > > > debugging "random" GPU hangs. We have many dozens of bug
> > > > reports
> > > > from users which are like: "play the game for X hours and it
> > > > will
> > > > eventually hang the GPU". With the currently available tools,
> > > > it is
> > > > impossible for us to tackle these issues. André's proposal
> > > > would be
> > > > a step in improving this situation.
> > > >
> > > > We already do something like what you suggest, but there are
> > > > multiple problems with that approach:
> > > >
> > > > 1. we can only submit 1 command buffer at a time because we
> > > > won't
> > > > know which IB hanged
> > > > 2. we can't use chaining because we don't know where in the IB
> > > > it
> > > > hanged
> > > > 3. it needs userspace to insert (a lot of) extra commands such
> > > > as
> > > > extra synchronization and memory writes
> > > > 4. It doesn't work when GPU recovery is enabled because the
> > > > information is already gone when we detect the hang
> > > >
> > > You can still submit multiple IBs and even chain them. All you
> > > need
> > > to do is to insert into each IB commands which write to an extra
> > > memory location with the IB executed and the position inside the
> > > IB.
> > >
> > > The write data command allows to write as many dw as you want
> > > (up to
> > > multiple kb). The only potential problem is when you submit the
> > > same
> > > IB multiple times.
> > >
> > > And yes that is of course quite some extra overhead, but I think
> > > that should be manageable.
> >
> > Thanks, this sounds doable and would solve the limitation of how
> > many
> > IBs are submitted at a time. However it doesn't address the problem
> > that enabling this sort of debugging will still have extra
> > overhead.
> >
> > I don't mean the overhead from writing a couple of dwords for the
> > trace, but rather, the overhead from needing to emit flushes or top
> > of
> > pipe events or whatever else we need so that we can tell which
> > command
> > hung the GPU.
> >
> > >
> > > > In my opinion, the correct solution to those problems would be
> > > > if
> > > > the kernel could give userspace the necessary information about
> > > > a
> > > > GPU hang before a GPU reset.
> > > >
> > > The fundamental problem here is that the kernel doesn't have
> > > that
> > > information either. We know which IB timed out and can
> > > potentially do
> > > a devcoredump when that happens, but that's it.
> >
> >
> > Is it really not possible to know such a fundamental thing as what
> > the
> > GPU was doing when it hung? How are we supposed to do any kind of
> > debugging without knowing that?
> >
> > I wonder what AMD's Windows driver team is doing with this problem,
> > surely they must have better tools to deal with GPU hangs?
>
> For better or worse, most teams internally rely on scan dumps via
> JTAG
> which sort of limits the usefulness outside of AMD, but also gives
> you
> the exact state of the hardware when it's hung so the hardware teams
> prefer it.
>
How does this approach scale? It's not something we can ask users to
do, and even if all of us in the radv team had a JTAG device, we
wouldn't be able to play every game that users experience random hangs
with.
next prev parent reply other threads:[~2023-05-02 15:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-01 18:57 André Almeida
2023-05-01 18:57 ` [RFC PATCH 1/1] drm/amdgpu: Add interface to dump guilty IB on GPU hang André Almeida
2023-05-01 19:27 ` Alex Deucher
2023-05-01 19:24 ` [RFC PATCH 0/1] Add AMDGPU_INFO_GUILTY_APP ioctl Alex Deucher
2023-05-02 1:26 ` André Almeida
2023-05-02 7:59 ` Christian König
[not found] ` <CAFF-SiV0=WNmRW-D9uYUuj68Zq0APxtGLya9KR6FfZ7v0Zf2RQ@mail.gmail.com>
2023-05-02 9:30 ` Bas Nieuwenhuizen
[not found] ` <fcca2934-a556-797c-535d-a66fc67bbe30@amd.com>
2023-05-02 13:34 ` Timur Kristóf
2023-05-02 13:45 ` Alex Deucher
2023-05-02 15:22 ` Timur Kristóf [this message]
2023-05-02 18:41 ` Alex Deucher
2023-05-03 7:59 ` Christian König
2023-05-03 15:08 ` Felix Kuehling
2023-05-03 15:23 ` Christian König
[not found] ` <CAAxE2A7wzrt9m0LifB=vPFr7aEtwyh9zzDDh9DkZJux2A4kKqw@mail.gmail.com>
2023-05-03 18:52 ` André Almeida
2023-05-03 17:43 ` Timur Kristóf
2023-05-03 19:14 ` André Almeida
2023-05-04 6:43 ` Christian König
2023-05-02 7:48 ` Christian König
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=c54414482b685af0991a6b095cbfb7534d998afc.camel@gmail.com \
--to=timur.kristof@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrealmeid@igalia.com \
--cc=bas@basnieuwenhuizen.nl \
--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=pierre-eric.pelloux-prayer@amd.com \
--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
all inboxes | Powered by JetHome®