Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Nitin Gote <nitin.r.gote@intel.com>,
	intel-xe@lists.freedesktop.org,
	 Stanislav Kinsburskii <skinsburskii@gmail.com>,
	Leon Romanovsky <leon@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Matthew Brost <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()
Date: Wed, 2 Dec 2026 15:27:41 +1100	[thread overview]
Message-ID: <aw-dmlDp5pPdoMeT@nvdebian.thelocal> (raw)
In-Reply-To: <20261201140715.GG1856591@ziepe.ca>

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
> 

  parent reply	other threads:[~2026-12-02  4:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 14:31 [PATCH] mm/hmm: fix premature -EBUSY in hmm_range_fault_unlocked_timeout() Nitin Gote
2026-11-30 13:59 ` ✗ CI.checkpatch: warning for " Patchwork
2026-11-30 14:01 ` ✓ CI.KUnit: success " Patchwork
2026-11-30 14:39 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-30 16:09 ` [PATCH] " Stanislav Kinsburskii
2026-12-01 11:39   ` Gote, Nitin R
2026-11-30 18:35 ` ✓ Xe.CI.FULL: success for " Patchwork
     [not found] ` <20261201140715.GG1856591@ziepe.ca>
2026-12-02  4:27   ` Alistair Popple [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-12-01 13:06 [PATCH] " Nitin Gote

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=aw-dmlDp5pPdoMeT@nvdebian.thelocal \
    --to=apopple@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matthew.brost@intel.com \
    --cc=nitin.r.gote@intel.com \
    --cc=skinsburskii@gmail.com \
    --cc=thomas.hellstrom@linux.intel.com \
    /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