]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: fix amdgpu_vm_bo_reset_state_machine
authorChristian König <christian.koenig@amd.com>
Fri, 22 May 2026 09:22:10 +0000 (11:22 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 28 May 2026 20:19:40 +0000 (16:19 -0400)
Can't splice the list but need to handle each entry individually.

Otherwise we run into issues after a GPU reset.

Fixes: 4cdbba5a16aa ("drm/amdgpu: restructure VM state machine v4")
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jesse Zhang <jesse.zhang@amd.com>
Tested-by: Jesse Zhang <jesse.zhang@amd.com>
Reviewed-by: Sunil Khatri <sunil.khatri@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 79efefd25a4fd84e87e97ec5e5444f85c0fbb438..4558a5663c66e97439db380a8f68cf221c882f4d 100644 (file)
@@ -266,12 +266,23 @@ static void amdgpu_vm_bo_idle(struct amdgpu_vm_bo_base *vm_bo)
  */
 static void amdgpu_vm_bo_reset_state_machine(struct amdgpu_vm *vm)
 {
+       struct amdgpu_vm_bo_base *vm_bo, *tmp;
+
+       /*
+        * Don't use list splice here, we need the special handling for the root
+        * PD and set the moved flag appropriately.
+        */
        amdgpu_vm_assert_locked(vm);
-       list_splice_init(&vm->kernel.idle, &vm->kernel.moved);
-       list_splice_init(&vm->always_valid.idle, &vm->always_valid.moved);
+       list_for_each_entry_safe(vm_bo, tmp, &vm->kernel.idle, vm_status)
+               amdgpu_vm_bo_moved(vm_bo);
+       list_for_each_entry_safe(vm_bo, tmp, &vm->always_valid.idle, vm_status)
+               amdgpu_vm_bo_moved(vm_bo);
 
        spin_lock(&vm->individual_lock);
-       list_splice_init(&vm->individual.idle, &vm->individual.moved);
+       list_for_each_entry_safe(vm_bo, tmp, &vm->individual.idle, vm_status) {
+               vm_bo->moved = true;
+               list_move(&vm_bo->vm_status, &vm->individual.moved);
+       }
        spin_unlock(&vm->individual_lock);
 }