diff mbox

[2/2] drm/radeon: check if BO_VA is set before adding it to the invalidation list

Message ID 1436342174-6434-2-git-send-email-deathsimple@vodafone.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christian König July 8, 2015, 7:56 a.m. UTC
From: Christian König <christian.koenig@amd.com>

Otherwise we try to clear BO_VAs without an address.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91141

Signed-off-by: Christian König <christian.koenig@amd.com>
Test-by: hadack@gmx.de
---
 drivers/gpu/drm/radeon/radeon_vm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Michel Dänzer July 8, 2015, 8:08 a.m. UTC | #1
On 08.07.2015 16:56, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> Otherwise we try to clear BO_VAs without an address.
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91141
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Test-by: hadack@gmx.de

This series is

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
index 0310965..48d97c0 100644
--- a/drivers/gpu/drm/radeon/radeon_vm.c
+++ b/drivers/gpu/drm/radeon/radeon_vm.c
@@ -507,22 +507,21 @@  int radeon_vm_bo_set_addr(struct radeon_device *rdev,
 		tmp->bo = radeon_bo_ref(bo_va->bo);
 
 		interval_tree_remove(&bo_va->it, &vm->va);
+		spin_lock(&vm->status_lock);
 		bo_va->it.start = 0;
 		bo_va->it.last = 0;
-
-		spin_lock(&vm->status_lock);
 		list_del_init(&bo_va->vm_status);
 		list_add(&tmp->vm_status, &vm->freed);
 		spin_unlock(&vm->status_lock);
 	}
 
 	if (soffset || eoffset) {
+		spin_lock(&vm->status_lock);
 		bo_va->it.start = soffset;
 		bo_va->it.last = eoffset - 1;
-		interval_tree_insert(&bo_va->it, &vm->va);
-		spin_lock(&vm->status_lock);
 		list_add(&bo_va->vm_status, &vm->cleared);
 		spin_unlock(&vm->status_lock);
+		interval_tree_insert(&bo_va->it, &vm->va);
 	}
 
 	bo_va->flags = flags;
@@ -1156,7 +1155,8 @@  void radeon_vm_bo_invalidate(struct radeon_device *rdev,
 
 	list_for_each_entry(bo_va, &bo->va, bo_list) {
 		spin_lock(&bo_va->vm->status_lock);
-		if (list_empty(&bo_va->vm_status))
+		if (list_empty(&bo_va->vm_status) &&
+		    (bo_va->it.start || bo_va->it.last))
 			list_add(&bo_va->vm_status, &bo_va->vm->invalidated);
 		spin_unlock(&bo_va->vm->status_lock);
 	}