milos-linux/drivers/gpu/drm/amd
Honglei Huang ce3fb4b971 drm/amdgpu: drop retry loop in amdgpu_hmm_range_get_pages
commit 342981fff32802a819d6fc7cf3c9fedf9f3d9d60 upstream.

Since commit c08972f55594 ("drm/amdgpu: fix amdgpu_hmm_range_get_pages")
moved mmu_interval_read_begin() out of the per-chunk loop, the
captured notifier_seq is no longer refreshed across retries. As a
result, the existing -EBUSY retry path can never make progress:

  hmm_range_fault() returns -EBUSY only when
  mmu_interval_check_retry(notifier, notifier_seq) reports that the
  sequence is stale. Once the sequence has advanced, the stored seq
  will never match again, so every subsequent call within the same
  invocation returns -EBUSY immediately.

The "goto retry" therefore degenerates into a busy spin that simply
burns CPU for the full HMM_RANGE_DEFAULT_TIMEOUT (~1s) window before
finally bailing out with -EAGAIN. This is pure latency with no chance
of recovery, and it actively hurts the KFD userptr stack: the caller
ends up blocked for a second while holding mmap_lock, only to return
-EAGAIN to the restore worker (or to userspace) which would have
re-driven the operation immediately anyway.

Drop the retry/timeout entirely and let -EBUSY propagate straight to
out_free_pfns, where it is already translated to -EAGAIN. Recovery is
handled at a higher level: the KFD restore_userptr_worker reschedules
itself, and the userptr ioctl path returns -EAGAIN to userspace.

No functional regression: the previous behaviour on -EBUSY was already
to fail with -EAGAIN after a 1s stall; we just skip the stall.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Honglei Huang <honghuan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-06-19 13:50:58 +02:00
..
acp
amdgpu drm/amdgpu: drop retry loop in amdgpu_hmm_range_get_pages 2026-06-19 13:50:58 +02:00
amdkfd drm/amdkfd: Unwind debug trap enable on copy_to_user failure 2026-06-04 16:00:11 -04:00
amdxcp
display Short summary of fixes pull: 2026-06-13 07:52:40 +10:00
include drm for v7.1-rc1 2026-04-15 08:45:00 -07:00
pm drm/amd/pm: smu_v14_0_0: use SoftMin for gfxclk in set_soft_freq_limited_range 2026-06-03 14:57:46 -04:00
ras drm/amd/ras: Avoid ECC status update in hw_fini for VF unload 2026-04-17 14:49:51 -04:00