Commit 374c3af8 authored by Francisco Jerez's avatar Francisco Jerez Committed by Ben Skeggs

drm/nouveau: Don't take struct_mutex around the pushbuf IOCTL.

We don't need it and it can lead to lock order inversions with respect
to drm_global_mutex, potentially causing dead locks.
Signed-off-by: default avatarFrancisco Jerez <currojerez@riseup.net>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 3ba64623
...@@ -245,7 +245,7 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence) ...@@ -245,7 +245,7 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence)
list_del(&nvbo->entry); list_del(&nvbo->entry);
nvbo->reserved_by = NULL; nvbo->reserved_by = NULL;
ttm_bo_unreserve(&nvbo->bo); ttm_bo_unreserve(&nvbo->bo);
drm_gem_object_unreference(nvbo->gem); drm_gem_object_unreference_unlocked(nvbo->gem);
} }
} }
...@@ -300,7 +300,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv, ...@@ -300,7 +300,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
validate_fini(op, NULL); validate_fini(op, NULL);
if (ret == -EAGAIN) if (ret == -EAGAIN)
ret = ttm_bo_wait_unreserved(&nvbo->bo, false); ret = ttm_bo_wait_unreserved(&nvbo->bo, false);
drm_gem_object_unreference(gem); drm_gem_object_unreference_unlocked(gem);
if (ret) { if (ret) {
NV_ERROR(dev, "fail reserve\n"); NV_ERROR(dev, "fail reserve\n");
return ret; return ret;
...@@ -616,8 +616,6 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ...@@ -616,8 +616,6 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
return PTR_ERR(bo); return PTR_ERR(bo);
} }
mutex_lock(&dev->struct_mutex);
/* Mark push buffers as being used on PFIFO, the validation code /* Mark push buffers as being used on PFIFO, the validation code
* will then make sure that if the pushbuf bo moves, that they * will then make sure that if the pushbuf bo moves, that they
* happen on the kernel channel, which will in turn cause a sync * happen on the kernel channel, which will in turn cause a sync
...@@ -731,7 +729,6 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ...@@ -731,7 +729,6 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data,
out: out:
validate_fini(&op, fence); validate_fini(&op, fence);
nouveau_fence_unref((void**)&fence); nouveau_fence_unref((void**)&fence);
mutex_unlock(&dev->struct_mutex);
kfree(bo); kfree(bo);
kfree(push); kfree(push);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment