diff options
author | Christian König <christian.koenig@amd.com> | 2018-01-31 04:16:26 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-19 14:19:13 -0500 |
commit | 8fe27f8fa08b30c2c515b06209c9de52b392a116 (patch) | |
tree | 441db2be3bbc9efb77f375587cc41fb23e450e72 /drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | |
parent | a20ee0b1f8b42e2568f3a4408003d22b2dfcc706 (diff) |
drm/amdgpu: make VMID assignment more fair v2
Similar to finding an idle one before reuse.
This guarantees fairness between processes. Otherwise process with a reserved
VMID have an unfair advantage while scheduling jobs.
v2: improve commit message
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c index c13cf7e79b2e..7a3d0de7425d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | |||
@@ -268,11 +268,6 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
268 | int r = 0; | 268 | int r = 0; |
269 | 269 | ||
270 | mutex_lock(&id_mgr->lock); | 270 | mutex_lock(&id_mgr->lock); |
271 | if (vm->reserved_vmid[vmhub]) { | ||
272 | r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, fence, job); | ||
273 | mutex_unlock(&id_mgr->lock); | ||
274 | return r; | ||
275 | } | ||
276 | fences = kmalloc_array(sizeof(void *), id_mgr->num_ids, GFP_KERNEL); | 271 | fences = kmalloc_array(sizeof(void *), id_mgr->num_ids, GFP_KERNEL); |
277 | if (!fences) { | 272 | if (!fences) { |
278 | mutex_unlock(&id_mgr->lock); | 273 | mutex_unlock(&id_mgr->lock); |
@@ -319,6 +314,13 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
319 | } | 314 | } |
320 | kfree(fences); | 315 | kfree(fences); |
321 | 316 | ||
317 | if (vm->reserved_vmid[vmhub]) { | ||
318 | r = amdgpu_vmid_grab_reserved_locked(vm, ring, sync, | ||
319 | fence, job); | ||
320 | mutex_unlock(&id_mgr->lock); | ||
321 | return r; | ||
322 | } | ||
323 | |||
322 | job->vm_needs_flush = vm->use_cpu_for_update; | 324 | job->vm_needs_flush = vm->use_cpu_for_update; |
323 | /* Check if we can use a VMID already assigned to this VM */ | 325 | /* Check if we can use a VMID already assigned to this VM */ |
324 | list_for_each_entry_reverse(id, &id_mgr->ids_lru, list) { | 326 | list_for_each_entry_reverse(id, &id_mgr->ids_lru, list) { |