Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] i915/sysfs_client: Ignore clients being closed as we read their sysfs
Date: Tue, 26 Jan 2021 16:33:31 +0000	[thread overview]
Message-ID: <331b98b3-8ff8-5f58-6994-4561cb0ca244@linux.intel.com> (raw)
In-Reply-To: <20210126130505.2938391-1-chris@chris-wilson.co.uk>


On 26/01/2021 13:05, Chris Wilson wrote:
> An earlier client from an old test may still be lingering and disappear
> as we scan the sysfs. Be graceful and let it go without tripping over it.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   tests/i915/sysfs_clients.c | 19 +++++++++----------
>   1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/i915/sysfs_clients.c b/tests/i915/sysfs_clients.c
> index 6be52c04f..a3a1f81e1 100644
> --- a/tests/i915/sysfs_clients.c
> +++ b/tests/i915/sysfs_clients.c
> @@ -62,11 +62,13 @@
>   
>   static void strterm(char *s, int len)
>   {
> -	igt_assert(len > 0);
> -
> -	s[len] = '\0';
> -	if (s[len - 1] == '\n')
> -		s[len - 1] = '\0';
> +	if (len < 0) {
> +		*s = '\0';
> +	} else {
> +		s[len] = '\0';
> +		if (s[len - 1] == '\n')
> +			s[len - 1] = '\0';
> +	}
>   }
>   
>   static void pidname(int i915, int clients)
> @@ -78,7 +80,6 @@ static void pidname(int i915, int clients)
>   	long count;
>   	pid_t pid;
>   	DIR *dir;
> -	int len;
>   
>   	dir = fdopendir(dup(clients));
>   	igt_assert(dir);
> @@ -90,13 +91,11 @@ static void pidname(int i915, int clients)
>   			continue;
>   
>   		snprintf(buf, sizeof(buf), "%s/name", de->d_name);
> -		len = igt_sysfs_read(clients, buf, buf, sizeof(buf) - 1);
> -		igt_assert_f(len > 0, "failed to open '%s/name'\n", de->d_name);
> -		strterm(buf, len);
> +		strterm(buf, igt_sysfs_read(clients, buf, buf, sizeof(buf) - 1));
>   		igt_debug("%s: %s\n", de->d_name, buf);
>   
>   		/* Ignore closed clients created by drm_driver_open() */
> -		if (*buf == '<')
> +		if (*buf == '\0' || *buf == '<')
>   			continue;
>   
>   		close(me);
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2021-01-26 16:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26 13:05 [igt-dev] [PATCH i-g-t 1/2] i915/sysfs_client: Ignore clients being closed as we read their sysfs Chris Wilson
2021-01-26 13:05 ` [igt-dev] [PATCH i-g-t 2/2] i915/sysfs_clients: Check that client ids are cyclic Chris Wilson
2021-01-26 16:47   ` Tvrtko Ursulin
2021-01-26 22:04     ` [Intel-gfx] " Chris Wilson
2021-01-26 22:07       ` [igt-dev] " Chris Wilson
2021-01-27  9:12       ` Tvrtko Ursulin
2021-01-27  9:51         ` Chris Wilson
2021-01-29  9:18   ` [Intel-gfx] " Tvrtko Ursulin
2021-01-29  9:52     ` [igt-dev] " Chris Wilson
2021-01-29 18:30       ` [Intel-gfx] " Tvrtko Ursulin
2021-01-26 16:33 ` Tvrtko Ursulin [this message]
2021-01-26 18:06 ` [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [i-g-t,1/2] i915/sysfs_client: Ignore clients being closed as we read their sysfs Patchwork
2021-01-26 18:18 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2021-01-26 23:20 ` [igt-dev] ✓ 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=331b98b3-8ff8-5f58-6994-4561cb0ca244@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@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