Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Grzegorzek, Dominik" <dominik.grzegorzek@intel.com>
To: "mika.kuoppala@linux.intel.com" <mika.kuoppala@linux.intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 2/3] tests/xe_eudebug: Detect thread starvation on discovery
Date: Thu, 26 Sep 2024 14:18:00 +0000	[thread overview]
Message-ID: <077daf5f29055787e9d3a8f81da724b1f0ed5e20.camel@intel.com> (raw)
In-Reply-To: <20240926103939.550907-2-mika.kuoppala@linux.intel.com>

On Thu, 2024-09-26 at 13:39 +0300, Mika Kuoppala wrote:
> 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>
> ---
>  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 a2b2f3596..bf560462e 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 atleast 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);
> +

Yep, sleep(1) had some risk to be not enough. Your approach is more elegant.
Thanks for the fix!
 
Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
>  			igt_debug("Resources discovered: %lu\n", s->debugger->event_count);
>  
>  			xe_eudebug_for_each_event(e, s->debugger->log) {


  reply	other threads:[~2024-09-26 14:18 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 [this message]
2024-09-26 10:39 ` [PATCH i-g-t 3/3] lib/xe_eudebug: Warn on pipe timeouts Mika Kuoppala
2024-09-26 14:38   ` 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=077daf5f29055787e9d3a8f81da724b1f0ed5e20.camel@intel.com \
    --to=dominik.grzegorzek@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.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