Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

reservation: add reservation_object_get_excl_rcu()

In the atomic modesetting path, each driver simply wants to grab a ref
to the exclusive fence from a reservation object to store in the incoming
drm_plane_state, without doing the whole RCU dance. Since each driver
will need to do this, lets make a helper.

v2: rename to _rcu instead of _unlocked to be more consistent

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>

Rob Clark 824815c4 feb46f02

+18
+18
include/linux/reservation.h
··· 120 120 reservation_object_held(obj)); 121 121 } 122 122 123 + static inline struct fence * 124 + reservation_object_get_excl_rcu(struct reservation_object *obj) 125 + { 126 + struct fence *fence; 127 + unsigned seq; 128 + retry: 129 + seq = read_seqcount_begin(&obj->seq); 130 + rcu_read_lock(); 131 + fence = rcu_dereference(obj->fence_excl); 132 + if (read_seqcount_retry(&obj->seq, seq)) { 133 + rcu_read_unlock(); 134 + goto retry; 135 + } 136 + fence = fence_get(fence); 137 + rcu_read_unlock(); 138 + return fence; 139 + } 140 + 123 141 int reservation_object_reserve_shared(struct reservation_object *obj); 124 142 void reservation_object_add_shared_fence(struct reservation_object *obj, 125 143 struct fence *fence);