mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Max Zhen <max.zhen@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: Skip unmapped range in aie2_populate_range()
Date: Wed, 12 Aug 2026 23:17:15 -0700	[thread overview]
Message-ID: <b9cd6526-adaf-8058-55dd-b19a56b0dbcc@amd.com> (raw)
In-Reply-To: <8f4457fd-ef92-4783-b8d5-b4bb1f61de04@amd.com>

Applied to drm-misc-fixes

On 8/12/26 14:26, Max Zhen wrote:
>
>
> On 8/12/2026 Wed 13:56, Lizhi Hou wrote:
>> aie2_populate_range() incorrectly failed jobs for BOs with multiple
>> mmaps: if the unmapped entry appeared first in umap_list, the loop would
>> pick it up, call hmm_range_fault() on a gone VMA, and return -EFAULT
>> without ever trying the remaining valid mapps.
>>
>> Fix it by skipping unmapped entries. After the loop, if the map list is
>> empty or all maps are valid, map_invalid can be cleared normally.
>>
>> Fixes: e486147c912f ("accel/amdxdna: Add BO import and export")
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> Reviewed-by: Max Zhen <max.zhen@amd.com>
>> ---
>>   drivers/accel/amdxdna/aie2_ctx.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/drivers/accel/amdxdna/aie2_ctx.c 
>> b/drivers/accel/amdxdna/aie2_ctx.c
>> index 4b3a62aa8798..8d9c283f606a 100644
>> --- a/drivers/accel/amdxdna/aie2_ctx.c
>> +++ b/drivers/accel/amdxdna/aie2_ctx.c
>> @@ -1052,6 +1052,16 @@ static int aie2_populate_range(struct 
>> amdxdna_gem_obj *abo)
>>       found = false;
>>       down_write(&xdna->notifier_lock);
>>       list_for_each_entry(mapp, &abo->mem.umap_list, node) {
>> +        /*
>> +         * Skip entries that have already been unmapped.
>> +         *
>> +         * If userspace unmaps the address and later submits I/O using
>> +         * it, the IOMMU will reject the access and report a fault.
>> +         * Ignore such entries here.
>> +         */
>> +        if (mapp->unmapped)
>> +            continue;
>> +
>>           if (mapp->invalid && kref_get_unless_zero(&mapp->refcnt)) {
>>               found = true;
>>               break;
>> @@ -1059,6 +1069,12 @@ static int aie2_populate_range(struct 
>> amdxdna_gem_obj *abo)
>>       }
>>         if (!found) {
>> +        /*
>> +         * This also covers the case where all mappings have been
>> +         * removed. There are no invalid mappings left to process.
>> +         * Any subsequent I/O using the unmapped address will be
>> +         * rejected by the IOMMU.
>> +         */
>>           abo->mem.map_invalid = false;
>>           up_write(&xdna->notifier_lock);
>>           return 0;
>

      reply	other threads:[~2026-08-13  6:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 20:56 Lizhi Hou
2026-08-12 21:26 ` Max Zhen
2026-08-13  6:17   ` 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=b9cd6526-adaf-8058-55dd-b19a56b0dbcc@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=karol.wachowski@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®