[PATCH i-g-t v2 65/66] tests/xe_eudebug_online: Check if eu debugger disables preemption timeout

Christoph Manszewski christoph.manszewski at intel.com
Tue Jul 30 11:45:22 UTC 2024


From: Dominik Grzegorzek <dominik.grzegorzek at intel.com>

Workloads could potentially be stopped on a breakpoint for a long time,
due to that eu debugger needs to disable preemption timeout to
prevent reset of such workload. Verify that.

Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Christoph Manszewski <christoph.manszewski at intel.com>
---
 tests/intel/xe_eudebug_online.c | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
index ab1a57d9b..6a451b2a4 100644
--- a/tests/intel/xe_eudebug_online.c
+++ b/tests/intel/xe_eudebug_online.c
@@ -20,6 +20,7 @@
 #include "intel_mocs.h"
 #include "gpgpu_shader.h"
 
+#define SHADER_NOP			(0 << 0)
 #define SHADER_BREAKPOINT		(1 << 0)
 #define SHADER_LOOP			(1 << 1)
 #define SHADER_SINGLE_STEP		(1 << 2)
@@ -1322,6 +1323,51 @@ static void test_basic_online(int fd, struct drm_xe_engine_class_instance *hwe,
 	online_debug_data_destroy(data);
 }
 
+/**
+ * SUBTEST: preempt-breakpoint
+ * Description:
+ *	Verify that eu debugger disables preemption timeout to
+ *	prevent reset of workload stopped on breakpoint.
+ */
+static void test_preemption(int fd, struct drm_xe_engine_class_instance *hwe)
+{
+	int flags = SHADER_BREAKPOINT | TRIGGER_RESUME_DELAYED;
+	struct xe_eudebug_session *s;
+	struct online_debug_data *data;
+	struct xe_eudebug_client *other;
+
+	data = online_debug_data_create(hwe);
+	s = xe_eudebug_session_create(fd, run_online_client, flags, data);
+	other = xe_eudebug_client_create(fd, run_online_client, SHADER_NOP, data);
+
+	xe_eudebug_debugger_add_trigger(s->d, DRM_XE_EUDEBUG_EVENT_EU_ATTENTION,
+					eu_attention_debug_trigger);
+	xe_eudebug_debugger_add_trigger(s->d, DRM_XE_EUDEBUG_EVENT_EU_ATTENTION,
+					eu_attention_resume_trigger);
+	xe_eudebug_debugger_add_trigger(s->d, DRM_XE_EUDEBUG_EVENT_VM_BIND_UFENCE,
+					ufence_ack_trigger);
+
+	igt_assert_eq(xe_eudebug_debugger_attach(s->d, s->c), 0);
+	xe_eudebug_debugger_start_worker(s->d);
+
+	xe_eudebug_client_start(s->c);
+	sleep(1); /* make sure s->c starts first */
+	xe_eudebug_client_start(other);
+
+	xe_eudebug_client_wait_done(s->c);
+	xe_eudebug_client_wait_done(other);
+
+	xe_eudebug_debugger_stop_worker(s->d, 1);
+
+	xe_eudebug_session_destroy(s);
+	xe_eudebug_client_destroy(other);
+
+	igt_assert_f(data->last_eu_control_seqno != 0,
+		     "Workload with breakpoint has ended without resume!\n");
+
+	online_debug_data_destroy(data);
+}
+
 /**
  * SUBTEST: reset-with-attention
  * Description:
@@ -2002,6 +2048,9 @@ igt_main
 	test_gt_render_or_compute("basic-breakpoint-no-lr", fd, hwe)
 		test_basic_online(fd, hwe, SHADER_BREAKPOINT | DISABLE_LONG_RUNNING_MODE);
 
+	test_gt_render_or_compute("preempt-breakpoint", fd, hwe)
+		test_preemption(fd, hwe);
+
 	test_gt_render_or_compute("breakpoint-not-in-debug-mode", fd, hwe)
 		test_basic_online(fd, hwe, SHADER_BREAKPOINT | DISABLE_DEBUG_MODE);
 
-- 
2.34.1



More information about the igt-dev mailing list