Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>
Subject: [PATCH i-g-t] tests/intel/xe_create: add create-big-bo-interruptible subtest
Date: Wed, 21 Oct 2026 15:22:41 +0100	[thread overview]
Message-ID: <20261021142240.826942-2-matthew.auld@intel.com> (raw)

Add a create-big-bo-interruptible subtest that wraps large BO
creation and CPU mmap verification in igt_fork_signal_helper() /
igt_stop_signal_helper() (500 Hz continuous signal interruption) and
also supports non-VRAM (iGPU) platforms using a 512 MiB system memory BO
(roughly matching bug report).

When a large BO creation overflows the migration batchbuffer
suballocation pool (gt->usm.bb_pool), an interruptible suballocator wait
aborts xe_migrate_clear() with -ERESTARTSYS, synchronously drains all
in-flight migration jobs at err_sync:, and restarts
DRM_IOCTL_XE_GEM_CREATE from scratch, livelocking under periodic signals
such as Xorg's SIGALRM smart-scheduler.

Current working theory for user reported bug. Running this locally, it
does indeed run forever on BMG. Patching the intr wait on kernel side,
fixes it.

Assisted-by: LLM
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9644
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 tests/intel/xe_create.c | 47 +++++++++++++++++++++++++++++++++--------
 1 file changed, 38 insertions(+), 9 deletions(-)

diff --git a/tests/intel/xe_create.c b/tests/intel/xe_create.c
index fd1993b21..0a1b54ae4 100644
--- a/tests/intel/xe_create.c
+++ b/tests/intel/xe_create.c
@@ -411,8 +411,14 @@ static void create_massive_size(int fd)
  * Test category: functionality test
  * Description: Verifies the creation of substantial BO within VRAM,
  *		constituting all available CPU-visible VRAM.
+ *
+ * SUBTEST: create-big-bo-interruptible
+ * Functionality: bo
+ * Test category: functionality test
+ * Description: Verifies the creation of substantial BO while continuously
+ *		interrupted by signals.
  */
-static void create_big_vram(int fd, int gt)
+static void create_big(int fd, int gt, bool interruptible)
 {
 	uint64_t bo_size, size, visible_avail_size, alignment;
 	uint32_t bo_handle;
@@ -422,14 +428,21 @@ static void create_big_vram(int fd, int gt)
 	alignment = xe_get_default_alignment(fd);
 	vm = xe_vm_create(fd, 0, 0);
 
-	visible_avail_size = xe_visible_available_vram_size(fd, gt);
-	igt_require(visible_avail_size);
-
-	bo_size = params.quantity ? params.quantity * 1024ULL * 1024ULL
-		  : ALIGN_DOWN(visible_avail_size * params.percent / 100, alignment);
+	if (xe_has_vram(fd)) {
+		visible_avail_size = xe_visible_available_vram_size(fd, gt);
+		bo_size = params.quantity ? params.quantity * 1024ULL * 1024ULL
+			  : ALIGN_DOWN(visible_avail_size * params.percent / 100, alignment);
+		igt_info("gt%u bo_size=%"PRIu64" visible_available_vram_size=%"PRIu64"\n",
+			 gt, bo_size, visible_avail_size);
+	} else {
+		bo_size = params.quantity ? params.quantity * 1024ULL * 1024ULL
+			  : SZ_512M;
+		igt_info("system bo_size=%"PRIu64"\n", bo_size);
+	}
 	igt_require(bo_size);
-	igt_info("gt%u bo_size=%"PRIu64" visible_available_vram_size=%"PRIu64"\n",
-		gt, bo_size, visible_avail_size);
+
+	if (interruptible)
+		igt_fork_signal_helper();
 
 	bo_handle = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
 				 DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
@@ -444,6 +457,9 @@ static void create_big_vram(int fd, int gt)
 	}
 	igt_assert_eq(0, bo_ptr[0]);
 
+	if (interruptible)
+		igt_stop_signal_helper();
+
 	munmap(bo_ptr, bo_size);
 	gem_close(fd, bo_handle);
 	xe_vm_destroy(fd, vm);
@@ -588,7 +604,20 @@ int igt_main_args("Q:p:", NULL, help_str, opt_handler, NULL)
 
 		xe_for_each_gt(xe, gt)
 			igt_dynamic_f("gt%u", gt)
-				create_big_vram(xe, gt);
+				create_big(xe, gt, false);
+	}
+
+	igt_subtest_with_dynamic("create-big-bo-interruptible") {
+		int gt;
+
+		if (xe_has_vram(xe)) {
+			xe_for_each_gt(xe, gt)
+				igt_dynamic_f("gt%u", gt)
+					create_big(xe, gt, true);
+		} else {
+			igt_dynamic("system")
+				create_big(xe, 0, true);
+		}
 	}
 
 	igt_subtest("create-contexts") {
-- 
2.56.0


             reply	other threads:[~2026-10-21 14:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21 14:22 Matthew Auld [this message]
2026-10-21 18:53 ` ✓ Xe.CI.BAT: success for tests/intel/xe_create: add create-big-bo-interruptible subtest Patchwork
2026-10-21 19:42 ` ✓ i915.CI.BAT: " Patchwork
2026-10-21 21:39 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-22  0:36 ` ✓ 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=20261021142240.826942-2-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=matthew.brost@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