Revert "drm/amdgpu: remove vm sanity check from amdgpu_vm_make_compute" for Raven
Subsystems (2)
PATCH v2 1/1 Revert "drm/amdgpu: remove vm sanity check from amdgpu_vm_make_compute" for Raven
From: "Jesse.Zhang" <[email protected]>
fix the issue:
"amdgpu: Failed to create process VM object".
[Why]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.
[HOW]
Skip the seq64 entry check in vm page table.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +13 -0
@@ -746,8 +746,21 @@ bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,enum amdgpu_vm_level root = adev->vm_manager.root_level;unsigned int entries =amdgpu_vm_pt_num_entries (adev, root);unsigned int i =0 ; +u64 seq64_addr = (adev->vm_manager.max_pfn <<AMDGPU_GPU_PAGE_SHIFT ) -AMDGPU_VA_RESERVED_TOP ; + + seq64_addr /=AMDGPU_GPU_PAGE_SIZE ; + mask =amdgpu_vm_pt_entries_mask (adev, adev->vm_manager.root_level); + shift =amdgpu_vm_pt_level_shift (adev, adev->vm_manager.root_level); + seq64_entry = (seq64_addr >> shift) & mask;for (i =0 ; i < entries; i++) { +/* seq64 reserve 2M memory from top of address space. +* Then do the mapping and update the vm page table at amdgpu initialize. +* So skip the know result. +*/ + +if (i == seq64_entry) +continue ;if (to_amdgpu_bo_vm (vm->root.bo)->entries[i].bo)return false; }
Signature · 1 line
2.34.1
Hi Jesse,
Am 28.02.24 um 09:43 schrieb [email protected]:
Quoted 31 lines
From: "Jesse.Zhang" <[email protected]>
fix the issue:
"amdgpu: Failed to create process VM object".[Why]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 functionkfd_process_device_init_vmand ensure the root PD is clean through the functionamdgpu_vm_pt_is_root_clean.
So they have a conflict, and clinfo always failed.[HOW]
Skip the seq64 entry check in vm page table.Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +5
-0@@ -746,8 +746,21 @@ bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,enum amdgpu_vm_level root = adev->vm_manager.root_level;unsigned int entries =amdgpu_vm_pt_num_entries (adev, root);unsigned int i =0 ; +u64 seq64_addr = (adev->vm_manager.max_pfn <<AMDGPU_GPU_PAGE_SHIFT ) -AMDGPU_VA_RESERVED_TOP ; + + seq64_addr /=AMDGPU_GPU_PAGE_SIZE ; + mask =amdgpu_vm_pt_entries_mask (adev, adev->vm_manager.root_level); + shift =amdgpu_vm_pt_level_shift (adev, adev->vm_manager.root_level);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev, · line 763
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +8
-0+ seq64_entry = (seq64_addr >> shift) & mask;for (i =0 ; i < entries; i++) { +/* seq64 reserve 2M memory from top of address space. +* Then do the mapping and update the vm page table at amdgpu initialize. +* So skip the know result. +*/ + +if (i == seq64_entry) +continue ;
Once more it is intentional that this fails!
Renoir shouldn't be using the ATS setting any more because that functionality was removed.
But it looks like the setting is somehow still active and because of this you run into this issue here.
Regards,
Christian.
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c +0
-0if (to_amdgpu_bo_vm (vm->root.bo)->entries[i].bo)return false; }