Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v2 0/7] drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap
@ 2026-04-06  8:58 Arvind Yadav
  2026-04-06  8:58 ` [RFC v2 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-04-06  8:58 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, himal.prasad.ghimiray, thomas.hellstrom

This series implements automatic reset of GPU memory attributes when
userspace unmaps memory, ensuring non-default attributes set via the
MADVISE ioctl do not persist after CPU mappings are freed.

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 existing SVM notifiers.

Key aspects:
 - cpu_autoreset_active (xe_vma) tracks CPU-only vs GPU-touched state.
   XE_VMA_CPU_AUTORESET_ACTIVE is pipeline-only and not stored in gpuva.flags.
 - MMU notifier callback does not allocate. work_struct is embedded in
   xe_madvise_notifier and initialised at ioctl time. Overlapping munmap
   events are coalesced via min/max.
 - teardown_rwsem serialises VM teardown against callbacks.
 - struct maple_tree tracks notifiers: O(log N) dedup + insert.
 - Notifiers registered outside vm->lock; vm->lock taken only for dedup.
   Callback only queues work.

Patch organisation:
 1. Track cpu_autoreset_active in xe_vma and add pipeline-only flag.
 2. Preserve state across GPUVA operations.
 3. Clear state on first GPU fault.
 4. Add MMU notifier and worker infrastructure.
 5. Deactivate notifier on 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; no allocation in callback. (Thomas)
 - Coalesce overlapping munmap events via min/max.
 - Replace closing state with teardown_rwsem. (Matt)
 - Use maple_tree for notifier tracking. (Matt)
 - Register notifiers outside vm->lock; take it only for the maple-tree dedup check.
 - Add xe_vma_effective_create_flags() and fix REMAP split handling.
 - Move xe_vma_gpu_touch() to success path in pagefault handler. (Matt)
 - Use plain bool active in notifier. (Matt)
 - Add lockdep assertions for vm->lock.

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 interval notifier worker
    infrastructure
  drm/xe/vm: Deactivate 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_svm.c        |  80 ++++-
 drivers/gpu/drm/xe/xe_svm.h        |  10 +
 drivers/gpu/drm/xe/xe_vm.c         |  82 ++++-
 drivers/gpu/drm/xe/xe_vm.h         |  18 ++
 drivers/gpu/drm/xe/xe_vm_madvise.c | 498 ++++++++++++++++++++++++++++-
 drivers/gpu/drm/xe/xe_vm_madvise.h |   9 +
 drivers/gpu/drm/xe/xe_vm_types.h   |  87 +++++
 7 files changed, 761 insertions(+), 23 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-04-30  5:08 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-06  8:58 [RFC v2 0/7] drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap Arvind Yadav
2026-04-06  8:58 ` [RFC v2 1/7] drm/xe/vm: Track CPU_AUTORESET state in xe_vma Arvind Yadav
2026-04-30  4:07   ` Matthew Brost
2026-04-06  8:58 ` [RFC v2 2/7] drm/xe/vm: Preserve cpu_autoreset_active across GPUVA operations Arvind Yadav
2026-04-30  4:29   ` Matthew Brost
2026-04-06  8:58 ` [RFC v2 3/7] drm/xe/svm: Clear CPU_AUTORESET_ACTIVE on first GPU fault Arvind Yadav
2026-04-30  4:26   ` Matthew Brost
2026-04-06  8:58 ` [RFC v2 4/7] drm/xe/vm: Add madvise autoreset interval notifier worker infrastructure Arvind Yadav
2026-04-06  8:58 ` [RFC v2 5/7] drm/xe/vm: Deactivate madvise notifier on GPU touch Arvind Yadav
2026-04-06  8:58 ` [RFC v2 6/7] drm/xe/vm: Wire MADVISE_AUTORESET notifiers into VM lifecycle Arvind Yadav
2026-04-06  8:58 ` [RFC v2 7/7] drm/xe/svm: Correct memory attribute reset for partial unmap Arvind Yadav
2026-04-30  5:02   ` Matthew Brost
2026-04-30  5:08     ` Matthew Brost
2026-04-06  9:04 ` ✗ CI.checkpatch: warning for drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap (rev2) Patchwork
2026-04-06  9:06 ` ✓ CI.KUnit: success " Patchwork
2026-04-06  9:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-06 12:36 ` ✓ Xe.CI.FULL: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox