Commit 3e04e2fe authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie

drm/vmwgfx: Fix execbuf locking issues

This addresses two issues that cause problems with viewperf maya-03 in
situation with memory pressure.

The first issue causes attempts to unreserve buffers if batched
reservation fails due to, for example, a signal pending. While previously
the ttm_eu api was resistant against this type of error, it is no longer
and the lockdep code will complain about attempting to unreserve buffers
that are not reserved. The issue is resolved by avoid calling
ttm_eu_backoff_reservation in the buffer reserve error path.

The second issue is that the binding_mutex may be held when user-space
fence objects are created and hence during memory reclaims. This may cause
recursive attempts to grab the binding mutex. The issue is resolved by not
holding the binding mutex across fence creation and submission.
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarSinclair Yeh <syeh@vmware.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 3c6d45b4
...@@ -2492,7 +2492,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, ...@@ -2492,7 +2492,7 @@ int vmw_execbuf_process(struct drm_file *file_priv,
ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes,
true, NULL); true, NULL);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_err; goto out_err_nores;
ret = vmw_validate_buffers(dev_priv, sw_context); ret = vmw_validate_buffers(dev_priv, sw_context);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
...@@ -2536,6 +2536,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, ...@@ -2536,6 +2536,7 @@ int vmw_execbuf_process(struct drm_file *file_priv,
vmw_resource_relocations_free(&sw_context->res_relocations); vmw_resource_relocations_free(&sw_context->res_relocations);
vmw_fifo_commit(dev_priv, command_size); vmw_fifo_commit(dev_priv, command_size);
mutex_unlock(&dev_priv->binding_mutex);
vmw_query_bo_switch_commit(dev_priv, sw_context); vmw_query_bo_switch_commit(dev_priv, sw_context);
ret = vmw_execbuf_fence_commands(file_priv, dev_priv, ret = vmw_execbuf_fence_commands(file_priv, dev_priv,
...@@ -2551,7 +2552,6 @@ int vmw_execbuf_process(struct drm_file *file_priv, ...@@ -2551,7 +2552,6 @@ int vmw_execbuf_process(struct drm_file *file_priv,
DRM_ERROR("Fence submission error. Syncing.\n"); DRM_ERROR("Fence submission error. Syncing.\n");
vmw_resource_list_unreserve(&sw_context->resource_list, false); vmw_resource_list_unreserve(&sw_context->resource_list, false);
mutex_unlock(&dev_priv->binding_mutex);
ttm_eu_fence_buffer_objects(&ticket, &sw_context->validate_nodes, ttm_eu_fence_buffer_objects(&ticket, &sw_context->validate_nodes,
(void *) fence); (void *) fence);
......
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