From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Subject: [PATCH i-g-t 2/4] tests/xe_eudebug: Detect thread starvation on discovery
Date: Fri, 27 Sep 2024 16:53:33 +0300 [thread overview]
Message-ID: <20240927135335.1107326-2-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20240927135335.1107326-1-mika.kuoppala@linux.intel.com>
Discovery tests spawns multiple clients and multiple
debuggers and sometimes, especially with kernel debugs on,
some thread really can starve more than one second.
Add a check that we dont start to assert missing
resources if we didn't get any.
Another option would be to just skip starved thread
checks and assert that some of the threads succeeded.
But lets try this as a stopgap measure before giving
up.
Increase worker time until we see an event.
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
---
tests/intel/xe_eudebug.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
index 1c90fd16a..8d45d59f3 100644
--- a/tests/intel/xe_eudebug.c
+++ b/tests/intel/xe_eudebug.c
@@ -1107,11 +1107,24 @@ static void *discovery_race_thread(void *data)
if (random() % 2) {
struct drm_xe_eudebug_event *e = NULL;
+ int max_worker_waits = 30;
int i = -1;
xe_eudebug_debugger_start_worker(s->debugger);
- sleep(1);
+
+ /*
+ * Thread can starve for more than one second. Make
+ * sure we get at least one event before stopping.
+ */
+ do
+ sleep(1);
+ while (!READ_ONCE(s->debugger->event_count) &&
+ --max_worker_waits);
+
+ igt_assert(READ_ONCE(s->debugger->event_count));
+
xe_eudebug_debugger_stop_worker(s->debugger, 1);
+
igt_debug("Resources discovered: %lu\n", s->debugger->event_count);
xe_eudebug_for_each_event(e, s->debugger->log) {
--
2.34.1
next prev parent reply other threads:[~2024-09-27 14:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 13:53 [PATCH i-g-t 1/4] tests/xe_eudebug: Keep engine for each client Mika Kuoppala
2024-09-27 13:53 ` Mika Kuoppala [this message]
2024-09-27 13:53 ` [PATCH i-g-t 3/4] lib/xe_eudebug: Warn on pipe timeouts Mika Kuoppala
2024-09-27 13:53 ` [PATCH i-g-t 4/4] lib/xe_eudebug: Increase default pipe timeout value Mika Kuoppala
2024-09-27 16:12 ` ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests/xe_eudebug: Keep engine for each client Patchwork
2024-09-27 16:48 ` ✓ CI.xeBAT: " Patchwork
2024-09-28 13:36 ` ✗ CI.xeFULL: failure " Patchwork
2024-09-28 18:48 ` ✗ 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=20240927135335.1107326-2-mika.kuoppala@linux.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=dominik.grzegorzek@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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