The amdgpu devcoredump often doesn't have enough in it to tell why a job hung, and some of what it has describes the wrong moment. The IB contents are read from the coredump worker, which runs concurrently with recovery, so by then the process may have been killed or VRAM lost, and a later hang or fault can replace the IP registers and the VM fault info before the dump is formatted. Nothing in the dump shows which part of a ring belongs to which submission, which BO an address belongs to, or what the memory the IBs point at contained. When a dump is dropped, nothing says so.
Patches 1 to 5 fix dumps that describe the wrong state or are missing. An XGMI hive dumped only the requesting device, and dumped it again after suspending it, and every device in the hive was given the hung job. A second hang could overwrite the IP registers while the first dump was being formatted. Resets done by a reset handler produced no coredump. The VM fault info was read when the dump was formatted rather than when the hang was detected. Patch 6 adds CP_STAT to the gfx10, gfx11 and gfx12 IP dumps, and the IB2 progress registers to the per gfx queue dumps of gfx11 and gfx12. Patches 7 and 8 copy the IB contents before formatting, and then from the job timeout handler itself, before soft recovery or a reset can change them. That path is a dma_fence signaling critical section, so everything there is trylocked, allocated with GFP_NOWAIT and read without the slow MMIO path for CPU invisible VRAM, and at most 8 MiB is copied there so as not to hold up recovery. What can't be copied is retried from the worker and marked as such. Patches 9 to 12 add the submitting thread of the hung job, the unsignaled fences of each ring, a count of dropped dumps, and the VM mappings of the hung job. Patch 13 adds AMDGPU_VM_PAGE_DUMP, a mapping flag with which userspace asks for the contents of a mapping to be included in the coredump, subject to size limits. The RADV side is https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/47015. Patch 14 bumps the coredump version, since the format has changed. This series depends on "drm/amdgpu: fix IB content read in the devcoredump" from the "drm/amdgpu: devcoredump and reset fixes" series, and not on the other patches there. Signed-off-by: Matt Turner <[email protected]> --- Matt Turner (14): drm/amdgpu: dump the IP state of each device in an XGMI hive drm/amdgpu: only give the hung job to its own device's coredump drm/amdgpu: don't overwrite the IP state while a coredump is formatted drm/amdgpu: take a coredump before resets done by a reset handler drm/amdgpu: copy the VM fault info when the hang is detected drm/amdgpu/gfx10-12: dump CP_STAT and the IB2 state of each gfx queue drm/amdgpu: copy the IB contents before formatting the devcoredump drm/amdgpu: copy the IB contents when the hang is detected drm/amdgpu: record the submitting thread of the hung job in the coredump drm/amdgpu: dump the unsignaled fences of each ring in the coredump drm/amdgpu: report dropped devcoredumps drm/amdgpu: list the VM mappings of the hung job in the coredump drm/amdgpu: add AMDGPU_VM_PAGE_DUMP to include BOs in the coredump drm/amdgpu: bump the devcoredump version drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 + drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 980 ++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h | 74 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 31 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 12 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 6 + drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 40 +- drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 57 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 5 + drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 5 + drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 5 + drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 1 + include/uapi/drm/amdgpu_drm.h | 6 + 19 files changed, 1096 insertions(+), 155 deletions(-) --- base-commit: 83558fcf83cc911e09962ea17c883add596766c0 change-id: 20261118-amdgpu-devcoredump-fd7a93c870e1 prerequisite-patch-id: f4f8e95c172ec46bce86f4a08b00117c7e8edd73 Best regards, -- Matt Turner <[email protected]>
