Re: [PATCH 07/10] dma-buf/resv: add new fences container implementation

Daniel Vetter
2019-08-22T13:02:58Z

On Thu, Aug 22, 2019 at 10:23:29AM +0200, Christian König wrote:
> Am 21.08.19 um 18:04 schrieb Daniel Vetter:
> > On Wed, Aug 21, 2019 at 02:31:44PM +0200, Christian König wrote:
> > > [SNIP]
> > > + /* Try to drop the last reference */
> > > + if (!dma_fence_array_recycle(staged))
> > Without an rcu barrier here you're not syncing to new clients at all.
> > I don't think this works, and I expect that once you've readded all the
> > barriers and retry loops we're back to seqlocks.
>
> The key difference is that RCU users now use dma_fence_get_rcu_safe() to
> grab a reference to the current set of fences.
>
> In other words the whole array is reference counted and RCU protected
> instead of each individual entry in the array.
>
> This way you don't need the sequence count any more because you grab a
> reference to all of them at once and then can be sure that they don't
> change.

Hm yeah ... I think there's still some users left that have an open-coded
rcu section though. But yeah if you can concince Chris that this is ok I
think it makes sense as an overall cleanup of the hand-rolled fences array
we have for shared fences. But I'd really like to untangle it from the
entire semantics discussion, since that seems entirely unrelated.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation