]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/amdkfd: Fix mode1 reset crash issue
authorPhilip Yang <Philip.Yang@amd.com>
Thu, 6 Feb 2025 22:50:13 +0000 (17:50 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Feb 2025 21:50:04 +0000 (16:50 -0500)
commitf0b4440cdc1807bb6ec3dce0d6de81170803569b
treefd47e4e0c5a8fa7d4519d5bb1a15275c8c65a395
parent1b9366c601039d60546794c63fbb83ce8e53b978
drm/amdkfd: Fix mode1 reset crash issue

If HW scheduler hangs and mode1 reset is used to recover GPU, KFD signal
user space to abort the processes. After process abort exit, user queues
still use the GPU to access system memory before h/w is reset while KFD
cleanup worker free system memory and free VRAM.

There is use-after-free race bug that KFD allocate and reuse the freed
system memory, and user queue write to the same system memory to corrupt
the data structure and cause driver crash.

To fix this race, KFD cleanup worker terminate user queues, then flush
reset_domain wq to wait for any GPU ongoing reset complete, and then
free outstanding BOs.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_process.c