diff options
author | Christian König <christian.koenig@amd.com> | 2018-09-26 05:15:36 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-12-07 18:14:20 -0500 |
commit | a655dad4b2f94e0d880f2e4ea45251092d836f36 (patch) | |
tree | 8d1730c8cb85cf92bc5b5ea10d442e2fc032dbf1 | |
parent | 2026057736e9134c524ad85b526005944034e00f (diff) |
drm/amdgpu: remove VM fault_credit handling
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>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 37 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/cik_ih.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/cz_ih.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/iceland_ih.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 7 |
7 files changed, 6 insertions, 115 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b095bbbbc302..fc91f3e54a87 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -3052,7 +3052,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
3052 | } | 3052 | } |
3053 | 3053 | ||
3054 | INIT_KFIFO(vm->faults); | 3054 | INIT_KFIFO(vm->faults); |
3055 | vm->fault_credit = 16; | ||
3056 | 3055 | ||
3057 | return 0; | 3056 | return 0; |
3058 | 3057 | ||
@@ -3265,42 +3264,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
3265 | } | 3264 | } |
3266 | 3265 | ||
3267 | /** | 3266 | /** |
3268 | * amdgpu_vm_pasid_fault_credit - Check fault credit for given PASID | ||
3269 | * | ||
3270 | * @adev: amdgpu_device pointer | ||
3271 | * @pasid: PASID do identify the VM | ||
3272 | * | ||
3273 | * This function is expected to be called in interrupt context. | ||
3274 | * | ||
3275 | * Returns: | ||
3276 | * True if there was fault credit, false otherwise | ||
3277 | */ | ||
3278 | bool amdgpu_vm_pasid_fault_credit(struct amdgpu_device *adev, | ||
3279 | unsigned int pasid) | ||
3280 | { | ||
3281 | struct amdgpu_vm *vm; | ||
3282 | |||
3283 | spin_lock(&adev->vm_manager.pasid_lock); | ||
3284 | vm = idr_find(&adev->vm_manager.pasid_idr, pasid); | ||
3285 | if (!vm) { | ||
3286 | /* VM not found, can't track fault credit */ | ||
3287 | spin_unlock(&adev->vm_manager.pasid_lock); | ||
3288 | return true; | ||
3289 | } | ||
3290 | |||
3291 | /* No lock needed. only accessed by IRQ handler */ | ||
3292 | if (!vm->fault_credit) { | ||
3293 | /* Too many faults in this VM */ | ||
3294 | spin_unlock(&adev->vm_manager.pasid_lock); | ||
3295 | return false; | ||
3296 | } | ||
3297 | |||
3298 | vm->fault_credit--; | ||
3299 | spin_unlock(&adev->vm_manager.pasid_lock); | ||
3300 | return true; | ||
3301 | } | ||
3302 | |||
3303 | /** | ||
3304 | * amdgpu_vm_manager_init - init the VM manager | 3267 | * amdgpu_vm_manager_init - init the VM manager |
3305 | * | 3268 | * |
3306 | * @adev: amdgpu_device pointer | 3269 | * @adev: amdgpu_device pointer |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index 2a8898d19c8b..e8dcfd59fc93 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |||
@@ -229,9 +229,6 @@ struct amdgpu_vm { | |||
229 | /* Up to 128 pending retry page faults */ | 229 | /* Up to 128 pending retry page faults */ |
230 | DECLARE_KFIFO(faults, u64, 128); | 230 | DECLARE_KFIFO(faults, u64, 128); |
231 | 231 | ||
232 | /* Limit non-retry fault storms */ | ||
233 | unsigned int fault_credit; | ||
234 | |||
235 | /* Points to the KFD process VM info */ | 232 | /* Points to the KFD process VM info */ |
236 | struct amdkfd_process_info *process_info; | 233 | struct amdkfd_process_info *process_info; |
237 | 234 | ||
@@ -299,8 +296,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
299 | int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, unsigned int pasid); | 296 | int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, unsigned int pasid); |
300 | void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm); | 297 | void amdgpu_vm_release_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm); |
301 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); | 298 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); |
302 | bool amdgpu_vm_pasid_fault_credit(struct amdgpu_device *adev, | ||
303 | unsigned int pasid); | ||
304 | void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, | 299 | void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, |
305 | struct list_head *validated, | 300 | struct list_head *validated, |
306 | struct amdgpu_bo_list_entry *entry); | 301 | struct amdgpu_bo_list_entry *entry); |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_ih.c b/drivers/gpu/drm/amd/amdgpu/cik_ih.c index b5775c6a857b..3e6c8c4067cb 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_ih.c | |||
@@ -237,23 +237,7 @@ static u32 cik_ih_get_wptr(struct amdgpu_device *adev) | |||
237 | */ | 237 | */ |
238 | static bool cik_ih_prescreen_iv(struct amdgpu_device *adev) | 238 | static bool cik_ih_prescreen_iv(struct amdgpu_device *adev) |
239 | { | 239 | { |
240 | u32 ring_index = adev->irq.ih.rptr >> 2; | 240 | return true; |
241 | u16 pasid; | ||
242 | |||
243 | switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) { | ||
244 | case 146: | ||
245 | case 147: | ||
246 | pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16; | ||
247 | if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid)) | ||
248 | return true; | ||
249 | break; | ||
250 | default: | ||
251 | /* Not a VM fault */ | ||
252 | return true; | ||
253 | } | ||
254 | |||
255 | adev->irq.ih.rptr += 16; | ||
256 | return false; | ||
257 | } | 241 | } |
258 | 242 | ||
259 | /** | 243 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_ih.c b/drivers/gpu/drm/amd/amdgpu/cz_ih.c index df5ac4d85a00..447b3cbc47e5 100644 --- a/drivers/gpu/drm/amd/amdgpu/cz_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/cz_ih.c | |||
@@ -216,23 +216,7 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev) | |||
216 | */ | 216 | */ |
217 | static bool cz_ih_prescreen_iv(struct amdgpu_device *adev) | 217 | static bool cz_ih_prescreen_iv(struct amdgpu_device *adev) |
218 | { | 218 | { |
219 | u32 ring_index = adev->irq.ih.rptr >> 2; | 219 | return true; |
220 | u16 pasid; | ||
221 | |||
222 | switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) { | ||
223 | case 146: | ||
224 | case 147: | ||
225 | pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16; | ||
226 | if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid)) | ||
227 | return true; | ||
228 | break; | ||
229 | default: | ||
230 | /* Not a VM fault */ | ||
231 | return true; | ||
232 | } | ||
233 | |||
234 | adev->irq.ih.rptr += 16; | ||
235 | return false; | ||
236 | } | 220 | } |
237 | 221 | ||
238 | /** | 222 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c index cf0fc61aebe6..2b94a6d1550e 100644 --- a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c | |||
@@ -216,23 +216,7 @@ static u32 iceland_ih_get_wptr(struct amdgpu_device *adev) | |||
216 | */ | 216 | */ |
217 | static bool iceland_ih_prescreen_iv(struct amdgpu_device *adev) | 217 | static bool iceland_ih_prescreen_iv(struct amdgpu_device *adev) |
218 | { | 218 | { |
219 | u32 ring_index = adev->irq.ih.rptr >> 2; | 219 | return true; |
220 | u16 pasid; | ||
221 | |||
222 | switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) { | ||
223 | case 146: | ||
224 | case 147: | ||
225 | pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16; | ||
226 | if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid)) | ||
227 | return true; | ||
228 | break; | ||
229 | default: | ||
230 | /* Not a VM fault */ | ||
231 | return true; | ||
232 | } | ||
233 | |||
234 | adev->irq.ih.rptr += 16; | ||
235 | return false; | ||
236 | } | 220 | } |
237 | 221 | ||
238 | /** | 222 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c index dcdbb4d72472..9d7b43da6acc 100644 --- a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c | |||
@@ -227,23 +227,7 @@ static u32 tonga_ih_get_wptr(struct amdgpu_device *adev) | |||
227 | */ | 227 | */ |
228 | static bool tonga_ih_prescreen_iv(struct amdgpu_device *adev) | 228 | static bool tonga_ih_prescreen_iv(struct amdgpu_device *adev) |
229 | { | 229 | { |
230 | u32 ring_index = adev->irq.ih.rptr >> 2; | 230 | return true; |
231 | u16 pasid; | ||
232 | |||
233 | switch (le32_to_cpu(adev->irq.ih.ring[ring_index]) & 0xff) { | ||
234 | case 146: | ||
235 | case 147: | ||
236 | pasid = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]) >> 16; | ||
237 | if (!pasid || amdgpu_vm_pasid_fault_credit(adev, pasid)) | ||
238 | return true; | ||
239 | break; | ||
240 | default: | ||
241 | /* Not a VM fault */ | ||
242 | return true; | ||
243 | } | ||
244 | |||
245 | adev->irq.ih.rptr += 16; | ||
246 | return false; | ||
247 | } | 231 | } |
248 | 232 | ||
249 | /** | 233 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c index d84b687240d1..b49290bcf109 100644 --- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c | |||
@@ -258,12 +258,9 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev) | |||
258 | if (!pasid) | 258 | if (!pasid) |
259 | return true; | 259 | return true; |
260 | 260 | ||
261 | /* Not a retry fault, check fault credit */ | 261 | /* Not a retry fault */ |
262 | if (!(dw5 & 0x80)) { | 262 | if (!(dw5 & 0x80)) |
263 | if (!amdgpu_vm_pasid_fault_credit(adev, pasid)) | ||
264 | goto ignore_iv; | ||
265 | return true; | 263 | return true; |
266 | } | ||
267 | 264 | ||
268 | /* Track retry faults in per-VM fault FIFO. */ | 265 | /* Track retry faults in per-VM fault FIFO. */ |
269 | spin_lock(&adev->vm_manager.pasid_lock); | 266 | spin_lock(&adev->vm_manager.pasid_lock); |