All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] dma-buf: Relax the write-seqlock for reallocating the shared fence list
Date: Tue, 16 Jul 2019 11:21:54 +0200	[thread overview]
Message-ID: <20190716092154.GZ15868@phenom.ffwll.local> (raw)
In-Reply-To: <20190712080314.21018-2-chris@chris-wilson.co.uk>

On Fri, Jul 12, 2019 at 09:03:14AM +0100, Chris Wilson wrote:
> As the set of shared fences is not being changed during reallocation of
> the reservation list, we can skip updating the write_seqlock.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Christian König <christian.koenig@amd.com>

sounds legit.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

More seriously, I think I convinced myself that we cant see a mess of old
and new fence arrays anywhere, even without the seqlock retry, so I think
we should be all good.
-Daniel

> ---
>  drivers/dma-buf/reservation.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 80ecc1283d15..c71b85c8c159 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -157,15 +157,15 @@ int reservation_object_reserve_shared(struct reservation_object *obj,
>  		(ksize(new) - offsetof(typeof(*new), shared)) /
>  		sizeof(*new->shared);
>  
> -	preempt_disable();
> -	write_seqcount_begin(&obj->seq);
>  	/*
> -	 * RCU_INIT_POINTER can be used here,
> -	 * seqcount provides the necessary barriers
> +	 * We are not changing the effective set of fences here so can
> +	 * merely update the pointer to the new array; both existing
> +	 * readers and new readers will see exactly the same set of
> +	 * active (unsignaled) shared fences. Individual fences and the
> +	 * old array are protected by RCU and so will not vanish under
> +	 * the gaze of the rcu_read_lock() readers.
>  	 */
> -	RCU_INIT_POINTER(obj->fence, new);
> -	write_seqcount_end(&obj->seq);
> -	preempt_enable();
> +	rcu_assign_pointer(obj->fence, new);
>  
>  	if (!old)
>  		return 0;
> -- 
> 2.22.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-07-16  9:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12  8:03 [PATCH 1/2] dma-buf: Expand reservation_list to fill allocation Chris Wilson
2019-07-12  8:03 ` [PATCH 2/2] dma-buf: Relax the write-seqlock for reallocating the shared fence list Chris Wilson
2019-07-16  9:21   ` Daniel Vetter [this message]
2019-07-16 20:05     ` Chris Wilson
2019-07-12  8:33 ` [PATCH 1/2] dma-buf: Expand reservation_list to fill allocation Michel Dänzer
2019-07-12  8:56 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2019-07-13 15:38 ` ✓ Fi.CI.IGT: " Patchwork
2019-07-14  7:37 ` [PATCH 1/2] " Koenig, Christian
2019-07-15 10:58   ` Chris Wilson
2019-07-15 11:11 ` Chris Wilson

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=20190716092154.GZ15868@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@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 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.