All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sobin Thomas <sobin.thomas@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@intel.com, Sobin Thomas <sobin.thomas@intel.com>
Subject: [PATCH i-g-t v1] test/intel/xe_vm: Add multi-GPU VRAM overcommit test
Date: Thu, 24 Sep 2026 18:37:08 +0000	[thread overview]
Message-ID: <20260924183709.2643390-1-sobin.thomas@intel.com> (raw)

Extend the VRAM overcommit test to cover all available Xe GPUs
independently. Run each existing overcommit scenarios on every
physical GPU and use the VRAM capacity of the respective GPU
when calculating the overcommit size.

Signed-off-by: Sobin Thomas <sobin.thomas@intel.com>
---
 tests/intel/xe_vm.c | 56 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/tests/intel/xe_vm.c b/tests/intel/xe_vm.c
index 545350894..6588baa75 100644
--- a/tests/intel/xe_vm.c
+++ b/tests/intel/xe_vm.c
@@ -22,6 +22,11 @@
 #include <string.h>
 #define USER_FENCE_VALUE 0xdeadbeefdeadbeefull
 
+struct overcommit_gpu {
+	int fd;
+	struct drm_xe_engine_class_instance *hwe_non_copy;
+};
+
 enum overcommit_stage {
 	EXPECT_NONE,
 	EXPECT_CREATE,
@@ -35,6 +40,40 @@ addr_low(uint64_t addr)
 	return addr;
 }
 
+/* Get the number of the GPUs */
+static int get_overcommit_gpus(struct overcommit_gpu **gpus)
+{
+	struct overcommit_gpu *tmp = NULL;
+	int num_gpus = 0, i;
+
+	for (i = 0; ; i++) {
+		int gpu_fd;
+		struct drm_xe_engine *engine;
+		struct drm_xe_engine_class_instance *eci;
+
+		gpu_fd = __drm_open_driver_another(i, DRIVER_XE);
+		if (gpu_fd < 0)
+			break;
+		if (!xe_has_vram(gpu_fd) || !xe_visible_vram_size(gpu_fd, 0)) {
+			drm_close_driver(gpu_fd);
+			continue;
+		}
+		engine = xe_engine(gpu_fd, 0);
+		if (!engine) {
+			drm_close_driver(gpu_fd);
+			continue;
+		}
+		eci = &engine->instance;
+		tmp = realloc(tmp, (num_gpus + 1) * sizeof(*tmp));
+		igt_assert(tmp);
+		tmp[num_gpus].fd = gpu_fd;
+		tmp[num_gpus].hwe_non_copy = eci;
+		num_gpus++;
+	}
+	*gpus = tmp;
+	return num_gpus;
+}
+
 static uint32_t
 addr_high(int fd, uint64_t addr)
 {
@@ -3539,6 +3578,23 @@ int igt_main()
 		}
 	}
 
+	igt_subtest("overcommit-multigpu") {
+		struct overcommit_gpu *gpus = NULL;
+		int num_gpus = get_overcommit_gpus(&gpus);
+
+		for (int i = 0; i < num_gpus; i++) {
+			for (int j = 0; overcommit_cases[j].name; j++) {
+				const struct vm_overcommit_case *c = &overcommit_cases[j];
+
+				test_vm_overcommit(gpus[i].fd, gpus[i].hwe_non_copy, c,
+						   igt_get_avail_ram_mb() << 20,
+						   xe_visible_vram_size(gpus[i].fd, 0));
+			}
+			drm_close_driver(gpus[i].fd);
+		}
+		free(gpus);
+	}
+
 	igt_fixture()
 		drm_close_driver(fd);
 }
-- 
2.52.0


                 reply	other threads:[~2026-09-24 18:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260924183709.2643390-1-sobin.thomas@intel.com \
    --to=sobin.thomas@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.