From: Stanislav Kinsburskii <skinsburskii@gmail.com>
To: airlied@gmail.com, akhilesh@ee.iitb.ac.in,
akpm@linux-foundation.org, corbet@lwn.net, dakr@kernel.org,
david@kernel.org, jgg@ziepe.ca, kees@kernel.org, leon@kernel.org,
liam@infradead.org, lizhi.hou@amd.com, ljs@kernel.org,
lyude@redhat.com, maarten.lankhorst@linux.intel.com,
mamin506@gmail.com, mhocko@suse.com, mripard@kernel.org,
nouveau@lists.freedesktop.org, ogabbay@kernel.org,
oleg@redhat.com, rppt@kernel.org, shuah@kernel.org,
simona@ffwll.ch, skhan@linuxfoundation.org,
skinsburskii@gmail.com, surenb@google.com, tzimmermann@suse.de,
vbabka@kernel.org
Cc: dri-devel@lists.freedesktop.org, linux-mm@kvack.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: [PATCH v2 3/4] fixup! accel/amdxdna: use hmm_range_fault_unlocked_timeout() for range population
Date: Tue, 14 Jul 2026 15:21:42 -0700 [thread overview]
Message-ID: <178406770278.1106335.17232929459598625570.stgit@skinsburskii> (raw)
In-Reply-To: <178406760622.1106335.2379450382728057793.stgit@skinsburskii>
aie2_populate_range() now uses hmm_range_fault_unlocked_timeout() to let
HMM own mmap_lock acquisition and retry handling while populating an
invalid user mapping. The timeout passed to that helper is a relative
HMM retry budget, not an absolute deadline.
Pass HMM_RANGE_DEFAULT_TIMEOUT directly to the HMM helper instead of
computing the remaining time from a local absolute deadline. The broader
command submission path still keeps its existing timeout around repeated
range population attempts, while each HMM fault attempt receives a fresh
retry budget for HMM's internal mmu-notifier retries.
Keep the existing driver-visible timeout errno by translating -EBUSY
from hmm_range_fault_unlocked_timeout() to -ETIME on return.
Signed-off-by: Stanislav Kinsburskii <skinsburskii@gmail.com>
---
drivers/accel/amdxdna/aie2_ctx.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
index 548ba4315554..21f2817751f9 100644
--- a/drivers/accel/amdxdna/aie2_ctx.c
+++ b/drivers/accel/amdxdna/aie2_ctx.c
@@ -1037,7 +1037,7 @@ static int aie2_populate_range(struct amdxdna_gem_obj *abo)
bool found;
int ret;
- timeout = jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
+ timeout = msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
again:
found = false;
down_write(&xdna->notifier_lock);
@@ -1062,13 +1062,9 @@ static int aie2_populate_range(struct amdxdna_gem_obj *abo)
return -EFAULT;
}
- ret = hmm_range_fault_unlocked_timeout(&mapp->range,
- max_t(long, timeout - jiffies, 1));
- if (ret) {
- if (ret == -EBUSY)
- ret = -ETIME;
+ ret = hmm_range_fault_unlocked_timeout(&mapp->range, timeout);
+ if (ret)
goto put_mm;
- }
down_write(&xdna->notifier_lock);
if (mmu_interval_read_retry(&mapp->notifier, mapp->range.notifier_seq)) {
@@ -1086,7 +1082,7 @@ static int aie2_populate_range(struct amdxdna_gem_obj *abo)
put_mm:
amdxdna_umap_put(mapp);
mmput(mm);
- return ret;
+ return ret == -EBUSY ? -ETIME : ret;
}
int aie2_cmd_submit(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job, u64 *seq)
next prev parent reply other threads:[~2026-07-14 22:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 22:21 [PATCH v2 0/4] mm/hmm: Clarify notifier retry state and scope HMM timeouts Stanislav Kinsburskii
2026-07-14 22:21 ` [PATCH v2 1/4] fixup! mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support Stanislav Kinsburskii
2026-07-14 22:21 ` [PATCH v2 2/4] fixup! drm/nouveau: use hmm_range_fault_unlocked_timeout() for SVM faults Stanislav Kinsburskii
2026-07-14 22:21 ` Stanislav Kinsburskii [this message]
2026-07-14 22:21 ` [PATCH v2 4/4] fixup! drm/gpusvm: use hmm_range_fault_unlocked_timeout() for range faults Stanislav Kinsburskii
2026-07-15 12:41 ` [PATCH v2 0/4] mm/hmm: Clarify notifier retry state and scope HMM timeouts David Hildenbrand (Arm)
2026-07-15 14:42 ` Stanislav Kinsburskii
2026-07-15 15:02 ` Jason Gunthorpe
2026-07-15 16:03 ` Lorenzo Stoakes (ARM)
2026-07-15 16:02 ` Lorenzo Stoakes (ARM)
2026-07-15 16:39 ` Stanislav Kinsburskii
2026-07-15 17:14 ` Andrew Morton
2026-07-16 8:59 ` David Hildenbrand (Arm)
2026-07-16 9:12 ` Lorenzo Stoakes (ARM)
2026-07-16 16:37 ` Stanislav Kinsburskii
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=178406770278.1106335.17232929459598625570.stgit@skinsburskii \
--to=skinsburskii@gmail.com \
--cc=airlied@gmail.com \
--cc=akhilesh@ee.iitb.ac.in \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=dakr@kernel.org \
--cc=david@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jgg@ziepe.ca \
--cc=kees@kernel.org \
--cc=leon@kernel.org \
--cc=liam@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=ljs@kernel.org \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mamin506@gmail.com \
--cc=mhocko@suse.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=ogabbay@kernel.org \
--cc=oleg@redhat.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--cc=surenb@google.com \
--cc=tzimmermann@suse.de \
--cc=vbabka@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox