diff options
author | Christian König <christian.koenig@amd.com> | 2017-08-15 11:08:12 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-08-29 15:28:03 -0400 |
commit | cb7b6ec2f8b8759b6b5beb4d17ea6984867a3296 (patch) | |
tree | 9c659bbda3ffbc33d53fcf0327383ea100b739ac /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 3d7d4d3a1b9f67c0caecf2b2aa8d7c347f074a33 (diff) |
drm/amdgpu: add bo_va cleared flag again v2
We changed this to use an extra list a while back, but for the next
series I need a separate flag again.
v2: reorder to avoid unlocked list access
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-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_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 1b36c62997b3..1334bbb82634 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1792,11 +1792,8 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1792 | bo_va->base.moved = false; | 1792 | bo_va->base.moved = false; |
1793 | list_splice_init(&bo_va->valids, &bo_va->invalids); | 1793 | list_splice_init(&bo_va->valids, &bo_va->invalids); |
1794 | 1794 | ||
1795 | } else { | 1795 | } else if (bo_va->cleared != clear) { |
1796 | spin_lock(&vm->status_lock); | 1796 | list_splice_init(&bo_va->valids, &bo_va->invalids); |
1797 | if (!list_empty(&bo_va->base.vm_status)) | ||
1798 | list_splice_init(&bo_va->valids, &bo_va->invalids); | ||
1799 | spin_unlock(&vm->status_lock); | ||
1800 | } | 1797 | } |
1801 | 1798 | ||
1802 | list_for_each_entry(mapping, &bo_va->invalids, list) { | 1799 | list_for_each_entry(mapping, &bo_va->invalids, list) { |
@@ -1807,25 +1804,22 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, | |||
1807 | return r; | 1804 | return r; |
1808 | } | 1805 | } |
1809 | 1806 | ||
1810 | if (trace_amdgpu_vm_bo_mapping_enabled()) { | 1807 | if (vm->use_cpu_for_update) { |
1811 | list_for_each_entry(mapping, &bo_va->valids, list) | 1808 | /* Flush HDP */ |
1812 | trace_amdgpu_vm_bo_mapping(mapping); | 1809 | mb(); |
1813 | 1810 | amdgpu_gart_flush_gpu_tlb(adev, 0); | |
1814 | list_for_each_entry(mapping, &bo_va->invalids, list) | ||
1815 | trace_amdgpu_vm_bo_mapping(mapping); | ||
1816 | } | 1811 | } |
1817 | 1812 | ||
1818 | spin_lock(&vm->status_lock); | 1813 | spin_lock(&vm->status_lock); |
1819 | list_splice_init(&bo_va->invalids, &bo_va->valids); | ||
1820 | list_del_init(&bo_va->base.vm_status); | 1814 | list_del_init(&bo_va->base.vm_status); |
1821 | if (clear) | ||
1822 | list_add(&bo_va->base.vm_status, &vm->cleared); | ||
1823 | spin_unlock(&vm->status_lock); | 1815 | spin_unlock(&vm->status_lock); |
1824 | 1816 | ||
1825 | if (vm->use_cpu_for_update) { | 1817 | list_splice_init(&bo_va->invalids, &bo_va->valids); |
1826 | /* Flush HDP */ | 1818 | bo_va->cleared = clear; |
1827 | mb(); | 1819 | |
1828 | amdgpu_gart_flush_gpu_tlb(adev, 0); | 1820 | if (trace_amdgpu_vm_bo_mapping_enabled()) { |
1821 | list_for_each_entry(mapping, &bo_va->valids, list) | ||
1822 | trace_amdgpu_vm_bo_mapping(mapping); | ||
1829 | } | 1823 | } |
1830 | 1824 | ||
1831 | return 0; | 1825 | return 0; |
@@ -2427,9 +2421,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, | |||
2427 | list_for_each_entry(bo_base, &bo->va, bo_list) { | 2421 | list_for_each_entry(bo_base, &bo->va, bo_list) { |
2428 | bo_base->moved = true; | 2422 | bo_base->moved = true; |
2429 | spin_lock(&bo_base->vm->status_lock); | 2423 | spin_lock(&bo_base->vm->status_lock); |
2430 | if (list_empty(&bo_base->vm_status)) | 2424 | list_move(&bo_base->vm_status, &bo_base->vm->moved); |
2431 | list_add(&bo_base->vm_status, | ||
2432 | &bo_base->vm->moved); | ||
2433 | spin_unlock(&bo_base->vm->status_lock); | 2425 | spin_unlock(&bo_base->vm->status_lock); |
2434 | } | 2426 | } |
2435 | } | 2427 | } |
@@ -2516,7 +2508,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
2516 | vm->reserved_vmid[i] = NULL; | 2508 | vm->reserved_vmid[i] = NULL; |
2517 | spin_lock_init(&vm->status_lock); | 2509 | spin_lock_init(&vm->status_lock); |
2518 | INIT_LIST_HEAD(&vm->moved); | 2510 | INIT_LIST_HEAD(&vm->moved); |
2519 | INIT_LIST_HEAD(&vm->cleared); | ||
2520 | INIT_LIST_HEAD(&vm->freed); | 2511 | INIT_LIST_HEAD(&vm->freed); |
2521 | 2512 | ||
2522 | /* create scheduler entity for page table updates */ | 2513 | /* create scheduler entity for page table updates */ |