drm/amdgpu: remove VM fault_credit handling
authorChristian König <christian.koenig@amd.com>
Wed, 26 Sep 2018 09:15:36 +0000 (11:15 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 7 Dec 2018 23:14:20 +0000 (18:14 -0500)
printk_ratelimit() is much better suited to limit the number of reported
VM faults.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
drivers/gpu/drm/amd/amdgpu/cik_ih.c
drivers/gpu/drm/amd/amdgpu/cz_ih.c
drivers/gpu/drm/amd/amdgpu/iceland_ih.c
drivers/gpu/drm/amd/amdgpu/tonga_ih.c
drivers/gpu/drm/amd/amdgpu/vega10_ih.c

index b095bbbbc302bf61809cee8458e5b83199846ca2..fc91f3e54a87da4b4f3bb440b0f0d942e493e3de 100644 (file)
@@ -3052,7 +3052,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
        }
 
        INIT_KFIFO(vm->faults);
-       vm->fault_credit = 16;
 
        return 0;
 
@@ -3264,42 +3263,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
                amdgpu_vmid_free_reserved(adev, vm, i);
 }
 
-/**
- * amdgpu_vm_pasid_fault_credit - Check fault credit for given PASID
- *
- * @adev: amdgpu_device pointer
- * @pasid: PASID do identify the VM
- *
- * This function is expected to be called in interrupt context.
- *
- * Returns:
- * True if there was fault credit, false otherwise
- */
-bool amdgpu_vm_pasid_fault_credit(struct amdgpu_device *adev,
-                                 unsigned int pasid)
-{
-       struct amdgpu_vm *vm;
-
-       spin_lock(&adev->vm_manager.pasid_lock);
-       vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
-       if (!vm) {
-               /* VM not found, can't track fault credit */
-               spin_unlock(&adev->vm_manager.pasid_lock);
-               return true;
-       }
-
-       /* No lock needed. only accessed by IRQ handler */
-       if (!vm->fault_credit) {
-               /* Too many faults in this VM */
-               spin_unlock(&adev->vm_manager.pasid_lock);
-               return false;
-       }
-
-       vm->fault_credit--;
-       spin_unlock(&adev->vm_manager.pasid_lock);
-       return true;
-}
-
 /**
  * amdgpu_vm_manager_init - init the VM manager
  *
index 2a8898d19c8b58076dd88526a4304e3104a67866..e8dcfd59fc93353468aaada4c42e6ab4ca6d85a5 100644 (file)
@@ -229,9 +229,6 @@ struct amdgpu_vm {
        /* Up to 128 pending retry page faults */
        DECLARE_KFIFO(faults, u64, 128);
 
-       /* Limit non-retry fault storms */
-       unsigned int            fault_credit;
-
        /* Points to the KFD process VM info */
        struct amdkfd_process_info *process_info;
 
@@ -299,8 +296,6 @@ 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, unsigned int pasid);
 void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
 void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
-bool amdgpu_vm_pasid_fault_credit(struct amdgpu_device *adev,
-                                 unsigned int pasid);
 void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
                         struct list_head *validated,
                         struct amdgpu_bo_list_entry *entry);
index b5775c6a857ba63148d21df914509263383326d0..3e6c8c4067cb3adb15c934d7966fb8b04e3d0212 100644 (file)
@@ -237,23 +237,7 @@ static u32 cik_ih_get_wptr(struct amdgpu_device *adev)
  */
 static bool cik_ih_prescreen_iv(struct amdgpu_device *adev)
 {
-       u32 ring_index = adev->irq.ih.rptr >> 2;
-       u16 pasid;
-
-       switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) {
-       case 146:
-       case 147:
-               pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16;
-               if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid))
-                       return true;
-               break;
-       default:
-               /* Not a VM fault */
-               return true;
-       }
-
-       adev->irq.ih.rptr += 16;
-       return false;
+       return true;
 }
 
  /**
index df5ac4d85a00a5767011c398904a92ab11edce37..447b3cbc47e5140f825899601607b77d9ceebc49 100644 (file)
@@ -216,23 +216,7 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev)
  */
 static bool cz_ih_prescreen_iv(struct amdgpu_device *adev)
 {
-       u32 ring_index = adev->irq.ih.rptr >> 2;
-       u16 pasid;
-
-       switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) {
-       case 146:
-       case 147:
-               pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16;
-               if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid))
-                       return true;
-               break;
-       default:
-               /* Not a VM fault */
-               return true;
-       }
-
-       adev->irq.ih.rptr += 16;
-       return false;
+       return true;
 }
 
 /**
index cf0fc61aebe6d5f2de6f9217126dbb1fa94fe05b..2b94a6d1550e5da00feb5888fb74945cea98cf8d 100644 (file)
@@ -216,23 +216,7 @@ static u32 iceland_ih_get_wptr(struct amdgpu_device *adev)
  */
 static bool iceland_ih_prescreen_iv(struct amdgpu_device *adev)
 {
-       u32 ring_index = adev->irq.ih.rptr >> 2;
-       u16 pasid;
-
-       switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) {
-       case 146:
-       case 147:
-               pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16;
-               if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid))
-                       return true;
-               break;
-       default:
-               /* Not a VM fault */
-               return true;
-       }
-
-       adev->irq.ih.rptr += 16;
-       return false;
+       return true;
 }
 
 /**
index dcdbb4d72472e8dc8732364928a6dac02a162236..9d7b43da6acc228511263a8e43e0895fdb8e2409 100644 (file)
@@ -227,23 +227,7 @@ static u32 tonga_ih_get_wptr(struct amdgpu_device *adev)
  */
 static bool tonga_ih_prescreen_iv(struct amdgpu_device *adev)
 {
-       u32 ring_index = adev->irq.ih.rptr >> 2;
-       u16 pasid;
-
-       switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) {
-       case 146:
-       case 147:
-               pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16;
-               if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid))
-                       return true;
-               break;
-       default:
-               /* Not a VM fault */
-               return true;
-       }
-
-       adev->irq.ih.rptr += 16;
-       return false;
+       return true;
 }
 
 /**
index d84b687240d11d41a28a2841fa5ee8c2a51a1855..b49290bcf10912f94a00d4bd2068a3f05d264c89 100644 (file)
@@ -258,12 +258,9 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev)
        if (!pasid)
                return true;
 
-       /* Not a retry fault, check fault credit */
-       if (!(dw5 & 0x80)) {
-               if (!amdgpu_vm_pasid_fault_credit(adev, pasid))
-                       goto ignore_iv;
+       /* Not a retry fault */
+       if (!(dw5 & 0x80))
                return true;
-       }
 
        /* Track retry faults in per-VM fault FIFO. */
        spin_lock(&adev->vm_manager.pasid_lock);