All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Manszewski, Christoph" <christoph.manszewski@intel.com>
To: "Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	"Mika Kuoppala" <mika.kuoppala@linux.intel.com>
Subject: Re: [PATCH v7 i-g-t 2/9] lib/xe_eudebug: Don't fail in __wait_token if pipe was broken
Date: Mon, 29 Sep 2025 13:29:28 +0200	[thread overview]
Message-ID: <3efd46f4-43a4-4dfd-b5fb-c2807eeb4f4b@intel.com> (raw)
In-Reply-To: <20250926074801.9031-3-dominik.karol.piatkowski@intel.com>

Hi Dominik,

On 26.09.2025 09:47, Dominik Karol Piątkowski wrote:
> If safe_pipe_read returns -errno, print it and let the upper layer
> decide if this is acceptable. This will allow for debugging if something
> goes wrong, while reducing the false tripping of tests in which a dead
> client can occur.
> 
> Signed-off-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
> ---
>   lib/xe/xe_eudebug.c | 39 +++++++++++++++++++++++++++++++--------
>   lib/xe/xe_eudebug.h |  2 ++
>   2 files changed, 33 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
> index d29c82857..0c3262c41 100644
> --- a/lib/xe/xe_eudebug.c
> +++ b/lib/xe/xe_eudebug.c
> @@ -296,34 +296,56 @@ static void pipe_close(int pipe[2])
>   		close(pipe[1]);
>   }
>   
> +#define DEAD_CLIENT 0xccccdead
> +
>   static uint64_t __wait_token(int pipe[2], const uint64_t token, int timeout_ms)
>   {
>   	uint64_t in;
>   	int ret;
>   
>   	ret = safe_pipe_read(pipe, &in, sizeof(in), timeout_ms);
> -	igt_assert_f(ret > 0,
> -		     "Pipe read timeout waiting for token '%s:(%" PRId64 ")'\n",
> -		     token_to_str(token), token);
> +	if (ret < 0) {
> +		igt_info("Pipe read failed with error: %d waiting for token '%s:(%" PRId64 ")'\n",
> +			 ret, token_to_str(token), token);

igt_info seems quite loud considering that this error may be expected 
and will get passed down to another library function to decide what to 
do with it.

Nit: I think "Pipe poll" would be better here, with "Pipe read" bellow. 
Or just use the function name in both cases that is 'safe_pipe_read'.

With that:
Reviewed-by: Christoph Manszewski <christoph.manszewski@intel.com>

Regards,
Christoph


> +		return DEAD_CLIENT;
> +	} else if (ret == 0) {
> +		igt_info("Pipe read failed: EOF\n");
> +		return DEAD_CLIENT;
> +	}
>   
>   	igt_assert_eq(in, token);
>   
>   	ret = safe_pipe_read(pipe, &in, sizeof(in), timeout_ms);
> -	igt_assert_f(ret > 0,
> -		     "Pipe read timeout waiting for token value '%s:(%" PRId64 ")'\n",
> -		     token_to_str(token), token);
> +	if (ret < 0) {
> +		igt_info("Pipe read failed with error: %d waiting for token '%s:(%" PRId64 ")'\n",
> +			 ret, token_to_str(token), token);
> +		return DEAD_CLIENT;
> +	} else if (ret == 0) {
> +		igt_info("Pipe read failed: EOF\n");
> +		return DEAD_CLIENT;
> +	}
>   
>   	return in;
>   }
>   
>   static uint64_t client_wait_token(struct xe_eudebug_client *c, const uint64_t token)
>   {
> -	return __wait_token(c->p_in, token, c->timeout_ms);
> +	uint64_t ret = __wait_token(c->p_in, token, c->timeout_ms);
> +
> +	if (ret == DEAD_CLIENT)
> +		igt_assert(c->allow_dead_client);
> +
> +	return ret;
>   }
>   
>   static uint64_t wait_from_client(struct xe_eudebug_client *c, const uint64_t token)
>   {
> -	return __wait_token(c->p_out, token, c->timeout_ms);
> +	uint64_t ret = __wait_token(c->p_out, token, c->timeout_ms);
> +
> +	if (ret == DEAD_CLIENT)
> +		igt_assert(c->allow_dead_client);
> +
> +	return ret;
>   }
>   
>   static void token_signal(int pipe[2], const uint64_t token, const uint64_t value)
> @@ -1402,6 +1424,7 @@ struct xe_eudebug_client *xe_eudebug_client_create(int master_fd, xe_eudebug_cli
>   	c->ptr = data;
>   	c->master_fd = master_fd;
>   	c->timeout_ms = XE_EUDEBUG_DEFAULT_TIMEOUT_SEC * MSEC_PER_SEC;
> +	c->allow_dead_client = false;
>   	pthread_mutex_init(&c->lock, NULL);
>   
>   	igt_fork(child, 1) {
> diff --git a/lib/xe/xe_eudebug.h b/lib/xe/xe_eudebug.h
> index 3adde5f6c..8f7f66220 100644
> --- a/lib/xe/xe_eudebug.h
> +++ b/lib/xe/xe_eudebug.h
> @@ -66,6 +66,8 @@ struct xe_eudebug_client {
>   
>   	int timeout_ms;
>   
> +	bool allow_dead_client;
> +
>   	pthread_mutex_t lock;
>   };
>   


  reply	other threads:[~2025-09-29 11:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26  7:47 [PATCH v7 i-g-t 0/9] Fix xe_eudebug_online@set-breakpoint-sigint-debugger Dominik Karol Piątkowski
2025-09-26  7:47 ` [PATCH v7 i-g-t 1/9] lib/xe_eudebug: Fix safe_pipe_read Dominik Karol Piątkowski
2025-09-29 19:11   ` Zbigniew Kempczyński
2025-09-26  7:47 ` [PATCH v7 i-g-t 2/9] lib/xe_eudebug: Don't fail in __wait_token if pipe was broken Dominik Karol Piątkowski
2025-09-29 11:29   ` Manszewski, Christoph [this message]
2025-09-26  7:47 ` [PATCH v7 i-g-t 3/9] tests/xe_eudebug_online: Allow dead client in set-breakpoint-sigint-debugger Dominik Karol Piątkowski
2025-09-26  7:47 ` [PATCH v7 i-g-t 4/9] lib/xe_eudebug: Introduce xe_eudebug_debugger_kill Dominik Karol Piątkowski
2025-09-26  7:47 ` [PATCH v7 i-g-t 5/9] tests/xe_eudebug_online: Improve issuing SIGINT in set-breakpoint-sigint-debugger Dominik Karol Piątkowski
2025-09-29 19:13   ` Zbigniew Kempczyński
2025-09-26  7:47 ` [PATCH v7 i-g-t 6/9] lib/xe_eudebug: Improve SIGINT handling Dominik Karol Piątkowski
2025-09-29 19:16   ` Zbigniew Kempczyński
2025-09-26  7:47 ` [PATCH v7 i-g-t 7/9] tests/xe_eudebug_online: Introduce proper sync for closing debugger fd in set-breakpoint-sigint-debugger Dominik Karol Piątkowski
2025-09-29 19:17   ` Zbigniew Kempczyński
2025-09-26  7:48 ` [PATCH v7 i-g-t 8/9] lib/xe_eudebug: Introduce SIGTERM handling Dominik Karol Piątkowski
2025-09-29 19:19   ` Zbigniew Kempczyński
2025-09-26  7:48 ` [PATCH v7 i-g-t 9/9] tests/xe_eudebug_online: Issue SIGTERM in set-breakpoint-sigint-debugger Dominik Karol Piątkowski
2025-09-29 19:20   ` Zbigniew Kempczyński
2025-09-26 18:10 ` ✓ Xe.CI.BAT: success for Fix xe_eudebug_online@set-breakpoint-sigint-debugger (rev7) Patchwork
2025-09-26 18:26 ` ✓ i915.CI.BAT: " Patchwork
2025-09-26 23:21 ` ✗ i915.CI.Full: failure " Patchwork
2025-09-27  0:38 ` ✗ Xe.CI.Full: " 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=3efd46f4-43a4-4dfd-b5fb-c2807eeb4f4b@intel.com \
    --to=christoph.manszewski@intel.com \
    --cc=dominik.karol.piatkowski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    --cc=zbigniew.kempczynski@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.