public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
* [RFC 0/7] drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap
@ 2026-02-19  9:13 Arvind Yadav
  2026-02-19  9:13 ` [RFC 1/7] drm/xe/vm: Add CPU_AUTORESET_ACTIVE VMA flag Arvind Yadav
                   ` (10 more replies)
  0 siblings, 11 replies; 19+ messages in thread
From: Arvind Yadav @ 2026-02-19  9:13 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 (munmap), ensuring non-default attributes don't persist after
CPU mappings are freed.

The implementation uses MMU interval notifiers to detect munmap events on
CPU-only VMAs (not yet GPU-faulted). When detected, work is queued to reset
their attributes to defaults. GPU-touched VMAs continue using existing SVM
notifiers and are not affected by this series.

The autoreset is best-effort. The CPU_AUTORESET_ACTIVE flag serves as the
authoritative state - if notifier delivery fails, the GPU page table zapping
path checks this flag directly, ensuring correctness regardless of notifier
delivery.

Key aspects:
- CPU_AUTORESET_ACTIVE flag tracks CPU-only vs GPU-touched state
- Notifier callbacks queue work (cannot take vm->lock due to lock ordering)
- Workqueue processes resets under vm->lock, serializing with VM operations
- Mempool prevents allocation failures in atomic context
- Clean teardown: closing flag + SRCU sync + workqueue drain

Patch organization:
1. Add CPU_AUTORESET_ACTIVE flag definition
2. Propagate flag across GPUVA operations (map/remap/split)
3. Clear flag on GPU touch (one-way CPU-only → GPU-touched transition)
4. Add MMU notifier + workqueue infrastructure
5. Deactivate notifier optimization (avoid overhead after GPU touch)
6. Wire notifiers into VM lifecycle (init/fini/teardown)
7. Fix partial unmap attribute reset handling

Arvind Yadav (6):
  drm/xe/vm: Add CPU_AUTORESET_ACTIVE VMA flag
  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        |  78 +++-
 drivers/gpu/drm/xe/xe_svm.h        |  10 +
 drivers/gpu/drm/xe/xe_vm.c         |  50 ++-
 drivers/gpu/drm/xe/xe_vm.h         |  18 +
 drivers/gpu/drm/xe/xe_vm_madvise.c | 553 ++++++++++++++++++++++++++++-
 drivers/gpu/drm/xe/xe_vm_madvise.h |  10 +
 drivers/gpu/drm/xe/xe_vm_types.h   |  51 +++
 7 files changed, 749 insertions(+), 21 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-03-11  6:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19  9:13 [RFC 0/7] drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap Arvind Yadav
2026-02-19  9:13 ` [RFC 1/7] drm/xe/vm: Add CPU_AUTORESET_ACTIVE VMA flag Arvind Yadav
2026-02-19  9:13 ` [RFC 2/7] drm/xe/vm: Preserve CPU_AUTORESET_ACTIVE across GPUVA operations Arvind Yadav
2026-02-19  9:13 ` [RFC 3/7] drm/xe/svm: Clear CPU_AUTORESET_ACTIVE on first GPU fault Arvind Yadav
2026-02-20 20:12   ` Matthew Brost
2026-02-20 22:33     ` Matthew Brost
2026-03-05  3:38       ` Yadav, Arvind
2026-02-19  9:13 ` [RFC 4/7] drm/xe/vm: Add madvise autoreset interval notifier worker infrastructure Arvind Yadav
2026-02-25 23:34   ` Matthew Brost
2026-03-09  7:07     ` Yadav, Arvind
2026-03-09  9:32       ` Thomas Hellström
2026-03-11  6:34         ` Yadav, Arvind
2026-02-19  9:13 ` [RFC 5/7] drm/xe/vm: Deactivate madvise notifier on GPU touch Arvind Yadav
2026-02-19  9:13 ` [RFC 6/7] drm/xe/vm: Wire MADVISE_AUTORESET notifiers into VM lifecycle Arvind Yadav
2026-02-19  9:13 ` [RFC 7/7] drm/xe/svm: Correct memory attribute reset for partial unmap Arvind Yadav
2026-02-19  9:40 ` ✗ CI.checkpatch: warning for drm/xe/svm: Add MMU notifier-based madvise autoreset on munmap Patchwork
2026-02-19  9:42 ` ✓ CI.KUnit: success " Patchwork
2026-02-19 10:40 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-19 13:04 ` ✗ Xe.CI.FULL: failure " Patchwork

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