drm/amdgpu: reserve root PD fence slots for userq eviction-fence rearm

Root cause:
- In userq restore/rearm, root PD was locked with amdgpu_vm_lock_pd(vm, &exec, 1).
- Later in the same drm_exec context, amdgpu_evf_mgr_rearm() attaches
  BOOKKEEP eviction fences to all locked BOs.
- In this flow, root PD validation/update can also consume move-fence slots,
  so reserving only +1 at PD lock time is not sufficient under stress.

Fix:
- Reserve caller-side slots at the actual source by switching to:
  amdgpu_vm_lock_pd(vm, &exec, TTM_NUM_MOVE_FENCES + 1)

This keeps reservation policy in callers, consistent with Christian Konig
feedback and with amdgpu_gem_object_open() where callers reserve
TTM_NUM_MOVE_FENCES + 1 before attaching eviction fences.

Credit:
- Christian Konig: confirmed fence-slot reservation belongs to callers and
  asked to investigate why +1 was still not enough.
- Prike Liang: clarified the initial variant was workaround-only and
  developed that initial version independently.

Cc: Prike Liang <prike.liang@amd.com>
Cc: Sunil Khatri <sunil.khatri@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Vitaly Prosyak 2026-09-09 19:23:55 -04:00 • committed by Alex Deucher
commit a2a2774535