Skip to contentSkip to conversation

drm/radeon: allways add the VM clear duplicate

PATCH In review Christian König 3 participants 10 messages Jul 8, 2015

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

PATCH 1/2 drm/radeon: allways add the VM clear duplicate

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

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

---
 drivers/gpu/drm/radeon/radeon_vm.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +16 -18
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev,
 	}
 
 	if (bo_va->it.start || bo_va->it.last) {
-		spin_lock(&vm->status_lock);
-		if (list_empty(&bo_va->vm_status)) {
-			/* add a clone of the bo_va to clear the old address */
-			struct radeon_bo_va *tmp;
-			spin_unlock(&vm->status_lock);
-			tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
-			if (!tmp) {
-				mutex_unlock(&vm->mutex);
-				r = -ENOMEM;
-				goto error_unreserve;
-			}
-			tmp->it.start = bo_va->it.start;
-			tmp->it.last = bo_va->it.last;
-			tmp->vm = vm;
-			tmp->bo = radeon_bo_ref(bo_va->bo);
-			spin_lock(&vm->status_lock);
-			list_add(&tmp->vm_status, &vm->freed);
+		/* add a clone of the bo_va to clear the old address */
+		struct radeon_bo_va *tmp;
+		tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
+		if (!tmp) {
+			mutex_unlock(&vm->mutex);
+			r = -ENOMEM;
+			goto error_unreserve;
 		}
-		spin_unlock(&vm->status_lock);
+		tmp->it.start = bo_va->it.start;
+		tmp->it.last = bo_va->it.last;
+		tmp->vm = vm;
+		tmp->bo = radeon_bo_ref(bo_va->bo);
 
 		interval_tree_remove(&bo_va->it, &vm->va);
 		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) {
Signature · 6 lines
1.9.1

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

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

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

Otherwise we try to clear BO_VAs without an address.

---
 drivers/gpu/drm/radeon/radeon_vm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +5 -5
index 0310965..48d97c0 100644
@@ -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);
 	}
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Tested-by on v1 2/2
#2 lore raw

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

Quoted 8 lines · Christian König

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

Otherwise we try to clear BO_VAs without an address.

This series is

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
#3 lore raw
In reply to Christian König
Quoted 7 lines · Christian König

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

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

This patch does not apply cleanly. It also adds an undefined label error_unreserve. Is there an additional patch required?

Alex

Quoted 55 lines
---
 drivers/gpu/drm/radeon/radeon_vm.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +16 -19
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev,
        }
 
        if (bo_va->it.start || bo_va->it.last) {
-               spin_lock(&vm->status_lock);
-               if (list_empty(&bo_va->vm_status)) {
-                       /* add a clone of the bo_va to clear the old address */
-                       struct radeon_bo_va *tmp;
-                       spin_unlock(&vm->status_lock);
-                       tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
-                       if (!tmp) {
-                               mutex_unlock(&vm->mutex);
-                               r = -ENOMEM;
-                               goto error_unreserve;
-                       }
-                       tmp->it.start = bo_va->it.start;
-                       tmp->it.last = bo_va->it.last;
-                       tmp->vm = vm;
-                       tmp->bo = radeon_bo_ref(bo_va->bo);
-                       spin_lock(&vm->status_lock);
-                       list_add(&tmp->vm_status, &vm->freed);
+               /* add a clone of the bo_va to clear the old address */
+               struct radeon_bo_va *tmp;
+               tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
+               if (!tmp) {
+                       mutex_unlock(&vm->mutex);
+                       r = -ENOMEM;
+                       goto error_unreserve;
                }
-               spin_unlock(&vm->status_lock);
+               tmp->it.start = bo_va->it.start;
+               tmp->it.last = bo_va->it.last;
+               tmp->vm = vm;
+               tmp->bo = radeon_bo_ref(bo_va->bo);
 
                interval_tree_remove(&bo_va->it, &vm->va);
                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) {
--
Quoted 2 lines

1.9.1

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

#4 lore raw
Quoted 10 lines · Alex Deucher
Quoted 7 lines · Christian König

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

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

This patch does not apply cleanly. It also adds an undefined label error_unreserve. Is there an additional patch required?

That's possible, but I thought the depending patch would have already been upstream.

Can you create a drm-fixes-4.2 branch I can rebase on?

Thanks,
Christian.

Quoted 55 lines

Alex

Quoted 53 lines
---
  drivers/gpu/drm/radeon/radeon_vm.c | 34 ++++++++++++++++------------------
  1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +16 -18
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev,
         }
 
         if (bo_va->it.start || bo_va->it.last) {
-               spin_lock(&vm->status_lock);
-               if (list_empty(&bo_va->vm_status)) {
-                       /* add a clone of the bo_va to clear the old address */
-                       struct radeon_bo_va *tmp;
-                       spin_unlock(&vm->status_lock);
-                       tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
-                       if (!tmp) {
-                               mutex_unlock(&vm->mutex);
-                               r = -ENOMEM;
-                               goto error_unreserve;
-                       }
-                       tmp->it.start = bo_va->it.start;
-                       tmp->it.last = bo_va->it.last;
-                       tmp->vm = vm;
-                       tmp->bo = radeon_bo_ref(bo_va->bo);
-                       spin_lock(&vm->status_lock);
-                       list_add(&tmp->vm_status, &vm->freed);
+               /* add a clone of the bo_va to clear the old address */
+               struct radeon_bo_va *tmp;
+               tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
+               if (!tmp) {
+                       mutex_unlock(&vm->mutex);
+                       r = -ENOMEM;
+                       goto error_unreserve;
                 }
-               spin_unlock(&vm->status_lock);
+               tmp->it.start = bo_va->it.start;
+               tmp->it.last = bo_va->it.last;
+               tmp->vm = vm;
+               tmp->bo = radeon_bo_ref(bo_va->bo);
 
                 interval_tree_remove(&bo_va->it, &vm->va);
                 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);
         }
 
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/radeon/radeon_vm.c +0 -1
         if (soffset || eoffset) {
--

1.9.1

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

#5 lore raw
Quoted 13 lines · Christian König
Quoted 12 lines · Alex Deucher
Quoted 8 lines · Christian König

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

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

Quoted 8 lines
Quoted 2 lines

This patch does not apply cleanly. It also adds an undefined label error_unreserve. Is there an additional patch required?

That's possible, but I thought the depending patch would have already been upstream.

Can you create a drm-fixes-4.2 branch I can rebase on?

http://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-fixes-4.2-wip

Thanks,

Alex

Quoted 65 lines

Thanks,
Christian.

Quoted 60 lines

Alex

Quoted 58 lines
---
  drivers/gpu/drm/radeon/radeon_vm.c | 34
++++++++++++++++------------------
  1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +0 -3
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device
 *rdev,
         }
 
         if (bo_va->it.start || bo_va->it.last) {
-               spin_lock(&vm->status_lock);
-               if (list_empty(&bo_va->vm_status)) {
-                       /* add a clone of the bo_va to clear the old

address */

drivers/gpu/drm/radeon/radeon_vm.c +0 -3
-                       struct radeon_bo_va *tmp;
-                       spin_unlock(&vm->status_lock);
-                       tmp = kzalloc(sizeof(struct radeon_bo_va),

GFP_KERNEL);

drivers/gpu/drm/radeon/radeon_vm.c +16 -12
-                       if (!tmp) {
-                               mutex_unlock(&vm->mutex);
-                               r = -ENOMEM;
-                               goto error_unreserve;
-                       }
-                       tmp->it.start = bo_va->it.start;
-                       tmp->it.last = bo_va->it.last;
-                       tmp->vm = vm;
-                       tmp->bo = radeon_bo_ref(bo_va->bo);
-                       spin_lock(&vm->status_lock);
-                       list_add(&tmp->vm_status, &vm->freed);
+               /* add a clone of the bo_va to clear the old address */
+               struct radeon_bo_va *tmp;
+               tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
+               if (!tmp) {
+                       mutex_unlock(&vm->mutex);
+                       r = -ENOMEM;
+                       goto error_unreserve;
                 }
-               spin_unlock(&vm->status_lock);
+               tmp->it.start = bo_va->it.start;
+               tmp->it.last = bo_va->it.last;
+               tmp->vm = vm;
+               tmp->bo = radeon_bo_ref(bo_va->bo);
 
                 interval_tree_remove(&bo_va->it, &vm->va);
                 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);
         }
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
         if (soffset || eoffset) {

--
1.9.1

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

#6 lore raw
Quoted 12 lines · Alex Deucher
Quoted 10 lines · Christian König
Quoted 9 lines · Alex Deucher
Quoted 7 lines · Christian König

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

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

This patch does not apply cleanly. It also adds an undefined label error_unreserve. Is there an additional patch required?

That's possible, but I thought the depending patch would have already been upstream.

Can you create a drm-fixes-4.2 branch I can rebase on?

http://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-fixes-4.2-wip

Ah, here is the problem. This branch don't yet contains the fixes which went upstream with 4.1.

What should we do? I don't want to change those patches and create a merge conflict when you merge in 4.1.

Christian.

Quoted 69 lines

Thanks,

Alex

Quoted 64 lines

Thanks,
Christian.

Quoted 60 lines

Alex

Quoted 58 lines
---
   drivers/gpu/drm/radeon/radeon_vm.c | 34
++++++++++++++++------------------
   1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +0 -3
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device
 *rdev,
          }
 
          if (bo_va->it.start || bo_va->it.last) {
-               spin_lock(&vm->status_lock);
-               if (list_empty(&bo_va->vm_status)) {
-                       /* add a clone of the bo_va to clear the old

address */

drivers/gpu/drm/radeon/radeon_vm.c +0 -3
-                       struct radeon_bo_va *tmp;
-                       spin_unlock(&vm->status_lock);
-                       tmp = kzalloc(sizeof(struct radeon_bo_va),

GFP_KERNEL);

drivers/gpu/drm/radeon/radeon_vm.c +16 -12
-                       if (!tmp) {
-                               mutex_unlock(&vm->mutex);
-                               r = -ENOMEM;
-                               goto error_unreserve;
-                       }
-                       tmp->it.start = bo_va->it.start;
-                       tmp->it.last = bo_va->it.last;
-                       tmp->vm = vm;
-                       tmp->bo = radeon_bo_ref(bo_va->bo);
-                       spin_lock(&vm->status_lock);
-                       list_add(&tmp->vm_status, &vm->freed);
+               /* add a clone of the bo_va to clear the old address */
+               struct radeon_bo_va *tmp;
+               tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
+               if (!tmp) {
+                       mutex_unlock(&vm->mutex);
+                       r = -ENOMEM;
+                       goto error_unreserve;
                  }
-               spin_unlock(&vm->status_lock);
+               tmp->it.start = bo_va->it.start;
+               tmp->it.last = bo_va->it.last;
+               tmp->vm = vm;
+               tmp->bo = radeon_bo_ref(bo_va->bo);
 
                  interval_tree_remove(&bo_va->it, &vm->va);
                  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);
          }
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
          if (soffset || eoffset) {

--
1.9.1

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

#7 lore raw
Quoted 29 lines · Christian König
Quoted 28 lines · Alex Deucher
Quoted 24 lines · Christian König
Quoted 7 lines · Alex Deucher
Quoted 3 lines · Christian König

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

Quoted 8 lines
Quoted 5 lines

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

This patch does not apply cleanly. It also adds an undefined label error_unreserve. Is there an additional patch required?

That's possible, but I thought the depending patch would have already been
upstream.

Can you create a drm-fixes-4.2 branch I can rebase on?

Quoted 8 lines
Quoted 1 line

http://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-fixes-4.2-wip

Ah, here is the problem. This branch don't yet contains the fixes which went upstream with 4.1.

What should we do? I don't want to change those patches and create a merge conflict when you merge in 4.1.

I'll rebase by tree on Linus' tree. Dave is on vacation so his tree is lagging.

Alex

Quoted 73 lines

Christian.

Quoted 69 lines

Thanks,

Alex

Quoted 64 lines

Thanks,
Christian.

Quoted 60 lines

Alex

Quoted 58 lines
---
   drivers/gpu/drm/radeon/radeon_vm.c | 34
++++++++++++++++------------------
   1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +0 -3
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device
 *rdev,
          }
 
          if (bo_va->it.start || bo_va->it.last) {
-               spin_lock(&vm->status_lock);
-               if (list_empty(&bo_va->vm_status)) {
-                       /* add a clone of the bo_va to clear the old

address */

drivers/gpu/drm/radeon/radeon_vm.c +0 -3
-                       struct radeon_bo_va *tmp;
-                       spin_unlock(&vm->status_lock);
-                       tmp = kzalloc(sizeof(struct radeon_bo_va),

GFP_KERNEL);

drivers/gpu/drm/radeon/radeon_vm.c +16 -12
-                       if (!tmp) {
-                               mutex_unlock(&vm->mutex);
-                               r = -ENOMEM;
-                               goto error_unreserve;
-                       }
-                       tmp->it.start = bo_va->it.start;
-                       tmp->it.last = bo_va->it.last;
-                       tmp->vm = vm;
-                       tmp->bo = radeon_bo_ref(bo_va->bo);
-                       spin_lock(&vm->status_lock);
-                       list_add(&tmp->vm_status, &vm->freed);
+               /* add a clone of the bo_va to clear the old address */
+               struct radeon_bo_va *tmp;
+               tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
+               if (!tmp) {
+                       mutex_unlock(&vm->mutex);
+                       r = -ENOMEM;
+                       goto error_unreserve;
                  }
-               spin_unlock(&vm->status_lock);
+               tmp->it.start = bo_va->it.start;
+               tmp->it.last = bo_va->it.last;
+               tmp->vm = vm;
+               tmp->bo = radeon_bo_ref(bo_va->bo);
 
                  interval_tree_remove(&bo_va->it, &vm->va);
                  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);
          }
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
          if (soffset || eoffset) {

--
1.9.1

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

#8 lore raw
Quoted 24 lines · Alex Deucher
Quoted 22 lines · Christian König
Quoted 21 lines · Alex Deucher
Quoted 19 lines · Christian König
Quoted 5 lines · Alex Deucher
Quoted 2 lines · Christian König

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

Quoted 7 lines
Quoted 5 lines

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

This patch does not apply cleanly. It also adds an undefined label error_unreserve. Is there an additional patch required?

That's possible, but I thought the depending patch would have already been
upstream.

Can you create a drm-fixes-4.2 branch I can rebase on?

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

http://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-fixes-4.2-wip

Ah, here is the problem. This branch don't yet contains the fixes which went upstream with 4.1.

What should we do? I don't want to change those patches and create a merge conflict when you merge in 4.1.

I'll rebase by tree on Linus' tree. Dave is on vacation so his tree is lagging.

Sounds good, let me know when you have updated the branch and there are still conflicts.

Regards,
Christian.

Quoted 74 lines

Alex

Quoted 71 lines

Christian.

Quoted 68 lines

Thanks,

Alex

Quoted 64 lines

Thanks,
Christian.

Quoted 60 lines

Alex

Quoted 58 lines
---
    drivers/gpu/drm/radeon/radeon_vm.c | 34
++++++++++++++++------------------
    1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +0 -3
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device
 *rdev,
           }
 
           if (bo_va->it.start || bo_va->it.last) {
-               spin_lock(&vm->status_lock);
-               if (list_empty(&bo_va->vm_status)) {
-                       /* add a clone of the bo_va to clear the old

address */

drivers/gpu/drm/radeon/radeon_vm.c +0 -3
-                       struct radeon_bo_va *tmp;
-                       spin_unlock(&vm->status_lock);
-                       tmp = kzalloc(sizeof(struct radeon_bo_va),

GFP_KERNEL);

drivers/gpu/drm/radeon/radeon_vm.c +16 -12
-                       if (!tmp) {
-                               mutex_unlock(&vm->mutex);
-                               r = -ENOMEM;
-                               goto error_unreserve;
-                       }
-                       tmp->it.start = bo_va->it.start;
-                       tmp->it.last = bo_va->it.last;
-                       tmp->vm = vm;
-                       tmp->bo = radeon_bo_ref(bo_va->bo);
-                       spin_lock(&vm->status_lock);
-                       list_add(&tmp->vm_status, &vm->freed);
+               /* add a clone of the bo_va to clear the old address */
+               struct radeon_bo_va *tmp;
+               tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL);
+               if (!tmp) {
+                       mutex_unlock(&vm->mutex);
+                       r = -ENOMEM;
+                       goto error_unreserve;
                   }
-               spin_unlock(&vm->status_lock);
+               tmp->it.start = bo_va->it.start;
+               tmp->it.last = bo_va->it.last;
+               tmp->vm = vm;
+               tmp->bo = radeon_bo_ref(bo_va->bo);
 
                   interval_tree_remove(&bo_va->it, &vm->va);
                   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);
           }
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
           if (soffset || eoffset) {

--
1.9.1

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

#9 lore raw
Quoted 45 lines · Christian König
Quoted 44 lines · Alex Deucher
Quoted 40 lines · Christian König
Quoted 22 lines · Alex Deucher
Quoted 19 lines · Christian König
Quoted 15 lines · Alex Deucher
Quoted 8 lines · Christian König

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

We need to allways add the VM clear duplicate of the BO_VA, no matter what the old status was.

This patch does not apply cleanly. It also adds an undefined label error_unreserve. Is there an additional patch required?

Quoted 7 lines
Quoted 5 lines

That's possible, but I thought the depending patch would have already been
upstream.

Can you create a drm-fixes-4.2 branch I can rebase on?

http://cgit.freedesktop.org/~agd5f/linux/log/?h=drm-fixes-4.2-wip

Ah, here is the problem. This branch don't yet contains the fixes which went
upstream with 4.1.

What should we do? I don't want to change those patches and create a merge
conflict when you merge in 4.1.

Quoted 6 lines
Quoted 2 lines

I'll rebase by tree on Linus' tree. Dave is on vacation so his tree is lagging.

Sounds good, let me know when you have updated the branch and there are still conflicts.

All set.

Thanks,

Alex

Quoted 81 lines

Regards,
Christian.

Quoted 76 lines

Alex

Quoted 73 lines

Christian.

Quoted 70 lines

Thanks,

Alex

Quoted 66 lines

Thanks,
Christian.

Quoted 62 lines

Alex

Quoted 60 lines
---
    drivers/gpu/drm/radeon/radeon_vm.c | 34
++++++++++++++++------------------
    1 file changed, 16 insertions(+), 18 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +0 -3
index ec10533..0310965 100644
@@ -493,29 +493,27 @@ int radeon_vm_bo_set_addr(struct radeon_device
 *rdev,
           }
 
           if (bo_va->it.start || bo_va->it.last) {
-               spin_lock(&vm->status_lock);
-               if (list_empty(&bo_va->vm_status)) {
-                       /* add a clone of the bo_va to clear the old

address */

drivers/gpu/drm/radeon/radeon_vm.c +0 -3
-                       struct radeon_bo_va *tmp;
-                       spin_unlock(&vm->status_lock);
-                       tmp = kzalloc(sizeof(struct radeon_bo_va),

GFP_KERNEL);

drivers/gpu/drm/radeon/radeon_vm.c +1 -11
-                       if (!tmp) {
-                               mutex_unlock(&vm->mutex);
-                               r = -ENOMEM;
-                               goto error_unreserve;
-                       }
-                       tmp->it.start = bo_va->it.start;
-                       tmp->it.last = bo_va->it.last;
-                       tmp->vm = vm;
-                       tmp->bo = radeon_bo_ref(bo_va->bo);
-                       spin_lock(&vm->status_lock);
-                       list_add(&tmp->vm_status, &vm->freed);
+               /* add a clone of the bo_va to clear the old address

*/

drivers/gpu/drm/radeon/radeon_vm.c +2 -0
+               struct radeon_bo_va *tmp;
+               tmp = kzalloc(sizeof(struct radeon_bo_va),

GFP_KERNEL);

drivers/gpu/drm/radeon/radeon_vm.c +13 -1
+               if (!tmp) {
+                       mutex_unlock(&vm->mutex);
+                       r = -ENOMEM;
+                       goto error_unreserve;
                   }
-               spin_unlock(&vm->status_lock);
+               tmp->it.start = bo_va->it.start;
+               tmp->it.last = bo_va->it.last;
+               tmp->vm = vm;
+               tmp->bo = radeon_bo_ref(bo_va->bo);
 
                   interval_tree_remove(&bo_va->it, &vm->va);
                   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);
           }
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
           if (soffset || eoffset) {

--
1.9.1

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