All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v3 0/7] drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap
@ 2026-06-04  9:50 Arvind Yadav
  2026-06-04  9:50 ` [RFC v3 1/7] drm/xe/vm: Track CPU_AUTORESET state in xe_vma Arvind Yadav
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Arvind Yadav @ 2026-06-04  9:50 UTC (permalink / raw)
  To: intel-xe, dri-devel
  Cc: matthew.brost, himal.prasad.ghimiray, thomas.hellstrom

This series implements automatic reset of MADVISE-managed GPU memory
attributes when userspace unmaps memory. Non-default attributes are
reset when CPU mappings are removed, preventing them from persisting
across later mmap() operations.

MMU interval notifiers detect munmap on CPU-only VMAs (not yet
GPU-faulted) and queue a worker to reset attributes. GPU-touched
VMAs continue using the existing SVM path.

Key aspects:
 - cpu_autoreset_active tracks CPU-only vs GPU-touched state.
 - MMU notifier callbacks do not allocate. work_struct is embedded in
   xe_madvise_notifier and initialized at ioctl time.
 - Unmap events are coalesced in the callback and processed by a worker.
 - teardown_rwsem serializes VM teardown against notifier callbacks.
 - maple_tree tracks notifier ranges and supports deduplication.
 - MMU notifier registration is performed outside vm->lock.

Patch organization:
 1. Track cpu_autoreset_active in xe_vma.
 2. Preserve state across GPUVA operations.
 3. Clear state on first GPU fault.
 4. Add MMU notifier and worker infrastructure.
 5. Disable madvise notifier after GPU touch.
 6. Wire notifiers into VM lifecycle.
 7. Fix partial unmap attribute reset.

Changes in v2:
 - Move runtime state to xe_vma bool cpu_autoreset_active. (Matt)
 - Embed work_struct in xe_madvise_notifier. (Thomas)
 - Coalesce overlapping munmap events.
 - Replace closing state with teardown_rwsem. (Matt)
 - Use maple_tree for notifier tracking. (Matt)
 - Register notifiers outside vm->lock.
 - Add xe_vma_effective_create_flags() and fix REMAP split handling.
 - Move GPU-touch handling to the successful pagefault path. (Matt)
 - Use plain bool active in notifier. (Matt)
 - Add lockdep assertions for vm->lock.

Changes in v3:
 - Add kernel-doc and lockdep_assert_held to
   xe_vma_has_cpu_autoreset_active(). (Matt)
 - Guard cpu_autoreset_active assignment to CPU_ADDR_MIRROR VMAs only. (Matt)
 - Drop lockdep_assert_held_write from xe_svm_handle_pagefault. (Matt)
 - Rework GPU-touch handling after page faults. (Matt)
 - Rework notifier lifetime handling and teardown.
 - Keep exact-match notifier deactivation for split VMA handling.
 - Move notifier_ranges allocation before VMA mutation.
 - Keep a VM-owned notifier list for teardown.
 - Coalesce pending unmap ranges and reset only CPU holes in the worker.
 - Clear MADV_AUTORESET on notifier registration failure.
 - Coalesce partial_unmap range via min/max instead of blind overwrite. (Matt)
 - Restore range_debug() in xe_svm_garbage_collector_add_range(). (Matt)
 - Update partial_unmap under garbage_collector.lock.
 - Continue processing queued ranges on non-fatal set_default_attr failures.
 - Annotate lockless notifier->active access with READ_ONCE/WRITE_ONCE.

Arvind Yadav (6):
  drm/xe/vm: Track CPU_AUTORESET state in xe_vma
  drm/xe/vm: Preserve cpu_autoreset_active across GPUVA operations
  drm/xe/svm: Clear CPU_AUTORESET_ACTIVE on first GPU fault
  drm/xe/vm: Add madvise autoreset notifier worker
  drm/xe/vm: Disable madvise notifier on GPU touch
  drm/xe/vm: Wire MADVISE_AUTORESET notifiers into VM lifecycle

Himal Prasad Ghimiray (1):
  drm/xe/svm: Correct memory attribute reset for partial unmap

 drivers/gpu/drm/xe/xe_pagefault.c  |  13 +-
 drivers/gpu/drm/xe/xe_svm.c        | 102 ++++-
 drivers/gpu/drm/xe/xe_svm.h        |  10 +
 drivers/gpu/drm/xe/xe_vm.c         |  58 ++-
 drivers/gpu/drm/xe/xe_vm.h         |  28 ++
 drivers/gpu/drm/xe/xe_vm_madvise.c | 651 ++++++++++++++++++++++++++++-
 drivers/gpu/drm/xe/xe_vm_madvise.h |   9 +
 drivers/gpu/drm/xe/xe_vm_types.h   |  82 ++++
 8 files changed, 928 insertions(+), 25 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-06-05  0:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04  9:50 [RFC v3 0/7] drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap Arvind Yadav
2026-06-04  9:50 ` [RFC v3 1/7] drm/xe/vm: Track CPU_AUTORESET state in xe_vma Arvind Yadav
2026-06-04  9:50 ` [RFC v3 2/7] drm/xe/vm: Preserve cpu_autoreset_active across GPUVA operations Arvind Yadav
2026-06-04 10:07   ` sashiko-bot
2026-06-04  9:50 ` [RFC v3 3/7] drm/xe/svm: Clear CPU_AUTORESET_ACTIVE on first GPU fault Arvind Yadav
2026-06-04  9:50 ` [RFC v3 4/7] drm/xe/vm: Add madvise autoreset notifier worker Arvind Yadav
2026-06-04 10:14   ` sashiko-bot
2026-06-04  9:50 ` [RFC v3 5/7] drm/xe/vm: Disable madvise notifier on GPU touch Arvind Yadav
2026-06-04 10:03   ` sashiko-bot
2026-06-04  9:50 ` [RFC v3 6/7] drm/xe/vm: Wire MADVISE_AUTORESET notifiers into VM lifecycle Arvind Yadav
2026-06-04 10:05   ` sashiko-bot
2026-06-04  9:50 ` [RFC v3 7/7] drm/xe/svm: Correct memory attribute reset for partial unmap Arvind Yadav
2026-06-04 10:12   ` sashiko-bot
2026-06-04 10:32 ` ✗ CI.checkpatch: warning for drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap (rev3) Patchwork
2026-06-04 10:34 ` ✓ CI.KUnit: success " Patchwork
2026-06-04 11:35 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-05  0:02 ` ✗ Xe.CI.FULL: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.