From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Subject: [PATCH i-g-t 3/3] lib/xe_eudebug: Warn on pipe timeouts
Date: Thu, 26 Sep 2024 13:39:39 +0300 [thread overview]
Message-ID: <20240926103939.550907-3-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20240926103939.550907-1-mika.kuoppala@linux.intel.com>
eudebug test helpers use pipe between debugger/debuggee
communication. If we ever fail even a single pipe read
the whole test framework sync is lost. So if we get a
timeout we should be quite vocal about in instead of
just notifying that the pipe read size was not met.
Further with kernel debugs on, some discovery tests
can starve some of the debugger threads for quite
a long time so increase the default timeout value.
Future improvement could be to parametrize the
timeout value so that simple tests with quite
deterministic runtime could specify a shorter
timeout.
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
lib/xe/xe_eudebug.c | 43 +++++++++++++++++++++++++++++--------------
lib/xe/xe_eudebug.h | 2 +-
2 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index 2c7cd2ae1..da93e9785 100644
--- a/lib/xe/xe_eudebug.c
+++ b/lib/xe/xe_eudebug.c
@@ -47,6 +47,23 @@ struct match_dto {
#define CLIENT_STAGE 5
#define DEBUGGER_STAGE 6
+static const char *token_to_str(uint64_t token)
+{
+ static const char *s[] = {
+ "client pid",
+ "client run",
+ "client fini",
+ "client stop",
+ "client stage",
+ "debugger stage",
+ };
+
+ if (token >= ARRAY_SIZE(s))
+ return "unknown";
+
+ return s[token];
+}
+
static const char *type_to_str(unsigned int type)
{
switch (type) {
@@ -248,18 +265,7 @@ static int safe_pipe_read(int pipe[2], void *buf, int nbytes, int timeout_ms)
if (ret > 0)
return read(pipe[0], buf, nbytes);
- return 0;
-}
-
-static uint64_t pipe_read(int pipe[2], int timeout_ms)
-{
- uint64_t in;
- uint64_t ret;
-
- ret = safe_pipe_read(pipe, &in, sizeof(in), timeout_ms);
- igt_assert(ret == sizeof(in));
-
- return in;
+ return -ETIMEDOUT;
}
static void pipe_signal(int pipe[2], uint64_t token)
@@ -279,12 +285,21 @@ static void pipe_close(int pipe[2])
static uint64_t __wait_token(int pipe[2], const uint64_t token, int timeout_ms)
{
uint64_t in;
+ int ret;
- in = pipe_read(pipe, timeout_ms);
+ ret = safe_pipe_read(pipe, &in, sizeof(in), timeout_ms);
+ igt_assert_f(ret > 0,
+ "Pipe read timeout waiting for token '%s:(%ld)'\n",
+ token_to_str(token), token);
igt_assert_eq(in, token);
- return pipe_read(pipe, timeout_ms);
+ ret = safe_pipe_read(pipe, &in, sizeof(in), timeout_ms);
+ igt_assert_f(ret > 0,
+ "Pipe read timeout waiting for token '%s:(%ld)'\n",
+ token_to_str(token), token);
+
+ return in;
}
static uint64_t client_wait_token(struct xe_eudebug_client *c, const uint64_t token)
diff --git a/lib/xe/xe_eudebug.h b/lib/xe/xe_eudebug.h
index 29ab68fee..6e4666333 100644
--- a/lib/xe/xe_eudebug.h
+++ b/lib/xe/xe_eudebug.h
@@ -112,7 +112,7 @@ typedef void (*xe_eudebug_trigger_fn)(struct xe_eudebug_debugger *,
* Default abort timeout to use across xe_eudebug lib and tests if no specific
* timeout value is required.
*/
-#define XE_EUDEBUG_DEFAULT_TIMEOUT_SEC 25ULL
+#define XE_EUDEBUG_DEFAULT_TIMEOUT_SEC 60ULL
#define XE_EUDEBUG_FILTER_EVENT_NONE BIT(DRM_XE_EUDEBUG_EVENT_NONE)
#define XE_EUDEBUG_FILTER_EVENT_READ BIT(DRM_XE_EUDEBUG_EVENT_READ)
--
2.34.1
next prev parent reply other threads:[~2024-09-26 10:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 10:39 [PATCH i-g-t 1/3] tests/xe_eudebug: Keep engine for each client Mika Kuoppala
2024-09-26 10:39 ` [PATCH i-g-t 2/3] tests/xe_eudebug: Detect thread starvation on discovery Mika Kuoppala
2024-09-26 14:18 ` Grzegorzek, Dominik
2024-09-26 10:39 ` Mika Kuoppala [this message]
2024-09-26 14:38 ` [PATCH i-g-t 3/3] lib/xe_eudebug: Warn on pipe timeouts Grzegorzek, Dominik
2024-09-26 11:49 ` ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] tests/xe_eudebug: Keep engine for each client Patchwork
2024-09-26 12:07 ` ✗ CI.xeBAT: failure " Patchwork
2024-09-26 14:06 ` [PATCH i-g-t 1/3] " Grzegorzek, Dominik
2024-09-26 15:11 ` ✗ Fi.CI.IGT: failure for series starting with [i-g-t,1/3] " Patchwork
2024-09-27 6:02 ` ✗ CI.xeFULL: " 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=20240926103939.550907-3-mika.kuoppala@linux.intel.com \
--to=mika.kuoppala@linux.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