From: Raag Jadav <raag.jadav@intel.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: "André Almeida" <andrealmeid@igalia.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel-dev@igalia.com, amd-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
siqueira@igalia.com, airlied@gmail.com, simona@ffwll.ch,
rodrigo.vivi@intel.com, jani.nikula@linux.intel.com,
"Xaver Hugl" <xaver.hugl@kde.org>
Subject: Re: [PATCH 2/2] drm/amdgpu: Make use of drm_wedge_app_info
Date: Tue, 11 Mar 2025 19:13:15 +0200 [thread overview]
Message-ID: <Z9BvK55_Nim54eOu@black.fi.intel.com> (raw)
In-Reply-To: <CADnq5_PbZUoyxyqweqa=kUNsSXanjY=5mUJrn03aY3je6rER+w@mail.gmail.com>
On Mon, Mar 10, 2025 at 06:03:27PM -0400, Alex Deucher wrote:
> On Mon, Mar 10, 2025 at 5:54 PM André Almeida <andrealmeid@igalia.com> wrote:
> >
> > Em 01/03/2025 03:04, Raag Jadav escreveu:
> > > On Fri, Feb 28, 2025 at 06:49:43PM -0300, André Almeida wrote:
> > >> Hi Raag,
> > >>
> > >> On 2/28/25 11:58, Raag Jadav wrote:
> > >>> On Fri, Feb 28, 2025 at 09:13:53AM -0300, André Almeida wrote:
> > >>>> To notify userspace about which app (if any) made the device get in a
> > >>>> wedge state, make use of drm_wedge_app_info parameter, filling it with
> > >>>> the app PID and name.
> > >>>>
> > >>>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> > >>>> ---
> > >>>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++--
> > >>>> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 6 +++++-
> > >>>> 2 files changed, 22 insertions(+), 3 deletions(-)
> > >>>>
> > >>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > >>>> index 00b9b87dafd8..e06adf6f34fd 100644
> > >>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > >>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > >>>> @@ -6123,8 +6123,23 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
> > >>>> atomic_set(&adev->reset_domain->reset_res, r);
> > >>>> - if (!r)
> > >>>> - drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL);
> > >>>> + if (!r) {
> > >>>> + struct drm_wedge_app_info aux, *info = NULL;
> > >>>> +
> > >>>> + if (job) {
> > >>>> + struct amdgpu_task_info *ti;
> > >>>> +
> > >>>> + ti = amdgpu_vm_get_task_info_pasid(adev, job->pasid);
> > >>>> + if (ti) {
> > >>>> + aux.pid = ti->pid;
> > >>>> + aux.comm = ti->process_name;
> > >>>> + info = &aux;
> > >>>> + amdgpu_vm_put_task_info(ti);
> > >>>> + }
> > >>>> + }
> > >>> Is this guaranteed to be guilty app and not some scheduled worker?
> > >>
> > >> This is how amdgpu decides which app is the guilty one earlier in the code
> > >> as in the print:
> > >>
> > >> ti = amdgpu_vm_get_task_info_pasid(ring->adev, job->pasid);
> > >>
> > >> "Process information: process %s pid %d thread %s pid %d\n"
> > >>
> > >> So I think it's consistent with what the driver thinks it's the guilty
> > >> process.
> > >
> > > Sure, but with something like app_info we're kind of hinting to userspace
> > > that an application was _indeed_ involved with reset. Is that also guaranteed?
> > >
> > > Is it possible that an application needlessly suffers from a false positive
> > > scenario (reset due to other factors)?
> > >
> >
> > I asked Alex Deucher in IRC about that and yes, there's a chance that
> > this is a false positive. However, for the majority of cases this is the
> > right app that caused the hang. This is what amdgpu is doing for GL
> > robustness as well and devcoredump, so it's very consistent with how
> > amdgpu deals with this scenario even if the mechanism is still not perfect.
>
> It's usually the guilty one, but it's not guaranteed. For example,
> say you have a ROCm user queue and a gfx job submitted to a kernel
> queue. The actual guilty job may be the ROCm user queue, but the
> driver may not detect that the ROCm queue was hung until some other
> event (e.g., memory pressure). However, the timer for the gfx job may
> timeout before that happens on the ROCm queue so in that case the gfx
> job would be incorrectly considered guilty.
So it boils down to what are the chances of that happening and whether
it's significant enough to open the door for API abuse.
Considering this is amd specific accuracy, it's still an open question
how other drivers are/will be managing it.
Raag
next prev parent reply other threads:[~2025-03-11 17:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 12:13 [PATCH 0/2] drm: Create an app info option for wedge events André Almeida
2025-02-28 12:13 ` [PATCH 1/2] " André Almeida
2025-02-28 14:20 ` Raag Jadav
2025-02-28 21:54 ` André Almeida
2025-03-01 5:53 ` Raag Jadav
2025-03-10 21:27 ` André Almeida
2025-03-11 17:09 ` Raag Jadav
2025-03-12 10:06 ` Raag Jadav
2025-03-12 21:59 ` André Almeida
2025-03-13 11:07 ` Raag Jadav
2025-02-28 12:13 ` [PATCH 2/2] drm/amdgpu: Make use of drm_wedge_app_info André Almeida
2025-02-28 14:58 ` Raag Jadav
2025-02-28 21:49 ` André Almeida
2025-03-01 6:04 ` Raag Jadav
2025-03-10 21:53 ` André Almeida
2025-03-10 22:03 ` Alex Deucher
2025-03-11 17:13 ` Raag Jadav [this message]
2025-03-12 8:25 ` Christian König
2025-03-12 9:13 ` Raag Jadav
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=Z9BvK55_Nim54eOu@black.fi.intel.com \
--to=raag.jadav@intel.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrealmeid@igalia.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=xaver.hugl@kde.org \
/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