AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alex Deucher" <alexander.deucher@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/9] drm/amdgpu/mes11: add support for setting gang submit
Date: Tue, 17 Nov 2026 19:37:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-219507@kernel.org> (raw)
In-Reply-To: <20261117192415.810117-3-alexander.deucher@amd.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/amdgpu: unrolled sync_seq increment on MES error_undo paths
  [1]
--

commit 285ec5bbb9066cd84ed61683a42ebeae06434475
Author: Alex Deucher <alexander.deucher@amd.com>

drm/amdgpu/mes11: add support for setting gang submit

This commit implements the set_gang_submit callback for MES v11 to allow a
primary and secondary queue to schedule together.

> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> index 75e6079e6e332..d67dbc93e10d4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> @@ -1275,6 +1275,27 @@ static int mes_v11_0_enable_dbgext_irq(struct amdgpu_mes *mes, bool enable)
>  	return 0;
>  }
>  
> +static int mes_v11_0_set_gang_submit(struct amdgpu_mes *mes,
> +				     struct mes_set_gang_submit_input *input)
> +{
> +	union MESAPI__SET_GANG_SUBMIT mes_gang_submit_pkt;
> +
> +	memset(&mes_gang_submit_pkt, 0, sizeof(mes_gang_submit_pkt));
> +
> +	mes_gang_submit_pkt.header.type = MES_API_TYPE_SCHEDULER;
> +	mes_gang_submit_pkt.header.opcode = MES_SCH_API_SET_GANG_SUBMIT;
> +	mes_gang_submit_pkt.header.dwsize = API_FRAME_SIZE_IN_DWORDS;
> +
> +	mes_gang_submit_pkt.set_gang_submit.gang_context_addr =
> +		input->primary_gang_context_addr;
> +	mes_gang_submit_pkt.set_gang_submit.slave_gang_context_addr =
> +		input->secondary_gang_context_addr;
> +
> +	return mes_v11_0_submit_pkt_and_poll_completion(mes,
> +			&mes_gang_submit_pkt, sizeof(mes_gang_submit_pkt),
> +			offsetof(union MESAPI__SET_GANG_SUBMIT, api_status));
> +}

[Severity: High]
This problem wasn't introduced by this patch, but can
mes_v11_0_submit_pkt_and_poll_completion() leave ring->fence_drv.sync_seq
incremented when amdgpu_fence_wait_polling() times out [1]?

drivers/gpu/drm/amd/amdgpu/mes_v11_0.c:mes_v11_0_submit_pkt_and_poll_completion() {
	...
	seq = ++ring->fence_drv.sync_seq;
	r = amdgpu_fence_wait_polling(ring,
				      seq - ring->fence_drv.num_fences_mask,
				      timeout);
	if (r < 1) {
		r = -ETIMEDOUT;
		goto error_undo;
	}
	...
error_undo:
	dev_err(adev->dev, "MES ring buffer is full.\n");
	amdgpu_ring_undo(ring);
	...
}

The error_undo path rolls back the ring write pointer without decrementing
ring->fence_drv.sync_seq and without emitting the status fence packet.
Once ring->fence_drv.num_fences_mask timeouts accumulate, seq -
ring->fence_drv.num_fences_mask exceeds the highest fence sequence number
ever emitted to the ring, causing all subsequent MES submissions to time
out waiting on an unemitted fence until a GPU reset.  The same issue also
exists in mes_v12_0_submit_pkt_and_poll_completion() and
mes_v12_1_submit_pkt_and_poll_completion().

[1] https://sashiko.dev/#/bug/linux-dce92d12-1446-4f12-a395-575847569192

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117192415.810117-1-alexander.deucher@amd.com?part=3

  reply	other threads:[~2026-11-17 19:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 19:24 [PATCH 1/9] drm/amdgpu/mes11: add API for gang submit Alex Deucher
2026-11-17 19:24 ` [PATCH 2/9] drm/amdgpu/mes: add callback " Alex Deucher
2026-11-17 19:24 ` [PATCH 3/9] drm/amdgpu/mes11: add support for setting " Alex Deucher
2026-11-17 19:37   ` sashiko-bot [this message]
2026-11-17 19:24 ` [PATCH 4/9] drm/amdgpu/mes12: " Alex Deucher
2026-11-17 19:24 ` [PATCH 5/9] drm/amdgpu/userq: add callback for gang setup Alex Deucher
2026-11-17 19:24 ` [PATCH 6/9] drm/amdgpu/userq/mes: implement set gang submit Alex Deucher
2026-11-17 19:35   ` sashiko-bot
2026-11-17 19:24 ` [PATCH 7/9] drm/amdgpu/userq: add handling for set_gang Alex Deucher
2026-11-17 19:46   ` sashiko-bot
2026-11-17 19:24 ` [PATCH 8/9] drm/amdgpu: add UAPI to create user queue gangs Alex Deucher
2026-11-17 19:24 ` [PATCH 9/9] drm/amdgpu/userq: enable support for creating gangs Alex Deucher
2026-11-17 19:44   ` sashiko-bot

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=sashiko-outbox-219507@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@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