The job timeout handler takes a coredump for every device in an XGMI
hive and passes the hung job to each of them. The coredumps of the
other devices then name a ring of the requesting device as the one that
timed out, and include the IBs of a job that never ran on them.

Pass the job only to the coredump of the device it was submitted to.

amdgpu_device_reinit_after_reset() does the same, but cannot hit it
since commit c67db6a6a6be ("drm/amdgpu: Do core dump immediately when
job tmo"): the timeout handler is the only caller that gives
amdgpu_device_gpu_recover() a job, and it sets AMDGPU_SKIP_COREDUMP.
Change it too, so that it stays correct if another caller passes a job.

Fixes: 5e592956cc36 ("drm/amdgpu: add ring timeout information in devcoredump")
Fixes: c67db6a6a6be ("drm/amdgpu: Do core dump immediately when job tmo")
Signed-off-by: Matt Turner <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c    | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 85a22af69ba4..4a98a667526d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -5262,7 +5262,9 @@ int amdgpu_device_reinit_after_reset(struct 
amdgpu_reset_context *reset_context)
                                vram_lost = 
amdgpu_device_check_vram_lost(tmp_adev);
 
                                if (!test_bit(AMDGPU_SKIP_COREDUMP, 
&reset_context->flags))
-                                       amdgpu_coredump(tmp_adev, false, 
vram_lost, reset_context->job);
+                                       amdgpu_coredump(tmp_adev, false, 
vram_lost,
+                                                       tmp_adev == 
reset_context->reset_req_dev ?
+                                                       reset_context->job : 
NULL);
 
                                if (vram_lost) {
                                        dev_info(
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index 8689a3c933b2..fa13d7beba80 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -77,7 +77,7 @@ static void amdgpu_job_core_dump(struct amdgpu_device *adev,
 
        /* Do the coredump for each device */
        list_for_each_entry(tmp_adev, device_list_handle, reset_list)
-               amdgpu_job_do_core_dump(tmp_adev, job);
+               amdgpu_job_do_core_dump(tmp_adev, tmp_adev == adev ? job : 
NULL);
 
        if (hive) {
                mutex_unlock(&hive->hive_lock);

-- 
2.56.1

Reply via email to