mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	<ogabbay@kernel.org>, <quic_jhugo@quicinc.com>,
	<dri-devel@lists.freedesktop.org>,
	<maciej.falkowski@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <max.zhen@amd.com>,
	<sonal.santan@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: Stop job scheduling across aie2_release_resource()
Date: Fri, 30 Jan 2026 13:10:56 -0800	[thread overview]
Message-ID: <802e4adb-df13-ef29-1314-9d58fe192dd1@amd.com> (raw)
In-Reply-To: <9eef4eb7-3fcc-411b-ba80-838926006e9d@amd.com>

Applied to drm-misc-next-fixes

On 1/30/26 11:24, Mario Limonciello wrote:
> On 1/29/26 6:32 PM, Lizhi Hou wrote:
>> Running jobs on a hardware context while it is in the process of
>> releasing resources can lead to use-after-free and crashes.
>>
>> Fix this by stopping job scheduling before calling
>> aie2_release_resource() and restarting it after the release completes.
>> Additionally, aie2_sched_job_run() now checks whether the hardware
>> context is still active.
>>
>> Fixes: 4fd6ca90fc7f ("accel/amdxdna: Refactor hardware context 
>> destroy routine")
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> ---
>>   drivers/accel/amdxdna/aie2_ctx.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/accel/amdxdna/aie2_ctx.c 
>> b/drivers/accel/amdxdna/aie2_ctx.c
>> index 5511ab2ef242..c4a58c00e442 100644
>> --- a/drivers/accel/amdxdna/aie2_ctx.c
>> +++ b/drivers/accel/amdxdna/aie2_ctx.c
>> @@ -315,6 +315,9 @@ aie2_sched_job_run(struct drm_sched_job *sched_job)
>>       struct dma_fence *fence;
>>       int ret;
>>   +    if (hwctx->status != HWCTX_STAT_READY)
>> +        return NULL;
>> +
>>       if (!mmget_not_zero(job->mm))
>>           return ERR_PTR(-ESRCH);
>>   @@ -705,7 +708,10 @@ void aie2_hwctx_fini(struct amdxdna_hwctx *hwctx)
>>       aie2_hwctx_wait_for_idle(hwctx);
>>         /* Request fw to destroy hwctx and cancel the rest pending 
>> requests */
>> +    drm_sched_stop(&hwctx->priv->sched, NULL);
>>       aie2_release_resource(hwctx);
>> +    hwctx->status = HWCTX_STAT_STOP;
>> +    drm_sched_start(&hwctx->priv->sched, 0);
>>         mutex_unlock(&xdna->dev_lock);
>>       drm_sched_entity_destroy(&hwctx->priv->entity);
>

      reply	other threads:[~2026-01-30 21:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30  0:32 Lizhi Hou
2026-01-30 19:24 ` Mario Limonciello
2026-01-30 21:10   ` Lizhi Hou [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=802e4adb-df13-ef29-1314-9d58fe192dd1@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.falkowski@linux.intel.com \
    --cc=mario.limonciello@amd.com \
    --cc=max.zhen@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

all inboxes | Powered by JetHome®