public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH] tests/intel/xe_exec_reset: Add spin-deadline section
Date: Sun,  4 Jan 2026 19:53:25 -0800	[thread overview]
Message-ID: <20260105035325.1306847-1-matthew.brost@intel.com> (raw)

Add a spin-deadline test section that sets deadlines on fences, thereby
triggering the internal KMD deadline logic. The test does not assert
deadline behavior directly; instead, ftrace can be enabled to infer the
expected KMD behavior.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 tests/intel/xe_exec_reset.c | 44 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/tests/intel/xe_exec_reset.c b/tests/intel/xe_exec_reset.c
index a3c4b2d7ba..0e07ff5ccf 100644
--- a/tests/intel/xe_exec_reset.c
+++ b/tests/intel/xe_exec_reset.c
@@ -27,14 +27,37 @@
 #include <string.h>
 
 #define SYNC_OBJ_SIGNALED	(0x1 << 0)
+#define DEADLINE		(0x1 << 1)
 #define LEGACY_MODE_ADDR	0x1a0000
 
+static uint64_t now_monotonic_nsec(void)
+{
+	struct timespec ts;
+
+	clock_gettime(CLOCK_MONOTONIC, &ts);
+
+	return (uint64_t)ts.tv_sec * 1000000000ull + ts.tv_nsec;
+}
+
+static uint64_t deadline_in_10ms(void)
+{
+	return now_monotonic_nsec() + 10ull * 1000 * 1000;
+}
+
+static uint64_t deadline_in_5ms(void)
+{
+	return now_monotonic_nsec() + 5ull * 1000 * 1000;
+}
+
 /**
  * SUBTEST: spin
  * Description: test spin
  *
  * SUBTEST: spin-signaled
  * Description: test spin with signaled sync obj
+ *
+ * SUBTEST: spin-deadline
+ * Description: test spin with a deadline
  */
 static void test_spin(int fd, struct drm_xe_engine_class_instance *eci,
 		      unsigned int flags)
@@ -87,8 +110,23 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci,
 		xe_exec(fd, &exec);
 
 		xe_spin_wait_started(spin);
-		usleep(50000);
 		igt_assert(!syncobj_wait(fd, &syncobj, 1, 1, 0, NULL));
+
+		if (flags & DEADLINE) {
+			struct drm_syncobj_wait args = {
+				.handles = to_user_pointer(&syncobj),
+				.count_handles = 1,
+				.deadline_nsec = deadline_in_10ms(),
+				.flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE,
+			};
+
+			__syncobj_wait(fd, &args);
+
+			args.deadline_nsec = deadline_in_5ms();
+			__syncobj_wait(fd, &args);
+		}
+
+		usleep(50000);
 		xe_spin_end(spin);
 
 		igt_assert(syncobj_wait(fd, &syncobj, 1, INT64_MAX, 0, NULL));
@@ -792,6 +830,10 @@ igt_main
 		xe_for_each_engine(fd, hwe)
 			test_spin(fd, hwe, 0);
 
+	igt_subtest("spin-deadline")
+		xe_for_each_engine(fd, hwe)
+			test_spin(fd, hwe, DEADLINE);
+
 	igt_subtest("spin-signaled")
 		xe_for_each_engine(fd, hwe)
 			test_spin(fd, hwe, SYNC_OBJ_SIGNALED);
-- 
2.34.1


             reply	other threads:[~2026-01-05  3:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  3:53 Matthew Brost [this message]
2026-01-05  4:49 ` ✓ Xe.CI.BAT: success for tests/intel/xe_exec_reset: Add spin-deadline section Patchwork
2026-01-05  4:58 ` ✓ i915.CI.BAT: " Patchwork
2026-01-05  6:11 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-05  7:06 ` ✗ 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=20260105035325.1306847-1-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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