From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CB8935201A for ; Wed, 15 Jul 2026 21:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784150311; cv=none; b=nJRCN9hqb0mdLkySwrpqKLreoyCtIKurygRTjn+rtCeq5FtdDZXEgbZFeXcPr8vr5EBytBngiw3VLJZhshdcLHCvBTgXpjrTN9YFZEKeAzZDJoNqy1fX5zeBcQsw3Wq0D0v3FHSe1nXf0Lf0ONFm0Bba/YOZTFIEpEUll0y6FB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784150311; c=relaxed/simple; bh=2PrZvL6g/uJD93YwYoMi8zp7YV2Y/lChSC3L2RLOR9s=; h=Date:To:From:Subject:Message-Id; b=LnjQArLLcV5ZBGnfjJtKuozPbEASSjyMXAy3Y2KCCF7XBYXniHmJr0EaBalm43WlWSL53cvqDftNxUgB2fWenVvAjV7oNK7IlIH7DUhqu7/ONf1sFt97CyouPOOto2DskoQsMDF8btNma4IM3s8nSx3TblXwFBViSuzVumKb0Dg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=e/Mb2nlX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="e/Mb2nlX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 207BB1F000E9; Wed, 15 Jul 2026 21:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1784150310; bh=+3aMCTh1LssEJ6Jh33nyZptW3RGQrXRUq4Ez4LjtJ/M=; h=Date:To:From:Subject; b=e/Mb2nlX1BJVh4BRU+8/FZCNahBYVr7UNCyAMFyKOAMQtkTCIXyVLj4ma5X7VX2Q5 /I5Ngegx61h1Wsnq68RyUW3+f5BBaJXmF01rsIL29DhUfVq+BeHGstZZsKE5/7S/x0 7OjNQ4VfG3cvhvXW/e/3ua4BnCkq09iIckYc2Zls= Date: Wed, 15 Jul 2026 14:18:29 -0700 To: mm-commits@vger.kernel.org,skinsburskii@gmail.com,akpm@linux-foundation.org From: Andrew Morton Subject: + accel-amdxdna-use-hmm_range_fault_unlocked_timeout-for-range-population.patch added to mm-unstable branch Message-Id: <20260715211830.207BB1F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: accel/amdxdna: use hmm_range_fault_unlocked_timeout() for range population has been added to the -mm mm-unstable branch. Its filename is accel-amdxdna-use-hmm_range_fault_unlocked_timeout-for-range-population.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/accel-amdxdna-use-hmm_range_fault_unlocked_timeout-for-range-population.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Stanislav Kinsburskii Subject: accel/amdxdna: use hmm_range_fault_unlocked_timeout() for range population Date: Wed, 15 Jul 2026 11:16:44 -0700 aie2_populate_range() takes mmap_read_lock() only around hmm_range_fault(). It also open-codes the mmu interval sequence setup before each HMM walk and retries -EBUSY until HMM_RANGE_DEFAULT_TIMEOUT expires. Use hmm_range_fault_unlocked_timeout() instead. The HMM helper now owns the mmap lock and refreshes mapp->range.notifier_seq for its internal retries, so the driver only needs to call the helper and then validate the sequence before marking the mapping populated. Pass HMM_RANGE_DEFAULT_TIMEOUT as the helper retry budget for each HMM population attempt. This scopes the timeout to repeated HMM notifier retries while preserving the existing outer loop that moves between invalid mappings and restarts when the interval is invalidated before the driver updates its mapping state. Keep returning -ETIME when the HMM retry budget expires, matching the driver's existing timeout error convention. Link: https://lore.kernel.org/178413940486.1155966.10368807598827608499.stgit@skinsburskii Signed-off-by: Stanislav Kinsburskii Reviewed-by: Jason Gunthorpe Cc: Danilo Krummrich Cc: Dave Airlie Cc: David Hildenbrand Cc: Dexuan Cui Cc: Haiyang Zhang Cc: Jonathan Corbet Cc: Kees Cook Cc: K. Y. Srinivasan Cc: Leon Romanovsky Cc: Liam R. Howlett Cc: Lizhi Hou Cc: Long Li Cc: Lorenzo Stoakes Cc: Lyude Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Michal Hocko Cc: Mike Rapoport Cc: Oded Gabbay Cc: Oleg Nesterov Cc: Shuah Khan Cc: Suren Baghdasaryan Cc: Thomas Zimemrmann Cc: Vlastimil Babka Cc: Wei Liu Signed-off-by: Andrew Morton --- drivers/accel/amdxdna/aie2_ctx.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) --- a/drivers/accel/amdxdna/aie2_ctx.c~accel-amdxdna-use-hmm_range_fault_unlocked_timeout-for-range-population +++ a/drivers/accel/amdxdna/aie2_ctx.c @@ -1034,7 +1034,7 @@ static int aie2_populate_range(struct am 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); @@ -1061,24 +1061,9 @@ again: return -EFAULT; } - mapp->range.notifier_seq = mmu_interval_read_begin(&mapp->notifier); - mmap_read_lock(mm); - ret = hmm_range_fault(&mapp->range); - mmap_read_unlock(mm); - if (ret) { - if (time_after(jiffies, timeout)) { - ret = -ETIME; - goto put_mm; - } - - if (ret == -EBUSY) { - amdxdna_umap_put(mapp); - mmput(mm); - goto again; - } - + 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)) { @@ -1096,7 +1081,7 @@ again: 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) _ Patches currently in -mm which might be from skinsburskii@gmail.com are lib-test_hmm-use-device-devt-for-coherent-device-range-selection.patch mm-hmm-move-page-fault-handling-out-of-walk-callbacks.patch mm-hmm-add-hmm_range_fault_unlocked_timeout-for-mmap-lock-drop-support.patch selftests-mm-add-hmm-test-for-mmap-lock-dropping-faults.patch mshv-use-hmm_range_fault_unlocked_timeout-for-region-faults.patch drm-nouveau-use-hmm_range_fault_unlocked_timeout-for-svm-faults.patch rdma-umem-use-hmm_range_fault_unlocked_timeout-for-odp-faults.patch accel-amdxdna-use-hmm_range_fault_unlocked_timeout-for-range-population.patch drm-gpusvm-use-hmm_range_fault_unlocked_timeout-for-range-faults.patch