[PATCH 8/8] dma-buf: nuke reservation_object seq number

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 7 12:19:11 UTC 2019


Quoting Christian K├Ânig (2019-08-07 13:08:38)
> Am 06.08.19 um 21:57 schrieb Chris Wilson:
> > If we add to shared-list during the read, ... Hmm, actually we should
> > return num_list, i.e.
> >
> > do {
> >       *list = rcu_dereference(obj->fence);
> >       num_list = *list ? (*list)->count : 0;
> >       smp_rmb();
> > } while (...)
> >
> > return num_list.
> >
> > as the relationship between the count and the fence entries is also
> > determined by the mb in add_shared_fence.
> 
> I've read that multiple times now, but can't follow. Why should we do this?
> 
> The only important thing is that the readers see the new fence before 
> the increment of the number of fences.

Exactly. We order the store so that the fence is in the list before we
update the count (so that we don't read garbage because the fence isn't
there yet).

But we don't have the equivalent here for the read once the rmb is
removed from the seqcount_read_begin/end looping. We need to see the
update in the same order as was stored, and only use the coherent
portion of the list.
-Chris


More information about the dri-devel mailing list