The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Max Zhen <max.zhen@amd.com>
To: Lizhi Hou <lizhi.hou@amd.com>, <ogabbay@kernel.org>,
	<quic_jhugo@quicinc.com>, <dri-devel@lists.freedesktop.org>,
	<mario.limonciello@amd.com>, <karol.wachowski@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <sonal.santan@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: Use mmput_async() in the job run error path
Date: Tue, 1 Dec 2026 10:35:00 -0800	[thread overview]
Message-ID: <c0ec2902-1c4f-46e2-b213-e38d66dfdf7e@amd.com> (raw)
In-Reply-To: <20261201182059.3046774-1-lizhi.hou@amd.com>



On 12/1/2026 Tue 10:20, Lizhi Hou wrote:
> aie2_sched_job_run() runs from the DRM scheduler worker, not from the
> submitting process, and the job only holds an mmgrab() reference to the
> address space. If the process exits after the mmget_not_zero() at the
> top of the function, the mmput() in the error path drops the last
> mm_users reference and calls __mmput() -> exit_mmap() ->
> mmu_notifier_release(), which invokes amdxdna_hmm_invalidate().
> 
> That handler waits with MAX_SCHEDULE_TIMEOUT for the fences of the BO.
> The fence attached to the BO reservation object is the finished fence of
> this very job, which the scheduler only signals once run_job() has
> returned. The scheduler worker therefore blocks forever waiting for a
> fence that only it can cause to be signalled, and stalls every other
> context sharing the scheduler work queue.
> 
> Use mmput_async() so that the address space teardown is deferred and
> run_job() can return.
> 
> Calling mmput_async() after aie2_job_put() is safe today because the
> submit reference is still held until aie2_sched_job_free(). Swapping
> the two lines makes it easier to read.
> 
> Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Max Zhen <max.zhen@amd.com>
> ---
>   drivers/accel/amdxdna/aie2_ctx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
> index 582e171b5fd7..0a6be8ba8e3c 100644
> --- a/drivers/accel/amdxdna/aie2_ctx.c
> +++ b/drivers/accel/amdxdna/aie2_ctx.c
> @@ -453,8 +453,8 @@ aie2_sched_job_run(struct drm_sched_job *sched_job)
>   	if (ret) {
>   		amdxdna_io_stats_job_done(job->hwctx->client);
>   		dma_fence_put(job->fence);
> +		mmput_async(job->mm);
>   		aie2_job_put(job);
> -		mmput(job->mm);
>   		fence = ERR_PTR(ret);
>   	} else {
>   		/*


      reply	other threads:[~2026-12-01 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 18:20 [PATCH V1] accel/amdxdna: Use mmput_async() in the job run error path Lizhi Hou
2026-12-01 18:35 ` Max Zhen [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=c0ec2902-1c4f-46e2-b213-e38d66dfdf7e@amd.com \
    --to=max.zhen@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karol.wachowski@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.hou@amd.com \
    --cc=mario.limonciello@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@amd.com \
    /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