[PATCH] Submit on user exec_q
Ashutosh Dixit
ashutosh.dixit at intel.com
Thu Sep 28 15:35:54 UTC 2023
Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
drivers/gpu/drm/xe/xe_oa.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index 73558c3cb2c8b..7d7668cd5a98c 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -660,20 +660,27 @@ static __poll_t xe_oa_poll(struct file *file, poll_table *wait)
static int xe_oa_submit_bb(struct xe_oa_stream *stream, struct xe_bb *bb)
{
+ struct xe_exec_queue *q = stream->exec_q;
struct xe_hw_engine *hwe = stream->hwe;
struct xe_sched_job *job;
- struct xe_exec_queue *q;
struct dma_fence *fence;
+ struct xe_vm *vm;
long timeout;
int err = 0;
- q = xe_exec_queue_create(hwe->gt->tile->xe, NULL, BIT(hwe->logical_instance), 1,
- hwe, EXEC_QUEUE_FLAG_KERNEL);
- if (IS_ERR(q)) {
- err = PTR_ERR(q);
- drm_err(&stream->oa->xe->drm, "gt%d, hwe %s, xe_exec_queue_create failed=%d",
- stream->gt->info.id, hwe->name, err);
- goto exit;
+ if (!stream->exec_q) {
+ q = xe_exec_queue_create(hwe->gt->tile->xe, NULL, BIT(hwe->logical_instance), 1,
+ hwe, EXEC_QUEUE_FLAG_KERNEL);
+ if (IS_ERR(q)) {
+ err = PTR_ERR(q);
+ drm_err(&stream->oa->xe->drm, "gt%d, hwe %s, xe_exec_queue_create failed=%d",
+ stream->gt->info.id, hwe->name, err);
+ goto exit;
+ }
+ } else {
+ q->flags |= EXEC_QUEUE_FLAG_KERNEL;
+ vm = q->vm;
+ q->vm = NULL;
}
/* Will add MI_BATCH_BUFFER_END */
@@ -694,7 +701,13 @@ static int xe_oa_submit_bb(struct xe_oa_stream *stream, struct xe_bb *bb)
else if (!timeout)
err = -ETIME;
put_exec_q:
- xe_exec_queue_put(q);
+ if (!stream->exec_q) {
+ xe_exec_queue_put(q);
+ } else {
+ /* Restore exec_q state */
+ q->flags &= ~EXEC_QUEUE_FLAG_KERNEL;
+ q->vm = vm;
+ }
exit:
return err;
}
--
2.41.0
More information about the Intel-gfx-trybot
mailing list