public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: daniel@ffwll.ch, sumit.semwal@linaro.org, gustavo@padovan.org,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH 1/3] dma-buf: make returning the exclusive fence optional
Date: Wed, 17 Jan 2018 09:02:34 +0100	[thread overview]
Message-ID: <20180117080234.GA2759@phenom.ffwll.local> (raw)
In-Reply-To: <996ce95c-b04f-d32e-f32e-4226c60b4bf3@gmail.com>

On Tue, Jan 16, 2018 at 11:14:26AM +0100, Christian König wrote:
> Ping? Daniel you requested the patch with its user.

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

but might be good to get a review from one of the usual reservation stuff
folks.
-Daniel

> 
> Would be nice when I can commit this cause we need it for debugging and
> cleaning up a bunch of other things as well.
> 
> Regards,
> Christian.
> 
> Am 12.01.2018 um 10:47 schrieb Christian König:
> > Change reservation_object_get_fences_rcu to make the exclusive fence
> > pointer optional.
> > 
> > If not specified the exclusive fence is put into the fence array as
> > well.
> > 
> > This is helpful for a couple of cases where we need all fences in a
> > single array.
> > 
> > Signed-off-by: Christian König <christian.koenig@amd.com>
> > ---
> >   drivers/dma-buf/reservation.c | 31 ++++++++++++++++++++++---------
> >   1 file changed, 22 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> > index b759a569b7b8..461afa9febd4 100644
> > --- a/drivers/dma-buf/reservation.c
> > +++ b/drivers/dma-buf/reservation.c
> > @@ -374,8 +374,9 @@ EXPORT_SYMBOL(reservation_object_copy_fences);
> >    * @pshared: the array of shared fence ptrs returned (array is krealloc'd to
> >    * the required size, and must be freed by caller)
> >    *
> > - * RETURNS
> > - * Zero or -errno
> > + * Retrieve all fences from the reservation object. If the pointer for the
> > + * exclusive fence is not specified the fence is put into the array of the
> > + * shared fences as well. Returns either zero or -ENOMEM.
> >    */
> >   int reservation_object_get_fences_rcu(struct reservation_object *obj,
> >   				      struct dma_fence **pfence_excl,
> > @@ -389,8 +390,8 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
> >   	do {
> >   		struct reservation_object_list *fobj;
> > -		unsigned seq;
> > -		unsigned int i;
> > +		unsigned int i, seq;
> > +		size_t sz = 0;
> >   		shared_count = i = 0;
> > @@ -402,9 +403,14 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
> >   			goto unlock;
> >   		fobj = rcu_dereference(obj->fence);
> > -		if (fobj) {
> > +		if (fobj)
> > +			sz += sizeof(*shared) * fobj->shared_max;
> > +
> > +		if (!pfence_excl && fence_excl)
> > +			sz += sizeof(*shared);
> > +
> > +		if (sz) {
> >   			struct dma_fence **nshared;
> > -			size_t sz = sizeof(*shared) * fobj->shared_max;
> >   			nshared = krealloc(shared, sz,
> >   					   GFP_NOWAIT | __GFP_NOWARN);
> > @@ -420,13 +426,19 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
> >   				break;
> >   			}
> >   			shared = nshared;
> > -			shared_count = fobj->shared_count;
> > -
> > +			shared_count = fobj ? fobj->shared_count : 0;
> >   			for (i = 0; i < shared_count; ++i) {
> >   				shared[i] = rcu_dereference(fobj->shared[i]);
> >   				if (!dma_fence_get_rcu(shared[i]))
> >   					break;
> >   			}
> > +
> > +			if (!pfence_excl && fence_excl) {
> > +				shared[i] = fence_excl;
> > +				fence_excl = NULL;
> > +				++i;
> > +				++shared_count;
> > +			}
> >   		}
> >   		if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) {
> > @@ -448,7 +460,8 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
> >   	*pshared_count = shared_count;
> >   	*pshared = shared;
> > -	*pfence_excl = fence_excl;
> > +	if (pfence_excl)
> > +		*pfence_excl = fence_excl;
> >   	return ret;
> >   }
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

      reply	other threads:[~2018-01-17  8:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  9:47 [PATCH 1/3] dma-buf: make returning the exclusive fence optional Christian König
2018-01-12  9:47 ` [PATCH 2/3] drm/amdgpu: add amdgpu_pasid_free_delayed v2 Christian König
2018-01-12  9:47 ` [PATCH 3/3] drm/amdgpu: always allocate a PASIDs for each VM v2 Christian König
2018-01-16 10:14 ` [PATCH 1/3] dma-buf: make returning the exclusive fence optional Christian König
2018-01-17  8:02   ` Daniel Vetter [this message]

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=20180117080234.GA2759@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.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