public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] syncobj_timeline: Tell the compiler to read from the thread
Date: Thu, 6 Aug 2020 18:25:21 +0300	[thread overview]
Message-ID: <cb0af5ae-3b90-8057-2b11-d787b6f2a3fe@intel.com> (raw)
In-Reply-To: <20200806151938.198105-1-chris@chris-wilson.co.uk>

On 06/08/2020 18:19, Chris Wilson wrote:
> 32bits-limit waits for the thread to indicate it has started by busy
> spinning on a common variable. The compiler is clever and knows that the
> variable cannot change within the thread, and turns it into an infinite
> loop!
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>


Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>

> ---
>   tests/syncobj_timeline.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/syncobj_timeline.c b/tests/syncobj_timeline.c
> index be7dd2d1c..20375cdd3 100644
> --- a/tests/syncobj_timeline.c
> +++ b/tests/syncobj_timeline.c
> @@ -1245,9 +1245,11 @@ test_32bits_limit(int fd)
>   	uint64_t value, last_value;
>   	int i;
>   
> -	igt_assert_eq(pthread_create(&thread, NULL, checker_thread_func, &thread_data), 0);
> +	igt_assert_eq(pthread_create(&thread, NULL,
> +				     checker_thread_func, &thread_data), 0);
>   
> -	while (!thread_data.started);
> +	while (!READ_ONCE(thread_data.started))
> +		;
>   
>   	for (i = 0; i < ARRAY_SIZE(points); i++) {
>   		int fence = sw_sync_timeline_create_fence(timeline, i + 1);


_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-08-06 15:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 15:19 [igt-dev] [PATCH i-g-t] syncobj_timeline: Tell the compiler to read from the thread Chris Wilson
2020-08-06 15:25 ` Lionel Landwerlin [this message]
2020-08-06 16:07 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-08-06 22:03 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=cb0af5ae-3b90-8057-2b11-d787b6f2a3fe@intel.com \
    --to=lionel.g.landwerlin@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