Skip to contentSkip to conversation

drm/radeon: fix vm lock in radeon_gem_va_update_vm

PATCH In review Christian König 2 participants 2 messages Oct 23, 2014 – Oct 27, 2014

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

PATCH 1/1 drm/radeon: fix vm lock in radeon_gem_va_update_vm

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

Without the lock we might corrupt the BO lists.

Might be squashed into "update the VM after setting BO address" for upstreaming.

---
 drivers/gpu/drm/radeon/radeon_gem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_gem.c +5 -1
index 0002575..49d56b5 100644
@@ -559,12 +559,16 @@ static void radeon_gem_va_update_vm(struct radeon_device *rdev,
 			goto error_unreserve;
 	}
 
+	mutex_lock(&bo_va->vm->mutex);
 	r = radeon_vm_clear_freed(rdev, bo_va->vm);
 	if (r)
-		goto error_unreserve;
+		goto error_unlock;
 
 	r = radeon_vm_bo_update(rdev, bo_va, &bo_va->bo->tbo.mem);
 
+error_unlock:
+	mutex_unlock(&bo_va->vm->mutex);
+
 error_unreserve:
 	ttm_eu_backoff_reservation(&ticket, &list);
 
Signature · 6 lines
1.9.1

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

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

Without the lock we might corrupt the BO lists.

Might be squashed into "update the VM after setting BO address" for upstreaming.

Squashed into that commit.

Thanks!

Alex

Quoted 29 lines
---
 drivers/gpu/drm/radeon/radeon_gem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_gem.c +5 -2
index 0002575..49d56b5 100644
@@ -559,12 +559,16 @@ static void radeon_gem_va_update_vm(struct radeon_device *rdev,
                        goto error_unreserve;
        }
 
+       mutex_lock(&bo_va->vm->mutex);
        r = radeon_vm_clear_freed(rdev, bo_va->vm);
        if (r)
-               goto error_unreserve;
+               goto error_unlock;
 
        r = radeon_vm_bo_update(rdev, bo_va, &bo_va->bo->tbo.mem);
 
+error_unlock:
+       mutex_unlock(&bo_va->vm->mutex);
+
 error_unreserve:
        ttm_eu_backoff_reservation(&ticket, &list);
 
--
Quoted 2 lines

1.9.1

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