[PATCH 3/4] fixup! accel/amdxdna: use hmm_range_fault_unlocked_timeout() for range population
Stanislav Kinsburskii <[email protected]> Tue, 14 Jul 2026 13:13:46 -0700
| Newsgroups | org.freedesktop.lists.nouveau,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-rdma,org.kvack.linux-mm |
|---|---|
| Message-ID | <178406002613.1082778.11295976907808029605.stgit@skinsburskii> |
nouveau_range_fault() now uses hmm_range_fault_unlocked_timeout() for the HMM fault path. The timeout passed to that helper is meant to bound HMM's internal mmu-notifier retry loop, not the whole nouveau retry loop around mmu_interval_read_retry(). Pass the full relative HMM_RANGE_DEFAULT_TIMEOUT value to hmm_range_fault_unlocked_timeout() on each attempt, and retry from the nouveau-side mmu_interval_read_retry() check with a fresh HMM retry budget. This lets HMM continue when it has made progress, while still preserving a timeout for repeated notifier invalidation retries inside one HMM fault attempt. This also removes the open-coded absolute deadline and remaining-time calculation from nouveau_range_fault(). Signed-off-by: Stanislav Kinsburskii <[email protected]> --- 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)