Skip to contentSkip to conversation

Revert "drm/amdgpu: remove vm sanity check from amdgpu_vm_make_compute" for Raven

PATCH Superseded Jesse.Zhang 3 participants 3 messages Feb 28, 2024

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "drm/amdgpu: remove vm sanity check from amdgpu_vm_make_compute" for Raven

fix the issue when run clinfo:
"amdgpu: Failed to create process VM object".

when amdgpu initialized, seq64 do mampping and update bo mapping in vm page table.
But when clifo run. It also initializes a vm for a process device through the function kfd_process_device_init_vm and ensure the root PD is clean through the function amdgpu_vm_pt_is_root_clean.
So they have a conflict, and clinfo always failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -6
index ed4a8c5d26d7..0bc0bc75be15 100644
@@ -2361,12 +2361,6 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	 * changing any other state, in case it fails.
 	 */
 	if (pte_support_ats != vm->pte_support_ats) {
-		/* Sanity checks */
-		if (!amdgpu_vm_pt_is_root_clean(adev, vm)) {
-			r = -EINVAL;
-			goto unreserve_bo;
-		}
-
 		vm->pte_support_ats = pte_support_ats;
 		r = amdgpu_vm_pt_clear(adev, vm, to_amdgpu_bo_vm(vm->root.bo),
 				       false);
Signature · 1 line
2.34.1
#1 lore raw

Am 28.02.24 um 06:04 schrieb Jesse.Zhang:

Quoted 7 lines

fix the issue when run clinfo:
"amdgpu: Failed to create process VM object".

when amdgpu initialized, seq64 do mampping and update bo mapping in vm page table.
But when clifo run. It also initializes a vm for a process device through the function kfd_process_device_init_vm and ensure the root PD is clean through the function amdgpu_vm_pt_is_root_clean.
So they have a conflict, and clinfo always failed.

Big NAK for this, you removed the check but didn't solved the problem in any way.

When Raven still needs the ats feature than it is intentional that this fails.

Regards,
Christian.

Quoted 23 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ------
  1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -6
index ed4a8c5d26d7..0bc0bc75be15 100644
@@ -2361,12 +2361,6 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
  	 * changing any other state, in case it fails.
  	 */
  	if (pte_support_ats != vm->pte_support_ats) {
-		/* Sanity checks */
-		if (!amdgpu_vm_pt_is_root_clean(adev, vm)) {
-			r = -EINVAL;
-			goto unreserve_bo;
-		}
-
  		vm->pte_support_ats = pte_support_ats;
  		r = amdgpu_vm_pt_clear(adev, vm, to_amdgpu_bo_vm(vm->root.bo),
  				       false);
#2 lore raw
Quoted 4 lines · Christian König

Am 28.02.24 um 06:04 schrieb Jesse.Zhang:

Quoted 3 lines

fix the issue when run clinfo:
"amdgpu: Failed to create process VM object".

Quoted 8 lines
Quoted 4 lines

when amdgpu initialized, seq64 do mampping and update bo mapping in vm page table.
But when clifo run. It also initializes a vm for a process device through the function kfd_process_device_init_vm and ensure the root PD is clean through the function amdgpu_vm_pt_is_root_clean.
So they have a conflict, and clinfo  always failed.

Big NAK for this, you removed the check but didn't solved the problem in any way.

When Raven still needs the ats feature than it is intentional that this fails.

I agree. I think we should just remove all the pte_supports_ats stuff from the amdgpu_vm code. We no longer use IOMMUv2. So there is no point setting invalid PTEs to fail over to ATS any more. As far as I can see, this will require changes in amdgpu_vm_clear_freed, amdgpu_vm_init, amdgpu_vm_make_compute. Then you can remove amdgpu_vm.pte_support_ats from the struct and remove amdgpu_vm_pt_is_root_clean.

Regards,
  Felix

Quoted 29 lines

Regards,
Christian.

Quoted 24 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ------

  1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -6
index ed4a8c5d26d7..0bc0bc75be15 100644
@@ -2361,12 +2361,6 @@ int amdgpu_vm_make_compute(struct 
 amdgpu_device *adev, struct amdgpu_vm *vm)
        * changing any other state, in case it fails.
        */
       if (pte_support_ats != vm->pte_support_ats) {
-        /* Sanity checks */
-        if (!amdgpu_vm_pt_is_root_clean(adev, vm)) {
-            r = -EINVAL;
-            goto unreserve_bo;
-        }
-
           vm->pte_support_ats = pte_support_ats;
           r = amdgpu_vm_pt_clear(adev, vm, to_amdgpu_bo_vm(vm->root.bo),

                         false);