From: Sobin Thomas <sobin.thomas@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: nishit.sharma@intel.com, Sobin Thomas <sobin.thomas@intel.com>
Subject: [PATCH i-g-t] tests/intel/xe_vm: Validate host memory for overcommit tests
Date: Fri, 25 Sep 2026 09:49:30 +0000 [thread overview]
Message-ID: <20260925094930.2647997-1-sobin.thomas@intel.com> (raw)
The amount of VRAM available for the overcommit tests varies
across platforms. As a result the host RAM and swap required to
support the overcommit workload also varies.
Query the platform RAM and swap space and visible VRAM before
running overcommit tests.
Require a minimum swap capacity relative to the platform memory
config and limit the overcommit working set to 50% of the currently
available RAM and swap size.
Signed-off-by: Sobin Thomas <sobin.thomas@intel.com>
---
tests/intel/xe_vm.c | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index a0a6616c3..4ee2ebbc0 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -2611,6 +2611,13 @@ test_vm_overcommit(int fd, struct drm_xe_engine_class_instance *eci,
overcommit_size = ALIGN((uint64_t)(base_size * c->overcommit_mult), 4096);
num_bos = (overcommit_size / nf_bo_size) + 1;
+ igt_debug("Overcommit sizing: case=%s use_vram=%d multiplier=%d "
+ "system_size=%" PRIu64 " MiB vram_size=%" PRIu64 " MiB "
+ "base_size=%" PRIu64 " MiB overcommit_size=%" PRIu64 " MiB "
+ "bo_size=%" PRIu64 " MiB num_bos=%d\n",
+ c->name, c->use_vram, c->overcommit_mult,
+ system_size >> 20, vram_size >> 20, base_size >> 20,
+ overcommit_size >> 20, nf_bo_size >> 20, num_bos);
bos = calloc(num_bos, sizeof(*bos));
igt_assert(bos);
@@ -2634,6 +2641,8 @@ test_vm_overcommit(int fd, struct drm_xe_engine_class_instance *eci,
/* Create and bind data BOs */
actual_stage = create_data_bos(fd, vm, bos, num_bos, nf_bo_size, c->use_vram, data_addr,
c->bo_flags, eci->gt_id, &num_bound);
+ igt_debug("Overcommit BO creation: case=%s actual_stage=%d num_bound=%d/%d\n",
+ c->name, actual_stage, num_bound, num_bos);
/*
* On EXPECT_CREATE nothing was bound so bail out entirely.
* On EXPECT_BIND with no BOs bound there is nothing to execute either.
@@ -3499,9 +3508,33 @@ int igt_main()
const char *mode = (c->vm_flags & DRM_XE_VM_CREATE_FLAG_FAULT_MODE) ?
"fault" : "nonfault";
igt_subtest_f("overcommit-%s-%s", mode, c->name) {
+ uint64_t ram_mb = igt_get_total_ram_mb();
+ uint64_t swap_mb = igt_get_total_swap_mb();
+ uint64_t vram_mb = xe_visible_vram_size(fd, 0) >> 20;
+ uint64_t avail_ram_mb = igt_get_avail_ram_mb();
+ uint64_t required_mb;
+ uint64_t budget_mb;
+
igt_require(xe_has_vram(fd));
- igt_require(xe_visible_vram_size(fd, 0));
- test_vm_overcommit(fd, hwe_non_copy, c, (igt_get_avail_ram_mb() << 20),
+ igt_require(vram_mb);
+ igt_debug("Overcommit host memory: case=%s mode=%s total_ram=%" PRIu64
+ " MiB available_ram=%" PRIu64 " MiB vram=%" PRIu64
+ " MiB swap=%" PRIu64 " MiB swap_ratio=%" PRIu64 "%%\n",
+ c->name, mode, ram_mb, avail_ram_mb, vram_mb, swap_mb,
+ (vram_mb + ram_mb) ? swap_mb * 100 / (vram_mb + ram_mb) : 0);
+ igt_require_f(swap_mb * 100 >= (vram_mb + ram_mb) * 35,
+ "Swap (%" PRIu64 " MiB) must be at least 35%% of "
+ "VRAM + system RAM (%" PRIu64 " MiB)\n",
+ swap_mb, vram_mb + ram_mb);
+ required_mb = ((c->use_vram ? vram_mb : avail_ram_mb) *
+ c->overcommit_mult);
+ required_mb = ALIGN(required_mb, 64) + 64;
+ budget_mb = avail_ram_mb + swap_mb;
+ igt_require_f(required_mb <= budget_mb * 50 / 100,
+ "Overcommit working set (%" PRIu64 " MiB) exceeds "
+ "50%% of available RAM + swap (%" PRIu64 " MiB)\n",
+ required_mb, budget_mb);
+ test_vm_overcommit(fd, hwe_non_copy, c, (avail_ram_mb << 20),
xe_visible_vram_size(fd, 0));
}
}
--
2.52.0
next reply other threads:[~2026-09-25 9:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 9:49 Sobin Thomas [this message]
2026-09-25 10:39 ` ✓ Xe.CI.BAT: success for tests/intel/xe_vm: Validate host memory for overcommit tests Patchwork
2026-09-25 10:50 ` ✓ i915.CI.BAT: " Patchwork
2026-09-25 19:08 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-26 4:36 ` ✗ i915.CI.Full: " Patchwork
2026-10-05 16:28 ` [PATCH i-g-t] " Sharma, Nishit
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=20260925094930.2647997-1-sobin.thomas@intel.com \
--to=sobin.thomas@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=nishit.sharma@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