From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
Jan Sokolowski <jan.sokolowski@intel.com>,
Dominik Grzegorzek <dominik.grzegorzek@intel.com>,
Christoph Manszewski <christoph.manszewski@intel.com>
Subject: [PATCH i-g-t] lib/xe/xe_eudebug: Deny unused triggers
Date: Thu, 31 Oct 2024 13:19:58 +0200 [thread overview]
Message-ID: <20241031111958.524160-1-mika.kuoppala@linux.intel.com> (raw)
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
next reply other threads:[~2024-10-31 11:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 11:19 Mika Kuoppala [this message]
2024-10-31 12:55 ` ✓ Fi.CI.BAT: success for lib/xe/xe_eudebug: Deny unused triggers 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
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=20241031111958.524160-1-mika.kuoppala@linux.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=christoph.manszewski@intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jan.sokolowski@intel.com \
/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