All of lore.kernel.org
 help / color / mirror / Atom feed
From: nishit.sharma@intel.com
To: igt-dev@lists.freedesktop.org, kamil.konieczny@intel.com
Subject: [PATCH v2 1/9] tests/intel/xe_exec_reset: Add concurrent GT reset submit stress test
Date: Tue, 18 Aug 2026 04:08:37 +0000	[thread overview]
Message-ID: <20260818040845.548727-2-nishit.sharma@intel.com> (raw)
In-Reply-To: <20260818040845.548727-1-nishit.sharma@intel.com>

From: Nishit Sharma <nishit.sharma@intel.com>

Add a dedicated stress subtest for concurrent GT reset and job submission.
The new subtest exercises reset/submit overlap by running:
1. GT resets on a selected GT
2. Concurrent job submission threads creating queues and executing batches

Signed-off-by: Nishit Sharma <nishit.sharma@intel.com>
---
 tests/intel/xe_exec_reset.c | 40 ++++++++++++++++++++++++++++++-------
 1 file changed, 33 insertions(+), 7 deletions(-)

diff --git a/tests/intel/xe_exec_reset.c b/tests/intel/xe_exec_reset.c
index 044d8f007..134378974 100644
--- a/tests/intel/xe_exec_reset.c
+++ b/tests/intel/xe_exec_reset.c
@@ -650,6 +650,9 @@ struct gt_thread_data {
 	int *go;
 	int *exit;
 	int *num_reset;
+	int *num_submit;
+	int *num_submit_fail;
+	unsigned int flags;
 	bool do_reset;
 };
 
@@ -671,7 +674,7 @@ static void submit_jobs(struct gt_thread_data *t)
 	uint32_t bo;
 	uint32_t *data;
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0),
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, t->gt),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	data[0] = MI_BATCH_BUFFER_END;
@@ -682,7 +685,7 @@ static void submit_jobs(struct gt_thread_data *t)
 		struct drm_xe_engine_class_instance instance = {
 			.engine_class = DRM_XE_ENGINE_CLASS_COPY,
 			.engine_instance = 0,
-			.gt_id = 0,
+			.gt_id = t->gt,
 		};
 		struct drm_xe_exec exec = {
 			.address = addr,
@@ -692,11 +695,14 @@ static void submit_jobs(struct gt_thread_data *t)
 
 		/* GuC IDs can get exhausted */
 		ret = __xe_exec_queue_create(fd, vm, 1, 1, &instance, 0, &exec.exec_queue_id);
-		if (ret)
+		if (ret) {
+			(*t->num_submit_fail)++;
 			continue;
+		}
 
 		xe_exec(fd, &exec);
 		xe_exec_queue_destroy(fd, exec.exec_queue_id);
+		(*t->num_submit)++;
 	}
 
 	munmap(data, bo_size);
@@ -726,14 +732,19 @@ static void *gt_reset_thread(void *data)
  * Description: Stress GT reset
  * Test category: stress test
  *
+ * SUBTEST: gt-stress-reset-concurrent-submit
+ * Description: Stress concurrent GT resets and job submissions
+ * Test category: stress test
+ *
  */
 static void
-gt_reset(int fd, int n_threads, int n_sec)
+gt_reset(int fd, int gt, int n_threads, int n_sec, unsigned int flags)
 {
 	struct gt_thread_data *threads;
 	pthread_mutex_t mutex;
 	pthread_cond_t cond;
 	int go = 0, exit = 0, num_reset = 0, i;
+	int num_submit = 0, num_submit_fail = 0;
 
 	threads = calloc(n_threads, sizeof(struct gt_thread_data));
 	igt_assert(threads);
@@ -745,10 +756,13 @@ gt_reset(int fd, int n_threads, int n_sec)
 		threads[i].mutex = &mutex;
 		threads[i].cond = &cond;
 		threads[i].fd = fd;
-		threads[i].gt = 0;
+		threads[i].gt = gt;
+		threads[i].flags = flags;
 		threads[i].go = &go;
 		threads[i].exit = &exit;
 		threads[i].num_reset = &num_reset;
+		threads[i].num_submit = &num_submit;
+		threads[i].num_submit_fail = &num_submit_fail;
 		threads[i].do_reset = (i == 0);
 
 		pthread_create(&threads[i].thread, 0, gt_reset_thread,
@@ -766,8 +780,11 @@ gt_reset(int fd, int n_threads, int n_sec)
 	for (i = 0; i < n_threads; i++)
 		pthread_join(threads[i].thread, NULL);
 
-	igt_info("number of resets %d\n", num_reset);
+	igt_info("number of resets %d, submissions %d, submit fails %d\n",
+		 num_reset, num_submit, num_submit_fail);
 
+	igt_assert_neq(num_reset, 0);
+	igt_assert_neq(num_submit, 0);
 	free(threads);
 }
 
@@ -934,6 +951,10 @@ int igt_main()
 		{ "parallel", PARALLEL },
 		{ NULL },
 	};
+	const struct section ssections[] = {
+		{ "reset-concurrent-submit", 0 },
+		{ NULL },
+	};
 	int gt;
 	int class;
 	int fd;
@@ -1126,7 +1147,12 @@ int igt_main()
 	}
 
 	igt_subtest("gt-reset-stress")
-		gt_reset(fd, 4, 1);
+		gt_reset(fd, 0, 4, 1, 0);
+
+	for (const struct section *s = ssections; s->name; s++) {
+		igt_subtest_f("gt-stress-%s", s->name)
+			gt_reset(fd, 0, 8, 2, 0);
+	}
 
 	igt_subtest("gt-mocs-reset")
 		xe_for_each_gt(fd, gt)
-- 
2.43.0


  reply	other threads:[~2026-08-18  4:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  4:08 [PATCH v2 0/9] extend GT reset stress coverage nishit.sharma
2026-08-18  4:08 ` nishit.sharma [this message]
2026-08-24 18:54   ` [PATCH v2 1/9] tests/intel/xe_exec_reset: Add concurrent GT reset submit stress test Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 2/9] tests/intel/xe_exec_reset: add sync concurrent reset submit subtest nishit.sharma
2026-08-24 18:58   ` Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 3/9] tests/intel/xe_exec_reset: add gt-stress-reset-memory-pressure subtest nishit.sharma
2026-08-24 19:00   ` Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 4/9] tests/intel/xe_exec_reset: add gt-stress-reset-bo-invalidation subtest nishit.sharma
2026-08-24 19:06   ` Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 5/9] tests/intel/xe_exec_reset: add gt-stress-reset-rapid-cycle subtest nishit.sharma
2026-08-24 19:07   ` Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 6/9] tests/intel/xe_exec_reset: add gt-stress-reset-destroy-vm-context subtest nishit.sharma
2026-08-24 19:07   ` Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 7/9] tests/intel/xe_exec_reset: add gt-stress-reset-mixed-engine-usage subtest nishit.sharma
2026-08-24 19:09   ` Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 8/9] tests/intel/xe_exec_reset: add gt-stress-reset-pm-transition subtest nishit.sharma
2026-08-24 19:10   ` Kamil Konieczny
2026-08-18  4:08 ` [PATCH v2 9/9] tests/intel/xe_exec_reset: add gt-stress-reset-engine-hang subtest nishit.sharma
2026-08-24 19:11   ` Kamil Konieczny
2026-08-18  4:50 ` ✓ Xe.CI.BAT: success for extend GT reset stress coverage (rev2) Patchwork
2026-08-18  5:04 ` ✓ i915.CI.BAT: " Patchwork
2026-08-18  5:56 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-08-18 16:04 ` ✗ i915.CI.Full: " 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=20260818040845.548727-2-nishit.sharma@intel.com \
    --to=nishit.sharma@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.