* [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout()
@ 2026-11-30 14:31 Nitin Gote
2026-11-30 16:09 ` Stanislav Kinsburskii
2026-12-01 14:07 ` Jason Gunthorpe
0 siblings, 2 replies; 6+ messages in thread
From: Nitin Gote @ 2026-11-30 14:31 UTC (permalink / raw)
To: intel-xe
Cc: Nitin Gote, Stanislav Kinsburskii, Jason Gunthorpe,
Leon Romanovsky, Andrew Morton, Matthew Brost, Thomas Hellstrom,
linux-mm, dri-devel
hmm_range_fault_unlocked_timeout() starts its retry deadline before
mmu_interval_read_begin() and mmap_read_lock_killable(), and checks it
before calling hmm_range_fault_locked(). Both calls can sleep for a
long time if another thread is invalidating or holds mmap_lock for
write. Today, if that sleep is longer than the timeout, we return
-EBUSY without even trying the fault, although nothing invalidated
our range.
The open-coded loops that the helper replaced only checked the
deadline after hmm_range_fault() had actually returned -EBUSY,
so lock waits never consumed the retry budget.
This is seen with igt@xe_exec_threads@threads-hang-*userptr-invalidate*:
one thread's mmap(MAP_FIXED) holds mmap_lock for write while the xe
notifier waits for a hung job to time out. Another thread repinning
its own userptr waits behind it for more than
HMM_RANGE_DEFAULT_TIMEOUT, and DRM_IOCTL_XE_EXEC fails with -EBUSY:
xe/xe_ioctl-CRITICAL: Failed assertion: __xe_exec(fd, exec) == 0
xe/xe_ioctl-CRITICAL: error: -16 != 0
Keep the retry timeout, but check it only when hmm_range_fault_locked()
returns -EBUSY with mmap_lock still held, i.e. on a real invalidation
collision. This restores the behaviour callers had before the
conversion, and keeps the deadline reset when a fault drops mmap_lock.
Assisted-by: LLM
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9096
Fixes: 121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support")
Cc: Stanislav Kinsburskii <skinsburskii@gmail.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
Cc: linux-mm@kvack.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
---
mm/hmm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/hmm.c b/mm/hmm.c
index 9871d3c3cd07..e520424394af 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -815,15 +815,15 @@ int hmm_range_fault_unlocked_timeout(struct hmm_range *range,
return -EFAULT;
}
- if (timeout && time_after(jiffies, deadline)) {
- mmap_read_unlock(mm);
- return -EBUSY;
- }
-
locked = true;
ret = hmm_range_fault_locked(range, &locked);
- if (locked)
+ if (locked) {
mmap_read_unlock(mm);
+ /* Only invalidation collisions count against the timeout */
+ if (ret == -EBUSY && timeout &&
+ time_after(jiffies, deadline))
+ return -EBUSY;
+ }
} while (ret == -EBUSY);
return ret;
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout()
2026-11-30 14:31 [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout() Nitin Gote
@ 2026-11-30 16:09 ` Stanislav Kinsburskii
2026-12-01 11:39 ` Gote, Nitin R
2026-12-01 14:07 ` Jason Gunthorpe
1 sibling, 1 reply; 6+ messages in thread
From: Stanislav Kinsburskii @ 2026-11-30 16:09 UTC (permalink / raw)
To: Nitin Gote
Cc: intel-xe, Jason Gunthorpe, Leon Romanovsky, Andrew Morton,
Matthew Brost, Thomas Hellstrom, linux-mm, dri-devel
On Mon, Nov 30, 2026 at 08:01:49PM +0530, Nitin Gote wrote:
> hmm_range_fault_unlocked_timeout() starts its retry deadline before
> mmu_interval_read_begin() and mmap_read_lock_killable(), and checks it
> before calling hmm_range_fault_locked(). Both calls can sleep for a
> long time if another thread is invalidating or holds mmap_lock for
> write. Today, if that sleep is longer than the timeout, we return
> -EBUSY without even trying the fault, although nothing invalidated
> our range.
>
> The open-coded loops that the helper replaced only checked the
> deadline after hmm_range_fault() had actually returned -EBUSY,
> so lock waits never consumed the retry budget.
>
> This is seen with igt@xe_exec_threads@threads-hang-*userptr-invalidate*:
> one thread's mmap(MAP_FIXED) holds mmap_lock for write while the xe
> notifier waits for a hung job to time out. Another thread repinning
> its own userptr waits behind it for more than
> HMM_RANGE_DEFAULT_TIMEOUT, and DRM_IOCTL_XE_EXEC fails with -EBUSY:
>
> xe/xe_ioctl-CRITICAL: Failed assertion: __xe_exec(fd, exec) == 0
> xe/xe_ioctl-CRITICAL: error: -16 != 0
>
> Keep the retry timeout, but check it only when hmm_range_fault_locked()
> returns -EBUSY with mmap_lock still held, i.e. on a real invalidation
> collision. This restores the behaviour callers had before the
> conversion, and keeps the deadline reset when a fault drops mmap_lock.
>
Could you clarify in the commit message that time spent waiting for the
notifier or mmap_lock still counts toward the deadline, and that HMM now
checks for expiry only after detecting an invalidation collision?
I'd also scope the claim about restoring the old behavior to
drm_gpusvm_get_pages(), since the old drm_gpusvm_range_evict() loop
could time out before faulting.
LGTM and thank you.
Reviewed-by: Stanislav Kinsburskii <skinsburskii@gmail.com>
> Assisted-by: LLM
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9096
> Fixes: 121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support")
> Cc: Stanislav Kinsburskii <skinsburskii@gmail.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
> Cc: linux-mm@kvack.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
> ---
> mm/hmm.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/mm/hmm.c b/mm/hmm.c
> index 9871d3c3cd07..e520424394af 100644
> --- a/mm/hmm.c
> +++ b/mm/hmm.c
> @@ -815,15 +815,15 @@ int hmm_range_fault_unlocked_timeout(struct hmm_range *range,
> return -EFAULT;
> }
>
> - if (timeout && time_after(jiffies, deadline)) {
> - mmap_read_unlock(mm);
> - return -EBUSY;
> - }
> -
> locked = true;
> ret = hmm_range_fault_locked(range, &locked);
> - if (locked)
> + if (locked) {
> mmap_read_unlock(mm);
> + /* Only invalidation collisions count against the timeout */
> + if (ret == -EBUSY && timeout &&
> + time_after(jiffies, deadline))
> + return -EBUSY;
> + }
> } while (ret == -EBUSY);
>
> return ret;
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout()
2026-11-30 16:09 ` Stanislav Kinsburskii
@ 2026-12-01 11:39 ` Gote, Nitin R
0 siblings, 0 replies; 6+ messages in thread
From: Gote, Nitin R @ 2026-12-01 11:39 UTC (permalink / raw)
To: Stanislav Kinsburskii
Cc: intel-xe@lists.freedesktop.org, Jason Gunthorpe, Leon Romanovsky,
Andrew Morton, Brost, Matthew, Thomas Hellstrom,
linux-mm@kvack.org, dri-devel@lists.freedesktop.org
> -----Original Message-----
> From: Stanislav Kinsburskii <skinsburskii@gmail.com>
> Sent: Monday, November 30, 2026 9:39 PM
> To: Gote, Nitin R <nitin.r.gote@intel.com>
> Cc: intel-xe@lists.freedesktop.org; Jason Gunthorpe <jgg@ziepe.ca>; Leon
> Romanovsky <leon@kernel.org>; Andrew Morton <akpm@linux-foundation.org>;
> Brost, Matthew <matthew.brost@intel.com>; Thomas Hellstrom
> <thomas.hellstrom@linux.intel.com>; linux-mm@kvack.org; dri-
> devel@lists.freedesktop.org
> Subject: Re: [PATCH] mm/hmm: fix premature -EBUSY in
> hmm_range_fault_unlocked_timeout()
>
> On Mon, Nov 30, 2026 at 08:01:49PM +0530, Nitin Gote wrote:
> > hmm_range_fault_unlocked_timeout() starts its retry deadline before
> > mmu_interval_read_begin() and mmap_read_lock_killable(), and checks it
> > before calling hmm_range_fault_locked(). Both calls can sleep for a
> > long time if another thread is invalidating or holds mmap_lock for
> > write. Today, if that sleep is longer than the timeout, we return
> > -EBUSY without even trying the fault, although nothing invalidated our
> > range.
> >
> > The open-coded loops that the helper replaced only checked the
> > deadline after hmm_range_fault() had actually returned -EBUSY, so lock
> > waits never consumed the retry budget.
> >
> > This is seen with igt@xe_exec_threads@threads-hang-*userptr-invalidate*:
> > one thread's mmap(MAP_FIXED) holds mmap_lock for write while the xe
> > notifier waits for a hung job to time out. Another thread repinning
> > its own userptr waits behind it for more than
> > HMM_RANGE_DEFAULT_TIMEOUT, and DRM_IOCTL_XE_EXEC fails with -
> EBUSY:
> >
> > xe/xe_ioctl-CRITICAL: Failed assertion: __xe_exec(fd, exec) == 0
> > xe/xe_ioctl-CRITICAL: error: -16 != 0
> >
> > Keep the retry timeout, but check it only when
> > hmm_range_fault_locked() returns -EBUSY with mmap_lock still held,
> > i.e. on a real invalidation collision. This restores the behaviour
> > callers had before the conversion, and keeps the deadline reset when a fault
> drops mmap_lock.
> >
>
> Could you clarify in the commit message that time spent waiting for the notifier
> or mmap_lock still counts toward the deadline, and that HMM now checks for
> expiry only after detecting an invalidation collision?
>
> I'd also scope the claim about restoring the old behavior to
> drm_gpusvm_get_pages(), since the old drm_gpusvm_range_evict() loop could
> time out before faulting.
>
> LGTM and thank you.
Thanks for the review.
Agreed on both points. I'll update the commit message to clarify the timeout semantics and
narrow the "restores previous behaviour" statement to drm_gpusvm_get_pages().
I'll send a v2 with the updated wording and include your Reviewed-by.
Thanks,
Nitin
>
> Reviewed-by: Stanislav Kinsburskii <skinsburskii@gmail.com>
>
> > Assisted-by: LLM
> > Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9096
> > Fixes: 121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout()
> > for mmap lock-drop support")
> > Cc: Stanislav Kinsburskii <skinsburskii@gmail.com>
> > Cc: Jason Gunthorpe <jgg@ziepe.ca>
> > Cc: Leon Romanovsky <leon@kernel.org>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
> > Cc: linux-mm@kvack.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
> > ---
> > mm/hmm.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/mm/hmm.c b/mm/hmm.c
> > index 9871d3c3cd07..e520424394af 100644
> > --- a/mm/hmm.c
> > +++ b/mm/hmm.c
> > @@ -815,15 +815,15 @@ int hmm_range_fault_unlocked_timeout(struct
> hmm_range *range,
> > return -EFAULT;
> > }
> >
> > - if (timeout && time_after(jiffies, deadline)) {
> > - mmap_read_unlock(mm);
> > - return -EBUSY;
> > - }
> > -
> > locked = true;
> > ret = hmm_range_fault_locked(range, &locked);
> > - if (locked)
> > + if (locked) {
> > mmap_read_unlock(mm);
> > + /* Only invalidation collisions count against the timeout
> */
> > + if (ret == -EBUSY && timeout &&
> > + time_after(jiffies, deadline))
> > + return -EBUSY;
> > + }
> > } while (ret == -EBUSY);
> >
> > return ret;
> > --
> > 2.50.1
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout()
2026-11-30 14:31 [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout() Nitin Gote
2026-11-30 16:09 ` Stanislav Kinsburskii
@ 2026-12-01 14:07 ` Jason Gunthorpe
2026-12-02 4:27 ` Alistair Popple
1 sibling, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2026-12-01 14:07 UTC (permalink / raw)
To: Nitin Gote
Cc: intel-xe, Stanislav Kinsburskii, Leon Romanovsky, Andrew Morton,
Matthew Brost, Thomas Hellstrom, linux-mm, dri-devel
On Mon, Nov 30, 2026 at 08:01:49PM +0530, Nitin Gote wrote:
> hmm_range_fault_unlocked_timeout() starts its retry deadline before
> mmu_interval_read_begin() and mmap_read_lock_killable(), and checks it
> before calling hmm_range_fault_locked(). Both calls can sleep for a
> long time if another thread is invalidating or holds mmap_lock for
> write. Today, if that sleep is longer than the timeout, we return
> -EBUSY without even trying the fault, although nothing invalidated
> our range.
>
> The open-coded loops that the helper replaced only checked the
> deadline after hmm_range_fault() had actually returned -EBUSY,
> so lock waits never consumed the retry budget.
>
> This is seen with igt@xe_exec_threads@threads-hang-*userptr-invalidate*:
> one thread's mmap(MAP_FIXED) holds mmap_lock for write while the xe
> notifier waits for a hung job to time out. Another thread repinning
> its own userptr waits behind it for more than
> HMM_RANGE_DEFAULT_TIMEOUT, and DRM_IOCTL_XE_EXEC fails with -EBUSY:
>
> xe/xe_ioctl-CRITICAL: Failed assertion: __xe_exec(fd, exec) == 0
> xe/xe_ioctl-CRITICAL: error: -16 != 0
>
> Keep the retry timeout, but check it only when hmm_range_fault_locked()
> returns -EBUSY with mmap_lock still held, i.e. on a real invalidation
> collision. This restores the behaviour callers had before the
> conversion, and keeps the deadline reset when a fault drops mmap_lock.
>
> Assisted-by: LLM
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9096
> Fixes: 121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support")
> Cc: Stanislav Kinsburskii <skinsburskii@gmail.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
> Cc: linux-mm@kvack.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
> ---
> mm/hmm.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout()
2026-12-01 14:07 ` Jason Gunthorpe
@ 2026-12-02 4:27 ` Alistair Popple
0 siblings, 0 replies; 6+ messages in thread
From: Alistair Popple @ 2026-12-02 4:27 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Nitin Gote, intel-xe, Stanislav Kinsburskii, Leon Romanovsky,
Andrew Morton, Matthew Brost, Thomas Hellstrom, linux-mm,
dri-devel
On 2026-12-02 at 01:07 +1100, Jason Gunthorpe <jgg@ziepe.ca> wrote...
> On Mon, Nov 30, 2026 at 08:01:49PM +0530, Nitin Gote wrote:
> > hmm_range_fault_unlocked_timeout() starts its retry deadline before
> > mmu_interval_read_begin() and mmap_read_lock_killable(), and checks it
> > before calling hmm_range_fault_locked(). Both calls can sleep for a
> > long time if another thread is invalidating or holds mmap_lock for
> > write. Today, if that sleep is longer than the timeout, we return
> > -EBUSY without even trying the fault, although nothing invalidated
> > our range.
> >
> > The open-coded loops that the helper replaced only checked the
> > deadline after hmm_range_fault() had actually returned -EBUSY,
> > so lock waits never consumed the retry budget.
> >
> > This is seen with igt@xe_exec_threads@threads-hang-*userptr-invalidate*:
> > one thread's mmap(MAP_FIXED) holds mmap_lock for write while the xe
> > notifier waits for a hung job to time out. Another thread repinning
> > its own userptr waits behind it for more than
> > HMM_RANGE_DEFAULT_TIMEOUT, and DRM_IOCTL_XE_EXEC fails with -EBUSY:
> >
> > xe/xe_ioctl-CRITICAL: Failed assertion: __xe_exec(fd, exec) == 0
> > xe/xe_ioctl-CRITICAL: error: -16 != 0
> >
> > Keep the retry timeout, but check it only when hmm_range_fault_locked()
> > returns -EBUSY with mmap_lock still held, i.e. on a real invalidation
> > collision. This restores the behaviour callers had before the
> > conversion, and keeps the deadline reset when a fault drops mmap_lock.
> >
> > Assisted-by: LLM
I don't think these are required anymore but I guess Andrew will remove it.
Otherwise seems reasonable:
Reviewed-by: Alistair Popple <apopple@nvidia.com>
> > Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9096
> > Fixes: 121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support")
> > Cc: Stanislav Kinsburskii <skinsburskii@gmail.com>
> > Cc: Jason Gunthorpe <jgg@ziepe.ca>
> > Cc: Leon Romanovsky <leon@kernel.org>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
> > Cc: linux-mm@kvack.org
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
> > ---
> > mm/hmm.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
>
> Jason
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout()
@ 2026-12-01 13:06 Nitin Gote
0 siblings, 0 replies; 6+ messages in thread
From: Nitin Gote @ 2026-12-01 13:06 UTC (permalink / raw)
To: skinsburskii, intel-xe
Cc: Nitin Gote, Jason Gunthorpe, Leon Romanovsky, Andrew Morton,
Matthew Brost, Thomas Hellstrom, linux-mm, dri-devel
hmm_range_fault_unlocked_timeout() starts its retry deadline before
mmu_interval_read_begin() and mmap_read_lock_killable(), and checks it
before calling hmm_range_fault_locked(). Both calls can sleep for a
long time if another thread is invalidating or holds mmap_lock for
write. Today, if that sleep is longer than the timeout, we return
-EBUSY without even trying the fault, although nothing invalidated
our range.
This is seen with igt@xe_exec_threads@threads-hang-*userptr-invalidate*:
one thread's mmap(MAP_FIXED) holds mmap_lock for write while the xe
notifier waits for a hung job to time out. Another thread repinning
its own userptr waits behind it for more than
HMM_RANGE_DEFAULT_TIMEOUT, and DRM_IOCTL_XE_EXEC fails with -EBUSY:
xe/xe_ioctl-CRITICAL: Failed assertion: __xe_exec(fd, exec) == 0
xe/xe_ioctl-CRITICAL: error: -16 != 0
Time spent waiting in mmu_interval_read_begin() and
mmap_read_lock_killable() still counts toward the deadline, but only
check for expiry after hmm_range_fault_locked() returns -EBUSY with
mmap_lock still held, i.e. after an actual invalidation collision.
A long wait therefore no longer fails on its own; the fault is always
attempted at least once. The deadline is still reset when a fault
drops mmap_lock.
For drm_gpusvm_get_pages() this restores the behaviour of the
open-coded loop the helper replaced, which only checked the deadline
after hmm_range_fault() returned -EBUSY.
v2: (Stanislav)
- Clarify that notifier/mmap_lock wait time still counts toward the
deadline and that expiry is only checked after an invalidation
collision
- Scope the "restores previous behaviour" statement to
drm_gpusvm_get_pages(); the old drm_gpusvm_range_evict() loop could
time out before faulting (Stanislav)
Assisted-by: LLM
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9096
Fixes: 121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support")
Reviewed-by: Stanislav Kinsburskii <skinsburskii@gmail.com>
Cc: Stanislav Kinsburskii <skinsburskii@gmail.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
Cc: linux-mm@kvack.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Nitin Gote <nitin.r.gote@intel.com>
---
mm/hmm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/hmm.c b/mm/hmm.c
index 9871d3c3cd07..dbaedd5e4c1b 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -815,15 +815,15 @@ int hmm_range_fault_unlocked_timeout(struct hmm_range *range,
return -EFAULT;
}
- if (timeout && time_after(jiffies, deadline)) {
- mmap_read_unlock(mm);
- return -EBUSY;
- }
-
locked = true;
ret = hmm_range_fault_locked(range, &locked);
- if (locked)
+ if (locked) {
mmap_read_unlock(mm);
+ /* Only act on an expired deadline after an invalidation collision */
+ if (ret == -EBUSY && timeout &&
+ time_after(jiffies, deadline))
+ return -EBUSY;
+ }
} while (ret == -EBUSY);
return ret;
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-02 4:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 14:31 [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout() Nitin Gote
2026-11-30 16:09 ` Stanislav Kinsburskii
2026-12-01 11:39 ` Gote, Nitin R
2026-12-01 14:07 ` Jason Gunthorpe
2026-12-02 4:27 ` Alistair Popple
-- strict thread matches above, loose matches on Subject: below --
2026-12-01 13:06 Nitin Gote
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox