Re: [PATCH] drm/amdgpu: Forbid kfd using cpu to update pt if vm is shared with gfx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have no problem dropping the AMDGPU_GEM_CREATE_NO_CPU_ACCESS flag from page tables no matter if we have large BAR or not.

That should only be necessary when BOs are pinned and since we never pin page tables it shouldn't matter.

Just set AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED after switching to CPU based updates for all already allocated page tables.

Regards,
Christian.

Am 21.06.23 um 17:16 schrieb Felix Kuehling:
Can we change the flags if needed. E.g. see what amdgpu_bo_pin_restricted does:

        if (!(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS))
                bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
        amdgpu_bo_placement_from_domain(bo, domain);

This shouldn't really change anything about the BO placement because we only enable CPU page table updates on large-BAR GPUs by default. Alternatively, we could create VM BOs with AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED on large-BAR GPUs to make it possible to switch to CPU page table updates for compute VMs.

Regards,
  Felix


Am 2023-06-21 um 05:46 schrieb YuBiao Wang:
If a same GPU VM is shared by kfd and graphic operations, we must align
the vm update mode to sdma, or cpu kmap will fail and cause null pointer
issue.

Signed-off-by: YuBiao Wang <YuBiao.Wang@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 291977b93b1d..e105ff9e8041 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2239,6 +2239,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)   int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
  {
      bool pte_support_ats = (adev->asic_type == CHIP_RAVEN);
+    struct amdgpu_bo *bo = vm->root.bo;
      int r;
        r = amdgpu_bo_reserve(vm->root.bo, true);
@@ -2265,6 +2266,10 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)
      /* Update VM state */
      vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
                      AMDGPU_VM_USE_CPU_FOR_COMPUTE);
+
+    if (bo && !(bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED))
+        vm->use_cpu_for_update = false;
+
      DRM_DEBUG_DRIVER("VM update mode is %s\n",
               vm->use_cpu_for_update ? "CPU" : "SDMA");
      WARN_ONCE((vm->use_cpu_for_update &&




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux