[PATCH] drm/radeon: fix vm lock in radeon_gem_va_update_vm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian König <christian.koenig@xxxxxxx>

Without the lock we might corrupt the BO lists.

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

Signed-off-by: Christian König <christian.koenig@xxxxxxx>
---
 drivers/gpu/drm/radeon/radeon_gem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 0002575..49d56b5 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -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);
 
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux