iris: Fix locking around vma_alloc in iris_bo_create_userptr
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 26 May 2019 22:57:55 +0000 (15:57 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 30 May 2019 02:40:16 +0000 (19:40 -0700)
util_vma needs to be protected by a lock.  All other callers of
vma_alloc and vma_free appear to be holding a lock already.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/gallium/drivers/iris/iris_bufmgr.c

index d89351043dff2a737e00def3767dcdb6aedbb2ff..1845e9898a05e93964e34b7fb6aefa89de74b21f 100644 (file)
@@ -581,7 +581,11 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
 
    bo->bufmgr = bufmgr;
    bo->kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
+
+   mtx_lock(&bufmgr->lock);
    bo->gtt_offset = vma_alloc(bufmgr, memzone, size, 1);
+   mtx_unlock(&bufmgr->lock);
+
    if (bo->gtt_offset == 0ull)
       goto err_close;