Quoting Christian König (2019-08-06 16:01:33) > Add a new helper to get a consistent set of pointers from the reservation > object. While at it group all access helpers together in the header file. Ah, needs to be earlier :) > +/** > + * reservation_object_fences - read consistent fence pointers > + * @obj: reservation object where we get the fences from > + * @excl: pointer for the exclusive fence > + * @list: pointer for the shared fence list > + * > + * Make sure we have a consisten exclusive fence and shared fence list. > + * Must be called with rcu read side lock held. > + */ > +static inline void > +reservation_object_fences(struct reservation_object *obj, > + struct dma_fence **excl, > + struct reservation_object_list **list) > +{ > + unsigned int seq; > + > + do { > + seq = read_seqcount_begin(&obj->seq); > + *excl = rcu_dereference(obj->fence_excl); > + *list = rcu_dereference(obj->fence); > + } while (read_seqcount_retry(&obj->seq, seq)); > +} I would personally prefer return excl rather than have it as a second outparam, but I'd leave that to gcc to decide. Having stared at this, I agree this does the right thing. The important point from all callers' perspective is that the combination of pointers is consistent for this rcu_read_lock. And rcu_dereference enforces the callers do hold rcu_read_lock. I didn't check all the conversions, just stared at the heart of the problem. Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> -Chris _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel