Message ID | 20250228121353.1442591-3-andrealmeid@igalia.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | drm: Create an app info option for wedge events | expand |
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? Raag
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); + } + } + + drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, info); + } return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 3ed9cbcab1ad..8ab23182127e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -89,6 +89,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) { struct amdgpu_ring *ring = to_amdgpu_ring(s_job->sched); struct amdgpu_job *job = to_amdgpu_job(s_job); + struct drm_wedge_app_info aux, *info = NULL; struct amdgpu_task_info *ti; struct amdgpu_device *adev = ring->adev; int idx; @@ -127,6 +128,9 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) dev_err(adev->dev, "Process information: process %s pid %d thread %s pid %d\n", ti->process_name, ti->tgid, ti->task_name, ti->pid); + aux.pid = ti->pid; + aux.comm = ti->process_name; + info = &aux; amdgpu_vm_put_task_info(ti); } @@ -150,7 +154,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) amdgpu_fence_driver_force_completion(ring); if (amdgpu_ring_sched_ready(ring)) drm_sched_start(&ring->sched, 0); - drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, NULL); + drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE, info); dev_err(adev->dev, "Ring %s reset succeeded\n", ring->sched.name); goto exit; }
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(-)