[PATCH v3 i-g-t 2/3] tests/intel/xe_eudebug: Add basic-vm-bind-ufence-reconnect test

Dominik Karol Piątkowski dominik.karol.piatkowski at intel.com
Mon Dec 16 13:49:36 UTC 2024


Add a test that gives user fence in application, holds it, drops the
debugger connection and checks if anything breaks. It is expected that
held acks are released when connection is dropped.

Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
Reviewed-by: Christoph Manszewski <christoph.manszewski at intel.com>
---
v2:
- Rename basic-vm-bind-drop-debugger-before-ufence-ack to
  basic-vm-bind-ufence-reconnect and merge it into test_basic_ufence
v3:
- Use xe_eudebug_client_wait_done instead of sleep
- Add missing braces
---
 tests/intel/xe_eudebug.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
index 1853dee40..8965e7f9d 100644
--- a/tests/intel/xe_eudebug.c
+++ b/tests/intel/xe_eudebug.c
@@ -64,6 +64,7 @@ static void test_sysfs_toggle(int fd)
 #define VM_BIND_OP_MAP_USERPTR		(1 << 7)
 #define EXEC_QUEUES_PLACEMENTS		(1 << 8)
 #define VM_BIND_DELAY_UFENCE_ACK	(1 << 9)
+#define VM_BIND_UFENCE_RECONNECT	(1 << 10)
 #define TEST_DISCOVERY			(1 << 31)
 
 #define PAGE_SIZE SZ_4K
@@ -2129,6 +2130,11 @@ static int wait_for_ufence_events(struct ufence_priv *priv, int timeout_ms)
  * SUBTEST: basic-vm-bind-ufence-delay-ack
  * Description:
  *	Give user fence in application and check if delayed ufence ack works
+ *
+ * SUBTEST: basic-vm-bind-ufence-reconnect
+ * Description:
+ *	Give user fence in application, hold it, drop the debugger connection and check if anything
+ *	breaks. Expect that held acks are released when connection is dropped.
  */
 static void test_basic_ufence(int fd, unsigned int flags)
 {
@@ -2136,6 +2142,7 @@ static void test_basic_ufence(int fd, unsigned int flags)
 	struct xe_eudebug_session *s;
 	struct xe_eudebug_client *c;
 	struct ufence_priv *priv;
+	uint32_t filter = XE_EUDEBUG_FILTER_EVENT_VM_BIND_UFENCE;
 
 	priv = ufence_priv_create();
 	s = xe_eudebug_session_create(fd, basic_ufence_client, flags, priv);
@@ -2157,7 +2164,15 @@ static void test_basic_ufence(int fd, unsigned int flags)
 	if (flags & VM_BIND_DELAY_UFENCE_ACK)
 		sleep(XE_EUDEBUG_DEFAULT_TIMEOUT_SEC * 4 / 5);
 
-	ack_fences(d);
+	if (flags & VM_BIND_UFENCE_RECONNECT) {
+		filter = XE_EUDEBUG_FILTER_EVENT_VM_BIND | XE_EUDEBUG_FILTER_EVENT_VM |
+				XE_EUDEBUG_FILTER_EVENT_OPEN;
+		xe_eudebug_debugger_detach(d);
+		xe_eudebug_client_wait_done(c);
+		igt_assert_eq(xe_eudebug_debugger_attach(d, c), 0);
+	} else {
+		ack_fences(d);
+	}
 
 	xe_eudebug_client_wait_done(c);
 	xe_eudebug_debugger_stop_worker(d, 1);
@@ -2165,7 +2180,7 @@ static void test_basic_ufence(int fd, unsigned int flags)
 	xe_eudebug_event_log_print(d->log, true);
 	xe_eudebug_event_log_print(c->log, true);
 
-	xe_eudebug_session_check(s, true, XE_EUDEBUG_FILTER_EVENT_VM_BIND_UFENCE);
+	xe_eudebug_session_check(s, true, filter);
 
 	xe_eudebug_session_destroy(s);
 	ufence_priv_destroy(priv);
@@ -2825,6 +2840,9 @@ igt_main
 	igt_subtest("basic-vm-bind-ufence-delay-ack")
 		test_basic_ufence(fd, VM_BIND_DELAY_UFENCE_ACK);
 
+	igt_subtest("basic-vm-bind-ufence-reconnect")
+		test_basic_ufence(fd, VM_BIND_UFENCE_RECONNECT);
+
 	igt_subtest("vma-ufence")
 		test_vma_ufence(fd, 0);
 
-- 
2.34.1



More information about the igt-dev mailing list