From: Zihao Mu <[email protected]> Wait for the shared root KERNEL move dependencies in prepare, including NULL-sync calls, and remove the per-batch wait from the CPU update. Allocation now commits and prepares again before further writes.
Use uninterruptible waits for both explicit sync and KERNEL dependencies. An MMU-notifier unmap must complete even if a signal is pending; moving an interruptible wait into prepare does not meet that requirement. The infinite, uninterruptible reservation wait needs no error branch. Keep the CPU write/flags body and public callback types otherwise unchanged. SDMA resource-allocation failures remain outside this CPU signal-handling fix; no allocation retry or no-fail claim is added. Link: https://lore.kernel.org/amd-gfx/[email protected]/ Signed-off-by: Zihao Mu <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c index 7521c5be207..b6d774751cc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c @@ -50,10 +50,19 @@ static int amdgpu_vm_cpu_map_table(struct amdgpu_bo_vm *table) static int amdgpu_vm_cpu_prepare(struct amdgpu_vm_update_params *p, struct amdgpu_sync *sync) { - if (!sync) - return 0; + struct dma_resv *resv = p->vm->root.bo->tbo.base.resv; + int r; - return amdgpu_sync_wait(sync, true); + if (sync) { + r = amdgpu_sync_wait(sync, false); + if (r) + return r; + } + + /* MMU-notifier unmaps must finish, including when a signal is pending. */ + dma_resv_wait_timeout(resv, DMA_RESV_USAGE_KERNEL, + false, MAX_SCHEDULE_TIMEOUT); + return 0; } /** @@ -76,12 +85,6 @@ static int amdgpu_vm_cpu_update(struct amdgpu_vm_update_params *p, { unsigned int i; uint64_t value; - long r; - - r = dma_resv_wait_timeout(vmbo->bo.tbo.base.resv, DMA_RESV_USAGE_KERNEL, - true, MAX_SCHEDULE_TIMEOUT); - if (r < 0) - return r; pe += (unsigned long)amdgpu_bo_kptr(&vmbo->bo); -- 2.43.0
