Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>
Subject: [PATCH v2 2/2] drm/xe: Set job credits based on LRC size
Date: Fri, 25 Sep 2026 19:26:06 +0200	[thread overview]
Message-ID: <20260925172603.302050-6-dev@lankhorst.se> (raw)
In-Reply-To: <20260925172603.302050-4-dev@lankhorst.se>

This allows to fill the entire LRC and increase
to a higher limit of outstanding jobs without throttling.

Set maximum fill level to lrc_size - 4, to avoid wraparound
and ensure the job is 8 byte aligned, since we insert a MI_NOOP
in xe_lrc_write_ring() that needs to be accounted for.

Changes since previous version:
- Prevent filling LRC to max.
- Reserve space for MI_NOOP.

Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
 drivers/gpu/drm/xe/xe_execlist.c   |  2 +-
 drivers/gpu/drm/xe/xe_guc_submit.c |  2 +-
 drivers/gpu/drm/xe/xe_sched_job.c  | 10 +++++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_execlist.c b/drivers/gpu/drm/xe/xe_execlist.c
index a36db39dcda8a..24469990ece97 100644
--- a/drivers/gpu/drm/xe/xe_execlist.c
+++ b/drivers/gpu/drm/xe/xe_execlist.c
@@ -329,7 +329,7 @@ static int execlist_exec_queue_init(struct xe_exec_queue *q)
 	const struct drm_sched_init_args args = {
 		.ops = &drm_sched_ops,
 		.num_rqs = 1,
-		.credit_limit = xe_lrc_ring_size() / MAX_JOB_SIZE_BYTES,
+		.credit_limit = xe_lrc_ring_size() - 4,
 		.hang_limit = XE_SCHED_HANG_LIMIT,
 		.timeout = XE_SCHED_JOB_TIMEOUT,
 		.name = q->hwe->name,
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index f3ba8abfc228e..264e961fd7d71 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -2089,7 +2089,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
 	}
 
 	err = xe_sched_init(&ge->sched, &drm_sched_ops, &xe_sched_ops,
-			    submit_wq, xe_lrc_ring_size() / MAX_JOB_SIZE_BYTES, 64,
+			    submit_wq, xe_lrc_ring_size() - 4, 64,
 			    timeout, guc_to_gt(guc)->ordered_wq, NULL,
 			    ge->name, gt_to_xe(q->gt)->drm.dev);
 	if (err)
diff --git a/drivers/gpu/drm/xe/xe_sched_job.c b/drivers/gpu/drm/xe/xe_sched_job.c
index 57ed6734d31d5..6e6345ee0977f 100644
--- a/drivers/gpu/drm/xe/xe_sched_job.c
+++ b/drivers/gpu/drm/xe/xe_sched_job.c
@@ -114,8 +114,8 @@ struct xe_sched_job *xe_sched_job_create(struct xe_exec_queue *q,
 	kref_init(&job->refcount);
 	xe_exec_queue_get(job->q);
 
-	err = drm_sched_job_init(&job->drm, q->entity, 1, NULL,
-				 q->xef ? q->xef->drm->client_id : 0);
+	err = drm_sched_job_init(&job->drm, q->entity, MAX_JOB_SIZE_BYTES,
+				 NULL, q->xef ? q->xef->drm->client_id : 0);
 	if (err)
 		goto err_free;
 
@@ -295,9 +295,13 @@ void xe_sched_job_push(struct xe_sched_job *job)
 	xe_sched_job_get(job);
 	trace_xe_sched_job_exec(job);
 
-	if (!job->restore_replay)
+	if (!job->restore_replay) {
 		job->q->ring_ops->prepare_job(job);
 
+		/* A MI_NOOP is inserted if job size is not aligned to 8 */
+		job->drm.credits = ALIGN(job->ptrs[0].job_size, 8);
+	}
+
 	drm_sched_entity_push_job(&job->drm);
 	xe_sched_job_put(job);
 }
-- 
2.55.0


  parent reply	other threads:[~2026-09-25 17:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 17:26 [PATCH v2 0/2] drm/xe: Increase job depth Maarten Lankhorst
2026-09-25 17:26 ` [PATCH v2 1/2] drm/xe: Convert job preparation in 2 stages Maarten Lankhorst
2026-09-25 17:26 ` Maarten Lankhorst [this message]
2026-09-25 17:43   ` [PATCH v2 2/2] drm/xe: Set job credits based on LRC size sashiko-bot
2026-09-25 17:33 ` ✗ CI.checkpatch: warning for drm/xe: Increase job depth. (rev2) Patchwork
2026-09-25 17:35 ` ✓ CI.KUnit: success " Patchwork
2026-09-25 18:34 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-26  2:26 ` ✗ Xe.CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925172603.302050-6-dev@lankhorst.se \
    --to=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox