anv/xe: don't leak xe_syncs during trtt submission

==134077== 96 bytes in 1 blocks are definitely lost in loss record 1 of 3
==134077==    at 0x4840808: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==134077==    by 0x6D6F690: vk_default_alloc (vk_alloc.c:26)
==134077==    by 0x52EEEBE: vk_alloc (vk_alloc.h:48)
==134077==    by 0x52EEEEE: vk_zalloc (vk_alloc.h:56)
==134077==    by 0x52EF47E: xe_exec_process_syncs (anv_batch_chain.c:132)
==134077==    by 0x52EF8F6: xe_execute_trtt_batch (anv_batch_chain.c:215)
==134077==    by 0x5301670: anv_queue_submit_trtt_batch (anv_batch_chain.c:1697)
==134077==    by 0x603D135: gfx125_write_trtt_entries (genX_cmd_buffer.c:6091)
==134077==    by 0x5370B44: anv_sparse_bind_trtt (anv_sparse.c:595)
==134077==    by 0x5370CFC: anv_sparse_bind (anv_sparse.c:629)
==134077==    by 0x5370E6E: anv_init_sparse_bindings (anv_sparse.c:670)
==134077==    by 0x5328037: anv_CreateBuffer (anv_device.c:5071)

Note to backporters: this is only for when xe.ko is being used and
ANV_SPARSE_USE_TRTT=1 is exported. This is not the regular code path.

Fixes: 18bd00c024 ("anv/trtt: don't wait/signal syncobjs using the CPU anymore")
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28455>
This commit is contained in:
Paulo Zanoni 2024-03-28 16:09:40 -07:00 committed by Marge Bot
parent 4cf272364b
commit 38af7254e2
1 changed files with 9 additions and 5 deletions

View File

@ -201,7 +201,7 @@ xe_execute_trtt_batch(struct anv_sparse_submission *submit,
struct anv_queue *queue = submit->queue;
struct anv_device *device = queue->device;
struct anv_trtt *trtt = &device->trtt;
VkResult result;
VkResult result = VK_SUCCESS;
struct drm_xe_sync extra_sync = {
.type = DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ,
@ -230,18 +230,22 @@ xe_execute_trtt_batch(struct anv_sparse_submission *submit,
};
if (!device->info->no_hw) {
if (intel_ioctl(device->fd, DRM_IOCTL_XE_EXEC, &exec))
return vk_device_set_lost(&device->vk, "XE_EXEC failed: %m");
if (intel_ioctl(device->fd, DRM_IOCTL_XE_EXEC, &exec)) {
result = vk_device_set_lost(&device->vk, "XE_EXEC failed: %m");
goto out;
}
}
if (queue->sync) {
result = vk_sync_wait(&device->vk, queue->sync, 0,
VK_SYNC_WAIT_COMPLETE, UINT64_MAX);
if (result != VK_SUCCESS)
return vk_queue_set_lost(&queue->vk, "trtt sync wait failed");
result = vk_queue_set_lost(&queue->vk, "trtt sync wait failed");
}
return VK_SUCCESS;
out:
vk_free(&device->vk.alloc, xe_syncs);
return result;
}
VkResult