All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mukul Joshi <mukul.joshi@amd.com>
To: Yongqiang Sun <Yongqiang.Sun@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: Enable SDMA IB processing
Date: Mon, 19 Oct 2026 14:27:57 -0400	[thread overview]
Message-ID: <2f4716c8-8a3d-42db-ab55-cb42145f9707@amd.com> (raw)
In-Reply-To: <20261019175807.970192-1-Yongqiang.Sun@amd.com>


On 10/19/2026 1:58 PM, Yongqiang Sun wrote:
> SDMA MQDs leave IB_ENABLE clear,
> causing INDIRECT packets to be ignored.
>
> Set IB_ENABLE while retaining SWITCH_INSIDE_IB.

This is not entirely true. We are enabling SWITCH_INSIDE_IB for GFX 10
and GFX 11 in the patch.

Maybe you can update the commit heading + description as:

"drm/amdkfd: Enable IB execution for user-mode SDMA queues

update_mqd_sdma() never sets IB_ENABLE in the SDMA queue IB_CNTL,
so INDIRECT packets submitted on user-mode SDMA queues are not executed.

Set IB_ENABLE on all MQD versions. On gfx10 and gfx11, also set
SWITCH_INSIDE_IB, which was previously only set on gfx9 and gfx12,
so that a long-running IB can be preempted."

With that fixed, this patch is:

Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>


>
> Signed-off-by: Yongqiang Sun <Yongqiang.Sun@amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c   |  7 +++++++
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c   |  7 +++++++
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c   | 11 ++++++-----
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c | 11 ++++++-----
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c    |  8 +++++---
>  5 files changed, 31 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
> index 4f8a8a1a6186..25f5a2cf02ff 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
> @@ -396,6 +396,13 @@ static void update_mqd_sdma(struct mqd_manager *mm, void *mqd,
>  	m->sdma_queue_id = q->sdma_queue_id;
>  	m->sdmax_rlcx_dummy_reg = SDMA_RLC_DUMMY_DEFAULT;
>  
> +	/* Enable IB execution; allow context switch inside an IB so one
> +	 * queue cannot starve the engine.
> +	 */
> +	m->sdmax_rlcx_ib_cntl |=
> +		SDMA0_RLC0_IB_CNTL__IB_ENABLE_MASK |
> +		SDMA0_RLC0_IB_CNTL__SWITCH_INSIDE_IB_MASK;
> +
>  	q->is_active = QUEUE_IS_ACTIVE(*q);
>  }
>  
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
> index bf015dc5b868..a1eecdf63b0c 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
> @@ -478,6 +478,13 @@ static void update_mqd_sdma(struct mqd_manager *mm, void *mqd,
>  	m->sdma_queue_id = q->sdma_queue_id;
>  	m->sdmax_rlcx_dummy_reg = SDMA_RLC_DUMMY_DEFAULT;
>  
> +	/* Enable IB execution; allow context switch inside an IB so one
> +	 * queue cannot starve the engine.
> +	 */
> +	m->sdmax_rlcx_ib_cntl |=
> +		SDMA0_QUEUE0_IB_CNTL__IB_ENABLE_MASK |
> +		SDMA0_QUEUE0_IB_CNTL__SWITCH_INSIDE_IB_MASK;
> +
>  	q->is_active = QUEUE_IS_ACTIVE(*q);
>  }
>  
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
> index 6ea09b031caf..e0574fa325c4 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
> @@ -353,11 +353,12 @@ static void update_mqd_sdma(struct mqd_manager *mm, void *mqd,
>  
>  	m->sdmax_rlcx_dummy_reg = SDMA_RLC_DUMMY_DEFAULT;
>  
> -	/* Allow context switch so we don't cross-process starve with a massive
> -	* command buffer of long-running SDMA commands
> -	* sdmax_rlcx_ib_cntl represent SDMA_QUEUE0_IB_CNTL register
> -	*/
> -	m->sdmax_rlcx_ib_cntl |= SDMA0_QUEUE0_IB_CNTL__SWITCH_INSIDE_IB_MASK;
> +	/* Enable IB execution; allow context switch inside an IB so one
> +	 * queue cannot starve the engine.
> +	 */
> +	m->sdmax_rlcx_ib_cntl |=
> +		SDMA0_QUEUE0_IB_CNTL__IB_ENABLE_MASK |
> +		SDMA0_QUEUE0_IB_CNTL__SWITCH_INSIDE_IB_MASK;
>  
>  	q->is_active = QUEUE_IS_ACTIVE(*q);
>  }
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
> index 2bbf5e63f615..04e1575dfe76 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
> @@ -457,11 +457,12 @@ static void update_mqd_sdma(struct mqd_manager *mm, void *mqd,
>  
>  	m->sdmax_queuen_dummy_reg1 = 1;
>  
> -	/* Allow context switch so we don't cross-process starve with a massive
> -	* command buffer of long-running SDMA commands
> -	* sdmax_queuen_ib_cntl represent SDMA_QUEUE0_IB_CNTL register
> -	*/
> -	m->sdmax_queuen_ib_cntl |= SDMA0_SDMA_QUEUE0_IB_CNTL__SWITCH_INSIDE_IB_MASK;
> +	/* Enable IB execution; allow context switch inside an IB so one
> +	 * queue cannot starve the engine.
> +	 */
> +	m->sdmax_queuen_ib_cntl |=
> +		SDMA0_SDMA_QUEUE0_IB_CNTL__IB_ENABLE_MASK |
> +		SDMA0_SDMA_QUEUE0_IB_CNTL__SWITCH_INSIDE_IB_MASK;
>  
>  	q->is_active = QUEUE_IS_ACTIVE(*q);
>  }
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> index 6e6bc1ec0b64..80df86f7c4d5 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
> @@ -569,10 +569,12 @@ static void update_mqd_sdma(struct mqd_manager *mm, void *mqd,
>  	m->sdma_engine_id = q->sdma_engine_id;
>  	m->sdma_queue_id = q->sdma_queue_id;
>  	m->sdmax_rlcx_dummy_reg = SDMA_RLC_DUMMY_DEFAULT;
> -	/* Allow context switch so we don't cross-process starve with a massive
> -	 * command buffer of long-running SDMA commands
> +	/* Enable IB execution; allow context switch inside an IB so one
> +	 * queue cannot starve the engine.
>  	 */
> -	m->sdmax_rlcx_ib_cntl |= SDMA0_GFX_IB_CNTL__SWITCH_INSIDE_IB_MASK;
> +	m->sdmax_rlcx_ib_cntl |=
> +		SDMA0_GFX_IB_CNTL__IB_ENABLE_MASK |
> +		SDMA0_GFX_IB_CNTL__SWITCH_INSIDE_IB_MASK;
>  
>  	q->is_active = QUEUE_IS_ACTIVE(*q);
>  }

      parent reply	other threads:[~2026-10-19 18:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 17:58 [PATCH] drm/amdkfd: Enable SDMA IB processing Yongqiang Sun
2026-10-19 18:23 ` Alex Deucher
2026-10-19 18:27 ` Mukul Joshi [this message]

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=2f4716c8-8a3d-42db-ab55-cb42145f9707@amd.com \
    --to=mukul.joshi@amd.com \
    --cc=Yongqiang.Sun@amd.com \
    --cc=amd-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.