intel/ds: Fix crash when allocating more intel_ds_queues than u_vector was initialized
u_vector_add() don't keep the returned pointers valid.
After the initial size allocated in u_vector_init() is reached it will
allocate a bigger buffer and copy data from older buffer to the new
one and free the old buffer, making all the previous pointers returned
by u_vector_add() invalid and crashing the application when trying to
access it.
This is reproduced when running
dEQP-VK.synchronization.signal_order.timeline_semaphore.* in DG2 SKUs
that has 4 CCS engines, INTEL_COMPUTE_CLASS=1 is set and of course
perfetto build is enabled.
To fix this issue here I'm moving the storage/allocation of
struct intel_ds_queue to struct anv_queue/iris_batch and using
struct list_head to maintain a chain of intel_ds_queue of the
intel_ds_device.
This allows us to append or remove queues dynamically in future if
necessary.
Fixes: e760c5b37b ("anv: add perfetto source")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20977>
This commit is contained in:
committed by
Marge Bot
parent
1b3c746eec
commit
8092bc2158
@@ -1341,14 +1341,14 @@ anv_queue_submit(struct vk_queue *vk_queue,
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
uint64_t start_ts = intel_ds_begin_submit(queue->ds);
|
||||
uint64_t start_ts = intel_ds_begin_submit(&queue->ds);
|
||||
|
||||
pthread_mutex_lock(&device->mutex);
|
||||
result = anv_queue_submit_locked(queue, submit);
|
||||
/* Take submission ID under lock */
|
||||
pthread_mutex_unlock(&device->mutex);
|
||||
|
||||
intel_ds_end_submit(queue->ds, start_ts);
|
||||
intel_ds_end_submit(&queue->ds, start_ts);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1055,7 +1055,7 @@ struct anv_queue {
|
||||
/** Synchronization object for debug purposes (DEBUG_SYNC) */
|
||||
struct vk_sync *sync;
|
||||
|
||||
struct intel_ds_queue * ds;
|
||||
struct intel_ds_queue ds;
|
||||
};
|
||||
|
||||
struct nir_xfb_info;
|
||||
|
||||
@@ -114,7 +114,7 @@ anv_device_utrace_flush_cmd_buffers(struct anv_queue *queue,
|
||||
if (!flush)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
intel_ds_flush_data_init(&flush->ds, queue->ds, queue->ds->submission_id);
|
||||
intel_ds_flush_data_init(&flush->ds, &queue->ds, queue->ds.submission_id);
|
||||
|
||||
result = vk_sync_create(&device->vk, &device->physical->sync_syncobj_type,
|
||||
0, 0, &flush->sync);
|
||||
@@ -288,10 +288,9 @@ anv_device_utrace_init(struct anv_device *device)
|
||||
for (uint32_t q = 0; q < device->queue_count; q++) {
|
||||
struct anv_queue *queue = &device->queues[q];
|
||||
|
||||
queue->ds =
|
||||
intel_ds_device_add_queue(&device->ds, "%s%u",
|
||||
intel_engines_class_to_string(queue->family->engine_class),
|
||||
queue->vk.index_in_family);
|
||||
intel_ds_device_init_queue(&device->ds, &queue->ds, "%s%u",
|
||||
intel_engines_class_to_string(queue->family->engine_class),
|
||||
queue->vk.index_in_family);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user