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 3/4] lib/xe_eudebug: Warn on pipe timeouts
Date: Fri, 27 Sep 2024 16:53:34 +0300 [thread overview]
Message-ID: <20240927135335.1107326-3-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20240927135335.1107326-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.
Future improvement could be to parametrize the
timeout value so that simple tests with quite
deterministic runtime could specify a shorter
timeout.
v2: differ token timeout warn from value timeout (Dominik)
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
---
lib/xe/xe_eudebug.c | 43 +++++++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
index 2c7cd2ae1..36763a184 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 * const 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 value '%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)
--
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 ` [PATCH i-g-t 2/4] tests/xe_eudebug: Detect thread starvation on discovery Mika Kuoppala
2024-09-27 13:53 ` Mika Kuoppala [this message]
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-3-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