Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/xe/xe_eudebug: Deny unused triggers
@ 2024-10-31 11:19 Mika Kuoppala
  2024-10-31 12:55 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mika Kuoppala @ 2024-10-31 11:19 UTC (permalink / raw)
  To: igt-dev
  Cc: Mika Kuoppala, Jan Sokolowski, Dominik Grzegorzek,
	Christoph Manszewski

Assert that if you add a trigger, it is used.

Cc: Jan Sokolowski <jan.sokolowski@intel.com>
Cc: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Cc: Christoph Manszewski <christoph.manszewski@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 lib/xe/xe_eudebug.c | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index 74aa26024..97ed71838 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -20,6 +20,7 @@
 struct event_trigger {
 	xe_eudebug_trigger_fn fn;
 	int type;
+	unsigned int count;
 	struct igt_list_head link;
 };
 
@@ -1014,8 +1015,26 @@ static void debugger_run_triggers(struct xe_eudebug_debugger *d,
 	struct event_trigger *t;
 
 	igt_list_for_each_entry(t, &d->triggers, link) {
-		if (e->type == t->type)
-			t->fn(d, e);
+		if (e->type != t->type)
+			continue;
+
+		t->fn(d, e);
+		++t->count;
+
+		igt_debug("Trigger run for %s:%d %d times\n",
+			  type_to_str(t->type), t->type,
+			  t->count);
+	}
+}
+
+static void debugger_check_triggers(struct xe_eudebug_debugger *d)
+{
+	struct event_trigger *t;
+
+	igt_list_for_each_entry(t, &d->triggers, link) {
+		igt_assert_f(READ_ONCE(t->count),
+			     "Trigger %s(%d): was never invoked\n",
+			     type_to_str(t->type), t->type);
 	}
 }
 
@@ -1223,7 +1242,7 @@ void xe_eudebug_debugger_add_trigger(struct xe_eudebug_debugger *d,
 	t->fn = fn;
 
 	igt_list_add_tail(&t->link, &d->triggers);
-	igt_debug("added trigger %p\n", t);
+	igt_debug("Trigger added for %s:%d\n", type_to_str(t->type), t->type);
 }
 
 /**
@@ -1303,6 +1322,8 @@ void xe_eudebug_debugger_stop_worker(struct xe_eudebug_debugger *d,
 	igt_assert_f(ret == 0 || ret != ESRCH,
 		     "pthread join failed with error %d!\n", ret);
 
+	debugger_check_triggers(d);
+
 	event_log_sort(d->log);
 }
 
@@ -1603,6 +1624,8 @@ void xe_eudebug_session_run(struct xe_eudebug_session *s)
  */
 void xe_eudebug_session_check(struct xe_eudebug_session *s, bool match_opposite, uint32_t filter)
 {
+	debugger_check_triggers(s->debugger);
+
 	xe_eudebug_event_log_compare(s->client->log, s->debugger->log, filter);
 
 	if (match_opposite)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-31 19:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 11:19 [PATCH i-g-t] lib/xe/xe_eudebug: Deny unused triggers Mika Kuoppala
2024-10-31 12:55 ` ✓ Fi.CI.BAT: success for " Patchwork
2024-10-31 13:10 ` ✓ CI.xeBAT: " Patchwork
2024-10-31 17:12 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-31 19:30 ` ✗ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox