From: Arvind Yadav <arvind.yadav@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: matthew.brost@intel.com, himal.prasad.ghimiray@intel.com,
thomas.hellstrom@linux.intel.com, nishit.sharma@intel.com,
pravalika.gurram@intel.com
Subject: [PATCH i-g-t v5 4/9] tests/intel/xe_madvise: Add purged-mmap-blocked subtest
Date: Tue, 3 Mar 2026 20:58:57 +0530 [thread overview]
Message-ID: <20260303152909.3503461-5-arvind.yadav@intel.com> (raw)
In-Reply-To: <20260303152909.3503461-1-arvind.yadav@intel.com>
Add a new purged-mmap-blocked subtest that triggers an actual purge
via memory pressure and verifies that DRM_IOCTL_XE_GEM_MMAP_OFFSET
returns -EINVAL once the BO backing store has been permanently
discarded.
- DONTNEED BOs: return -EBUSY (temporary purgeable state, BO still
has backing store but can be purged at any time)
- Purged BOs: return -EINVAL (permanent, backing store discarded)
v5:
- Add purged-mmap-blocked subtest to verify
DRM_IOCTL_XE_GEM_MMAP_OFFSET returns -EINVAL after BO
backing store is permanently purged.
Cc: Nishit Sharma <nishit.sharma@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Pravalika Gurram <pravalika.gurram@intel.com>
Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
---
tests/intel/xe_madvise.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tests/intel/xe_madvise.c b/tests/intel/xe_madvise.c
index 435dd939e..8dc568a92 100644
--- a/tests/intel/xe_madvise.c
+++ b/tests/intel/xe_madvise.c
@@ -152,6 +152,34 @@ static void purgeable_setup_simple_bo(int fd, uint32_t *vm, uint32_t *bo,
xe_wait_ufence(fd, &sync_val, 1, 0, NSEC_PER_SEC);
}
+/**
+ * SUBTEST: purged-mmap-blocked
+ * Description: After BO is purged, verify mmap offset fails with -EINVAL
+ * Test category: functionality test
+ */
+static void test_purged_mmap_blocked(int fd, struct drm_xe_engine_class_instance *hwe)
+{
+ uint32_t bo, vm;
+ uint64_t addr = PURGEABLE_ADDR;
+ size_t bo_size = PURGEABLE_BO_SIZE;
+ struct drm_xe_gem_mmap_offset mmo = {};
+
+ purgeable_setup_simple_bo(fd, &vm, &bo, addr, bo_size, false);
+ if (!purgeable_mark_and_verify_purged(fd, vm, addr, bo_size)) {
+ gem_close(fd, bo);
+ xe_vm_destroy(fd, vm);
+ igt_skip("Unable to induce purge on this platform/config");
+ }
+
+ /* Attempt to get mmap offset for purged BO - should fail with EINVAL */
+ mmo.handle = bo;
+ igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &mmo), -1);
+ igt_assert_eq(errno, EINVAL);
+
+ gem_close(fd, bo);
+ xe_vm_destroy(fd, vm);
+}
+
/**
* SUBTEST: dontneed-before-mmap
* Description: Mark BO as DONTNEED before mmap, verify mmap offset fails with -EBUSY
@@ -203,6 +231,12 @@ int igt_main()
break;
}
+ igt_subtest("purged-mmap-blocked")
+ xe_for_each_engine(fd, hwe) {
+ test_purged_mmap_blocked(fd, hwe);
+ break;
+ }
+
igt_fixture() {
xe_device_put(fd);
drm_close_driver(fd);
--
2.43.0
next prev parent reply other threads:[~2026-03-03 15:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 15:28 [PATCH i-g-t v5 0/9] tests/xe: Add purgeable memory madvise tests for system allocator Arvind Yadav
2026-03-03 15:28 ` [PATCH i-g-t v5 1/9] drm-uapi/xe_drm: Add UAPI support for purgeable buffer objects Arvind Yadav
2026-03-03 15:28 ` [PATCH i-g-t v5 2/9] lib/xe: Add purgeable memory ioctl support Arvind Yadav
2026-03-03 15:28 ` [PATCH i-g-t v5 3/9] tests/intel/xe_madvise: Add dontneed-before-mmap subtest Arvind Yadav
2026-03-03 15:28 ` Arvind Yadav [this message]
2026-03-03 15:28 ` [PATCH i-g-t v5 5/9] tests/intel/xe_madvise: Add dontneed-after-mmap subtest Arvind Yadav
2026-03-03 15:28 ` [PATCH i-g-t v5 6/9] tests/intel/xe_madvise: Add dontneed-before-exec subtest Arvind Yadav
2026-03-03 15:29 ` [PATCH i-g-t v5 7/9] tests/intel/xe_madvise: Add dontneed-after-exec subtest Arvind Yadav
2026-03-03 15:29 ` [PATCH i-g-t v5 8/9] tests/intel/xe_madvise: Add per-vma-tracking subtest Arvind Yadav
2026-03-03 15:29 ` [PATCH i-g-t v5 9/9] tests/intel/xe_madvise: Add per-vma-protection subtest Arvind Yadav
2026-03-04 4:14 ` ✓ Xe.CI.BAT: success for tests/xe: Add purgeable memory madvise tests for system allocator (rev5) Patchwork
2026-03-04 4:30 ` ✓ i915.CI.BAT: " Patchwork
2026-03-05 2:49 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-05 6:40 ` ✓ i915.CI.Full: success " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260303152909.3503461-5-arvind.yadav@intel.com \
--to=arvind.yadav@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=nishit.sharma@intel.com \
--cc=pravalika.gurram@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox