[PATCH 60/66] tests/xe_eudebug_online: What if user does not set debug mode?

Christoph Manszewski christoph.manszewski at intel.com
Mon Jul 29 16:01:53 UTC 2024


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

Implement test proving that workload is terminated if we hit
exception without having exec queue in debug mode.

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

diff --git a/tests/intel/xe_eudebug_online.c b/tests/intel/xe_eudebug_online.c
index cabe2101e..8361b6db4 100644
--- a/tests/intel/xe_eudebug_online.c
+++ b/tests/intel/xe_eudebug_online.c
@@ -24,6 +24,7 @@
 #define SHADER_LOOP			(1 << 1)
 #define SHADER_SINGLE_STEP		(1 << 2)
 #define SIP_SINGLE_STEP			(1 << 3)
+#define DISABLE_DEBUG_MODE		(1 << 4)
 #define TRIGGER_RESUME_SINGLE_WALK	(1 << 25)
 #define TRIGGER_RESUME_PARALLEL_WALK	(1 << 26)
 #define TRIGGER_RECONNECT		(1 << 27)
@@ -813,7 +814,7 @@ static void run_online_client(struct xe_eudebug_client *c)
 		.instances = to_user_pointer(&hwe),
 		.width = 1,
 		.num_placements = 1,
-		.extensions = to_user_pointer(&ext)
+		.extensions = c->flags & DISABLE_DEBUG_MODE ? 0 : to_user_pointer(&ext)
 	};
 	struct dim_t w_dim = walker_dimensions(threads);
 	struct dim_t s_dim = surface_dimensions(threads);
@@ -880,7 +881,8 @@ static void run_online_client(struct xe_eudebug_client *c)
 	data->threads_count = count_canaries_neq(ptr, w_dim, 0);
 	igt_assert_f(data->threads_count, "No canaries found, nothing executed?\n");
 
-	if (c->flags & SHADER_BREAKPOINT || c->flags & TRIGGER_RESUME_SET_BP) {
+	if ((c->flags & SHADER_BREAKPOINT || c->flags & TRIGGER_RESUME_SET_BP) &&
+	    !(c->flags & DISABLE_DEBUG_MODE)) {
 		uint32_t aip = ptr[0];
 
 		igt_assert_f(aip != SHADER_CANARY, "Workload executed but breakpoint not hit!\n");
@@ -1049,6 +1051,7 @@ static void online_session_check(struct xe_eudebug_session *s, int flags)
 	struct drm_xe_eudebug_event_eu_attention *ea = NULL;
 	struct drm_xe_eudebug_event *event = NULL;
 	struct online_debug_data *data = s->c->ptr;
+	bool expect_exception = flags & DISABLE_DEBUG_MODE ? false : true;
 	int sum = 0;
 	int bitmask_size;
 
@@ -1076,7 +1079,10 @@ static void online_session_check(struct xe_eudebug_session *s, int flags)
 	if (flags == SHADER_BREAKPOINT)
 		igt_assert_eq(sum, data->threads_count);
 
-	igt_assert(sum > 0);
+	if (expect_exception)
+		igt_assert(sum > 0);
+	else
+		igt_assert(sum == 0);
 }
 
 static void ufence_ack_trigger(struct xe_eudebug_debugger *d,
@@ -1092,7 +1098,12 @@ static void ufence_ack_trigger(struct xe_eudebug_debugger *d,
  * SUBTEST: basic-breakpoint
  * Description:
  *	Check whether KMD sends attention events
- *	for runalone workload stopped on breakpoint.
+ *	for workload in debug mode stopped on breakpoint.
+ *
+ * SUBTEST: breakpoint-not-in-debug-mode
+ * Description:
+ *	Check whether KMD resets the GPU when it spots an attention
+ *	coming from workload not in debug mode.
  *
  * SUBTEST: stopped-thread
  * Description:
@@ -1540,6 +1551,9 @@ igt_main
 	test_gt_render_or_compute("basic-breakpoint", fd, hwe)
 		test_basic_online(fd, hwe, SHADER_BREAKPOINT);
 
+	test_gt_render_or_compute("breakpoint-not-in-debug-mode", fd, hwe)
+		test_basic_online(fd, hwe, SHADER_BREAKPOINT | DISABLE_DEBUG_MODE);
+
 	test_gt_render_or_compute("stopped-thread", fd, hwe)
 		test_basic_online(fd, hwe, SHADER_BREAKPOINT | TRIGGER_RESUME_DELAYED);
 
-- 
2.34.1



More information about the igt-dev mailing list