From: "Yadav, Arvind" <arvind.yadav@intel.com>
To: "Sharma, Nishit" <nishit.sharma@intel.com>,
"Gurram, Pravalika" <pravalika.gurram@intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Brost, Matthew" <matthew.brost@intel.com>,
"Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>,
"thomas.hellstrom@linux.intel.com"
<thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH i-g-t v3 4/8] tests/intel/xe_madvise: Add dontneed-after-mmap subtest
Date: Mon, 23 Feb 2026 15:07:39 +0530 [thread overview]
Message-ID: <42956771-7298-4bff-b170-d4858722d1cd@intel.com> (raw)
In-Reply-To: <3c923dd6-26c0-427c-bb6f-1941e1bca6a4@intel.com>
On 23-02-2026 11:22, Sharma, Nishit wrote:
>
> On 2/23/2026 10:40 AM, Gurram, Pravalika wrote:
>>
>>> -----Original Message-----
>>> From: Yadav, Arvind <arvind.yadav@intel.com>
>>> Sent: Tuesday, 17 February, 2026 08:04 AM
>>> To: igt-dev@lists.freedesktop.org
>>> Cc: Brost, Matthew <matthew.brost@intel.com>; Ghimiray, Himal Prasad
>>> <himal.prasad.ghimiray@intel.com>; thomas.hellstrom@linux.intel.com;
>>> Sharma, Nishit <nishit.sharma@intel.com>; Gurram, Pravalika
>>> <pravalika.gurram@intel.com>
>>> Subject: [PATCH i-g-t v3 4/8] tests/intel/xe_madvise: Add
>>> dontneed-after-
>>> mmap subtest
>>>
>>> This test verifies that an existing mmap becomes invalid after the
>>> BO is marked
>>> as purgeable and purged. The test creates a BO, maps it, writes
>>> data, then
>>> marks it DONTNEED and triggers memory pressure.
>>> Accessing the previously valid mapping should now trigger SIGBUS or
>>> SIGSEGV,
>>> confirming that existing mappings are correctly invalidated when the
>>> backing
>>> store is purged.
>>>
>>> Cc: Nishit Sharma <nishit.sharma@intel.com>
>>> Cc: Pravalika Gurram <pravalika.gurram@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>
>>> Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
>>> ---
>>> tests/intel/xe_madvise.c | 54
>>> ++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 54 insertions(+)
>>>
>>> diff --git a/tests/intel/xe_madvise.c b/tests/intel/xe_madvise.c index
>>> 7dbe70f42..5c6a24553 100644
>>> --- a/tests/intel/xe_madvise.c
>>> +++ b/tests/intel/xe_madvise.c
>>> @@ -196,6 +196,54 @@ static void test_dontneed_before_mmap(int fd,
>>> struct drm_xe_engine_class_instanc
>>> xe_vm_destroy(fd, vm);
>>> }
>>>
>>> +/**
>>> + * SUBTEST: dontneed-after-mmap
>>> + * Description: Mark BO as DONTNEED after mmap, verify SIGBUS on
>>> +accessing purged mapping
>>> + * Test category: functionality test
>>> + */
>>> +static void test_dontneed_after_mmap(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;
>>> + void *map;
>>> +
>>> + purgeable_setup_simple_bo(fd, &vm, &bo, addr, bo_size, true);
>>> +
>>> + map = xe_bo_map(fd, bo, bo_size);
>>> + memset(map, 0xAB, bo_size);
>>> +
>>> + if (!purgeable_mark_and_verify_purged(fd, vm, addr, bo_size))
>>> + igt_skip("Unable to induce purge on this platform/config");
> Same comment as in [Patch- 3/8]
Noted,
>>> +
>>> + /* Access purged mapping - should trigger SIGBUS/SIGSEGV */
>>> + {
>>> + sighandler_t old_sigsegv, old_sigbus;
>>> + char *ptr = (char *)map;
>>> + int sig;
>>> +
>>> + old_sigsegv = signal(SIGSEGV, (__sighandler_t)sigtrap);
>>> + old_sigbus = signal(SIGBUS, (__sighandler_t)sigtrap);
>>> +
>>> + sig = sigsetjmp(jmp, SIGBUS | SIGSEGV);
>>> + if (sig == SIGBUS || sig == SIGSEGV) {
>>> + /* Expected - purged mapping access failed */
>>> + } else if (sig == 0) {
>>> + *ptr = 0;
>>> + igt_assert_f(false, "Access to purged mapping should
>>> trigger signal\n");
>>> + } else {
>>> + igt_assert_f(false, "unexpected signal %d\n", sig);
>>> + }
> same comment as in [Patch-3/8]
Noted,
Thanks,
Arvind
>>> +
>>> + signal(SIGBUS, old_sigbus);
>>> + signal(SIGSEGV, old_sigsegv);
>>> + }
>>> +
>>> + munmap(map, bo_size);
>>> + gem_close(fd, bo);
>>> + xe_vm_destroy(fd, vm);
>>> +}
>>> +
>> Reviewed-by: Pravalika Gurram <pravalika.gurram@intel.com>
>>> int igt_main()
>>> {
>>> struct drm_xe_engine_class_instance *hwe; @@ -212,6 +260,12 @@
>>> int igt_main()
>>> break;
>>> }
>>>
>>> + igt_subtest("dontneed-after-mmap")
>>> + xe_for_each_engine(fd, hwe) {
>>> + test_dontneed_after_mmap(fd, hwe);
>>> + break;
>>> + }
>>> +
>>> igt_fixture() {
>>> xe_device_put(fd);
>>> drm_close_driver(fd);
>>> --
>>> 2.43.0
next prev parent reply other threads:[~2026-02-23 9:37 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=42956771-7298-4bff-b170-d4858722d1cd@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