public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v3 0/8] tests/xe: Add purgeable memory madvise tests for system allocator
@ 2026-02-17  2:34 Arvind Yadav
  2026-02-17  2:34 ` [PATCH i-g-t v3 1/8] drm-uapi/xe_drm: Add UAPI support for purgeable buffer objects Arvind Yadav
                   ` (11 more replies)
  0 siblings, 12 replies; 38+ messages in thread
From: Arvind Yadav @ 2026-02-17  2:34 UTC (permalink / raw)
  To: igt-dev
  Cc: matthew.brost, himal.prasad.ghimiray, thomas.hellstrom,
	nishit.sharma, pravalika.gurram

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 3679 bytes --]

This series adds IGT tests for the purgeable memory madvise functionality
in the XE driver's system allocator path.

Purgeable memory allows userspace to mark buffer objects as DONTNEED,
making them eligible for kernel reclamation under memory pressure. This
is critical for mobile and memory-constrained platforms to prevent OOM
conditions while managing temporary or regeneratable GPU data.

The test suite validates:
- Basic purgeable lifecycle (WILLNEED -> DONTNEED -> PURGED)
- "Once purged, always purged" semantics (i915 compatibility)
- Per-VMA purgeable state tracking for shared buffers
- CPU fault handling on purged BOs (SIGBUS/SIGSEGV)
- GPU execution with purged memory and scratch page protection
- Proper state transitions across multiple VMs

Purgeable Memory States:-
 - **WILLNEED (0)**: Memory is actively needed, kernel should not
		     reclaim it.
 - **DONTNEED (1)**: Application doesn't need this memory right now,
                     kernel can reclaim it if needed

Retained Value
 When querying purgeable state, the kernel returns:
 - retained = 1: Memory is still present (not purged)
 - retained = 0: Memory was purged/reclaimed

Kernel dependency: https://patchwork.freedesktop.org/series/156651/

Test Cases :
  1. madvise-purgeable-dontneed-before-mmap
  	Purpose: Validate that mmap fails on already-purged BO

  2. madvise-purgeable-dontneed-after-mmap
	Purpose: Validate that accessing an existing mapping of purged memory
	         triggers SIGBUS/SIGSEGV.

  3. madvise-purgeable-dontneed-before-exec
	Purpose: Validate GPU execution on purgeable BO (before it's used).

  4. madvise-purgeable-dontneed-after-exec
	Purpose: Validate that previously-used BO can be purged and becomes
                 inaccessible.

  5. madvise-purgeable-per-vma-tracking
	Purpose: Validate per-VMA purgeable state tracking

  6. madvise-purgeable-per-vma-protection
	Purpose: Validate that WILLNEED VMA protects BO from purging during
                 GPU operations.

v2:
   - Move tests from xe_exec_system_allocator.c to dedicated
     xe_madvise.c (Thomas Hellström).
   - Fix trigger_memory_pressure to use scalable overpressure
    (25% of VRAM, minimum 64MB instead of fixed 64MB). (Pravalika)
   - Add MAP_FAILED check in trigger_memory_pressure.
   - Touch all pages in allocated chunks, not just first 4KB. (Pravalika)
   - Add 100ms sleep before freeing BOs to allow shrinker time
     to process memory pressure.  (Pravalika)
   - Rename 'bo2' to 'handle' for clarity in trigger_memory_pressure.(Pravalika)
   - Add NEEDS_VISIBLE_VRAM flag to purgeable_setup_simple_bo
     for consistent CPU mapping support on discrete GPUs.  (Pravalika)
   - Add proper NULL mmap handling in test_dontneed_before_mmap
      with cleanup and early return.  (Pravalika)

v3:
   - Added separate commits for each individual test case. (Pravalika)

Arvind Yadav (7):
  lib/xe: Add purgeable memory ioctl support
  tests/intel/xe_madvise: Add dontneed-before-mmap subtest
  tests/intel/xe_madvise: Add dontneed-after-mmap subtest
  tests/intel/xe_madvise: Add dontneed-before-exec subtest
  tests/intel/xe_madvise: Add dontneed-after-exec subtest
  tests/intel/xe_madvise: Add per-vma-tracking subtest
  tests/intel/xe_madvise: Add per-vma-protection subtest

Himal Prasad Ghimiray (1):
  drm-uapi/xe_drm: Add UAPI support for purgeable buffer objects

 include/drm-uapi/xe_drm.h |  44 +++
 lib/xe/xe_ioctl.c         |  33 ++
 lib/xe/xe_ioctl.h         |   2 +
 tests/intel/xe_madvise.c  | 731 ++++++++++++++++++++++++++++++++++++++
 tests/meson.build         |   1 +
 5 files changed, 811 insertions(+)
 create mode 100644 tests/intel/xe_madvise.c

-- 
2.43.0


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

end of thread, other threads:[~2026-02-24  4:09 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17  2:34 [PATCH i-g-t v3 0/8] tests/xe: Add purgeable memory madvise tests for system allocator Arvind Yadav
2026-02-17  2:34 ` [PATCH i-g-t v3 1/8] drm-uapi/xe_drm: Add UAPI support for purgeable buffer objects Arvind Yadav
2026-02-18 11:22   ` Kamil Konieczny
2026-02-23  4:29   ` Gurram, Pravalika
2026-02-23  9:33     ` Yadav, Arvind
2026-02-17  2:34 ` [PATCH i-g-t v3 2/8] lib/xe: Add purgeable memory ioctl support Arvind Yadav
2026-02-23  4:30   ` Gurram, Pravalika
2026-02-17  2:34 ` [PATCH i-g-t v3 3/8] tests/intel/xe_madvise: Add dontneed-before-mmap subtest Arvind Yadav
2026-02-19  4:58   ` Gurram, Pravalika
2026-02-20  6:06     ` Yadav, Arvind
2026-02-23  5:09   ` Gurram, Pravalika
2026-02-23  5:49     ` Sharma, Nishit
2026-02-23  9:36       ` Yadav, Arvind
2026-02-17  2:34 ` [PATCH i-g-t v3 4/8] tests/intel/xe_madvise: Add dontneed-after-mmap subtest Arvind Yadav
2026-02-19  5:01   ` Gurram, Pravalika
2026-02-20  6:13     ` Yadav, Arvind
2026-02-23  5:10   ` Gurram, Pravalika
2026-02-23  5:52     ` Sharma, Nishit
2026-02-23  9:37       ` Yadav, Arvind
2026-02-17  2:34 ` [PATCH i-g-t v3 5/8] tests/intel/xe_madvise: Add dontneed-before-exec subtest Arvind Yadav
2026-02-23  5:10   ` Gurram, Pravalika
2026-02-23  6:06     ` Sharma, Nishit
2026-02-23  9:45       ` Yadav, Arvind
2026-02-17  2:34 ` [PATCH i-g-t v3 6/8] tests/intel/xe_madvise: Add dontneed-after-exec subtest Arvind Yadav
2026-02-23  5:11   ` Gurram, Pravalika
2026-02-23  7:04     ` Sharma, Nishit
2026-02-24  4:07       ` Yadav, Arvind
2026-02-17  2:34 ` [PATCH i-g-t v3 7/8] tests/intel/xe_madvise: Add per-vma-tracking subtest Arvind Yadav
2026-02-23  5:11   ` Gurram, Pravalika
2026-02-23  7:17     ` Sharma, Nishit
2026-02-24  4:08       ` Yadav, Arvind
2026-02-17  2:34 ` [PATCH i-g-t v3 8/8] tests/intel/xe_madvise: Add per-vma-protection subtest Arvind Yadav
2026-02-23  5:12   ` Gurram, Pravalika
2026-02-23  7:25     ` Sharma, Nishit
2026-02-17  3:25 ` ✓ Xe.CI.BAT: success for tests/xe: Add purgeable memory madvise tests for system allocator (rev3) Patchwork
2026-02-17  4:22 ` ✓ Xe.CI.FULL: " Patchwork
2026-02-17  8:57 ` ✓ i915.CI.BAT: " Patchwork
2026-02-17 10:50 ` ✗ i915.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