Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Maarten Lankhorst" <dev@lankhorst.se>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/xe: Set job credits based on LRC size
Date: Fri, 25 Sep 2026 17:43:03 +0000	[thread overview]
Message-ID: <20260925174303.84EFF1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260925172603.302050-6-dev@lankhorst.se>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/xe: Ring buffer overflow due to static LRC initialization not accounted in credit limit
--

commit 89815f911de168c13f3cdfa254a0cefac8d7b016
Author: Maarten Lankhorst <dev@lankhorst.se>
drm/xe: Set job credits based on LRC size

This commit changes the scheduler credit limit to be based on the full LRC
size minus 4, rather than dividing by MAX_JOB_SIZE_BYTES, to allow filling
the entire LRC without throttling.

> 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,

[Severity: High]
Does this limit account for the static initialization bytes emitted by
xe_lrc_init()? Since xe_lrc_init() emits 8 or 24 bytes of static initialization
commands into the ring buffer, advancing the initial tail pointer, a
credit_limit of xe_lrc_ring_size() - 4 (16380 bytes) only tracks dynamic job
payloads.

If a burst of jobs is submitted to a newly created queue before the hardware
processes the initial commands (while head == 0), could the total bytes in the
ring buffer reach 16376 + 8 = 16384 or 16376 + 24 = 16400? Since the ring
capacity is 16384, this could wrap the tail pointer to exactly head (0) or past
it, overwriting unconsumed initial bytes or appearing empty to the hardware,
which would lead to a permanent GPU hang or command corruption.

>  		.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,

[Severity: High]
Does the GuC submission path also suffer from the same ring buffer overflow
issue as described above? It looks like this initialization uses the same
unsafe xe_lrc_ring_size() - 4 capacity limit which might not account for the
static LRC initialization bytes.

>  			    timeout, guc_to_gt(guc)->ordered_wq, NULL,
>  			    ge->name, gt_to_xe(q->gt)->drm.dev);
>  	if (err)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925172603.302050-4-dev@lankhorst.se?part=2

  reply	other threads:[~2026-09-25 17:43 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 ` [PATCH v2 2/2] drm/xe: Set job credits based on LRC size Maarten Lankhorst
2026-09-25 17:43   ` sashiko-bot [this message]
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=20260925174303.84EFF1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dev@lankhorst.se \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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