Skip to contentSkip to conversation

drm/radeon: fix adding all VAs to the freed list on remove v2

PATCH Applied Christian König 3 participants 3 messages Jun 26, 2015 – Jun 30, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: fix adding all VAs to the freed list on remove v2

From: Christian König <[email protected]>

We only should do so when the BO_VA was actually mapped. Otherwise we get a nice error message on the next CS.

v2: It actually doesn't matter if it was invalidated or not,
if it was mapped we need to clear the area where it was mapped.

---
 drivers/gpu/drm/radeon/radeon_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +2 -2
index 3662157..ec10533 100644
@@ -1129,12 +1129,12 @@ void radeon_vm_bo_rmv(struct radeon_device *rdev,
 		interval_tree_remove(&bo_va->it, &vm->va);
 
 	spin_lock(&vm->status_lock);
-	if (list_empty(&bo_va->vm_status)) {
+	list_del(&bo_va->vm_status);
+	if (bo_va->it.start || bo_va->it.last) {
 		bo_va->bo = radeon_bo_ref(bo_va->bo);
 		list_add(&bo_va->vm_status, &vm->freed);
 	} else {
 		radeon_fence_unref(&bo_va->last_pt_update);
-		list_del(&bo_va->vm_status);
 		kfree(bo_va);
 	}
 	spin_unlock(&vm->status_lock);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Applied
#1 lore raw
Quoted 10 lines · Christian König

From: Christian König <[email protected]>

We only should do so when the BO_VA was actually mapped. Otherwise we get a nice error message on the next CS.

v2: It actually doesn't matter if it was invalidated or not,
if it was mapped we need to clear the area where it was mapped.

Applied. Thanks!

Alex

Quoted 24 lines
---
 drivers/gpu/drm/radeon/radeon_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +2 -3
index 3662157..ec10533 100644
@@ -1129,12 +1129,12 @@ void radeon_vm_bo_rmv(struct radeon_device *rdev,
                interval_tree_remove(&bo_va->it, &vm->va);
 
        spin_lock(&vm->status_lock);
-       if (list_empty(&bo_va->vm_status)) {
+       list_del(&bo_va->vm_status);
+       if (bo_va->it.start || bo_va->it.last) {
                bo_va->bo = radeon_bo_ref(bo_va->bo);
                list_add(&bo_va->vm_status, &vm->freed);
        } else {
                radeon_fence_unref(&bo_va->last_pt_update);
-               list_del(&bo_va->vm_status);
                kfree(bo_va);
        }
        spin_unlock(&vm->status_lock);
--
Quoted 2 lines

1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Christian König
Quoted 24 lines · Christian König

From: Christian König <[email protected]>

We only should do so when the BO_VA was actually mapped. Otherwise we get a nice error message on the next CS.

v2: It actually doesn't matter if it was invalidated or not,
if it was mapped we need to clear the area where it was mapped.

---
 drivers/gpu/drm/radeon/radeon_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +0 -1
index 3662157..ec10533 100644
@@ -1129,12 +1129,12 @@ void radeon_vm_bo_rmv(struct radeon_device *rdev,
 		interval_tree_remove(&bo_va->it, &vm->va);
 
 	spin_lock(&vm->status_lock);
-	if (list_empty(&bo_va->vm_status)) {

drivers/gpu/drm/radeon/radeon_vm.c void radeon_vm_bo_rmv(struct radeon_device *rdev, · line 1140

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_vm.c +2 -1
+	list_del(&bo_va->vm_status);
+	if (bo_va->it.start || bo_va->it.last) {
 		bo_va->bo = radeon_bo_ref(bo_va->bo);
 		list_add(&bo_va->vm_status, &vm->freed);
 	} else {
 		radeon_fence_unref(&bo_va->last_pt_update);
-		list_del(&bo_va->vm_status);
 		kfree(bo_va);
 	}
 	spin_unlock(&vm->status_lock);

Even with this v2 patch, I was still running into these messages sometimes, accompanied by Mesa complaining about a CS being rejected and visual corruption:

radeon 0000:00:01.0: bo ffff88021b433000 don't has a mapping in vm ffff8802355c1800

I tested the v1 patch again, same problem.

Reverting commit 161ab658a611df14fb0365b7b70a8c5fed3e4870 ("drm/radeon:
stop using addr to check for BO move") instead of applying this patch fixes it.

Unfortunately, I don't have a very reliable way to reproduce it. On this Kaveri laptop, it seemed to happen every time doing

xinit =xterm -- :1 -retro

which resulted in a completely corrupted display instead of the expected root weave and xterm window. However, I haven't seen it on my desktop Kaveri machine with either the v1 or v2 patch.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel