anv: if queue is NULL in vm_bind return early

In the error handling path we end up creating a vk_sync and then later
we vk_sync_wait() on it. If that wait fails somehow we'll end up calling
vk_queue_set_lost(&queue->vk, ...) which would segfault if queue is
NULL.

If we end up in this situation (no queue), return directly whatever the
backend's vm_bind function returned, propagating the error up if
necessary.

Fixes: dd5362c78a ("anv/xe: try harder when the vm_bind ioctl fails")
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31048>
This commit is contained in:
Dylan Baker
2024-09-05 11:43:36 -07:00
committed by Marge Bot
parent 0422eed255
commit ed8d1d3c9b
+5 -3
View File
@@ -795,11 +795,13 @@ anv_sparse_bind_vm_bind(struct anv_device *device,
{
struct anv_queue *queue = submit->queue;
if (!queue)
assert(submit->wait_count == 0 && submit->signal_count == 0);
VkResult result = device->kmd_backend->vm_bind(device, submit,
ANV_VM_BIND_FLAG_NONE);
if (!queue) {
assert(submit->wait_count == 0 && submit->signal_count == 0 &&
submit->binds_len == 1);
return result;
}
if (result == VK_ERROR_OUT_OF_HOST_MEMORY) {
/* If we get this, the system is under memory pressure. First we