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, 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: Re: [PATCH 2/4] fixup! drm/nouveau: use hmm_range_fault_unlocked_timeout() for SVM faults
Date: Tue, 14 Jul 2026 14:33:53 -0700 [thread overview]
Message-ID: <alarQbmnjwtgdBUB@skinsburskii> (raw)
In-Reply-To: <178406001808.1082778.17299764648397654220.stgit@skinsburskii>
On Tue, Jul 14, 2026 at 01:13:38PM -0700, Stanislav Kinsburskii wrote:
> 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().
>
Sashiko is right. I'll need to do it differently.
There will be a v2 of this series.
Thanks,
Stanislav
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@gmail.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_svm.c | 30 ++++++++++--------------------
> 1 file changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
> index 4cfb6eb7c771..b1415c2e49fc 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_svm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
> @@ -655,8 +655,7 @@ static int nouveau_range_fault(struct nouveau_svmm *svmm,
> unsigned long hmm_flags,
> struct svm_notifier *notifier)
> {
> - unsigned long timeout =
> - jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
> + unsigned long timeout = msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
> /* Have HMM fault pages within the fault window to the GPU. */
> unsigned long hmm_pfns[1];
> struct hmm_range range = {
> @@ -677,25 +676,16 @@ static int nouveau_range_fault(struct nouveau_svmm *svmm,
> range.start = notifier->notifier.interval_tree.start;
> range.end = notifier->notifier.interval_tree.last + 1;
>
> - while (true) {
> - if (time_after(jiffies, timeout)) {
> - ret = -EBUSY;
> - goto out;
> - }
> -
> - ret = hmm_range_fault_unlocked_timeout(&range,
> - max(timeout - jiffies,
> - 1L));
> - if (ret)
> - goto out;
> +again:
> + ret = hmm_range_fault_unlocked_timeout(&range, timeout);
> + if (ret)
> + goto out;
>
> - mutex_lock(&svmm->mutex);
> - if (mmu_interval_read_retry(range.notifier,
> - range.notifier_seq)) {
> - mutex_unlock(&svmm->mutex);
> - continue;
> - }
> - break;
> + mutex_lock(&svmm->mutex);
> + if (mmu_interval_read_retry(range.notifier,
> + range.notifier_seq)) {
> + mutex_unlock(&svmm->mutex);
> + goto again;
> }
>
> nouveau_hmm_convert_pfn(drm, &range, args);
>
>
next prev parent reply other threads:[~2026-07-14 21:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 20:13 [PATCH 0/4] mm/hmm: Clarify notifier retry state and scope HMM timeouts Stanislav Kinsburskii
2026-07-14 20:13 ` [PATCH 1/4] fixup! mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support Stanislav Kinsburskii
2026-07-14 20:13 ` [PATCH 2/4] fixup! drm/nouveau: use hmm_range_fault_unlocked_timeout() for SVM faults Stanislav Kinsburskii
2026-07-14 21:33 ` Stanislav Kinsburskii [this message]
2026-07-14 20:13 ` [PATCH 3/4] fixup! accel/amdxdna: use hmm_range_fault_unlocked_timeout() for range population Stanislav Kinsburskii
2026-07-14 20:13 ` [PATCH 4/4] fixup! drm/gpusvm: use hmm_range_fault_unlocked_timeout() for range faults 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=alarQbmnjwtgdBUB@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