[PATCH 2/2] dma-buf: Relax the write-seqlock for reallocating the shared fence list

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 11 21:19:28 UTC 2019


Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/dma-buf/reservation.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 80ecc1283d15..23a644e24608 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -157,15 +157,13 @@ int reservation_object_reserve_shared(struct reservation_object *obj,
 		(ksize(new) - offsetof(typeof(*new), shared)) /
 		sizeof(*new->shared);
 
-	preempt_disable();
-	write_seqcount_begin(&obj->seq);
 	/*
-	 * RCU_INIT_POINTER can be used here,
-	 * seqcount provides the necessary barriers
+	 * We are not changing the effective set of fences here so can
+	 * merely update the pointer to the new array. Individual fences
+	 * and the old array are protected by RCU and so will not vanish
+	 * under the gaze of the rcu_read_lock() readers.
 	 */
-	RCU_INIT_POINTER(obj->fence, new);
-	write_seqcount_end(&obj->seq);
-	preempt_enable();
+	rcu_assign_pointer(obj->fence, new);
 
 	if (!old)
 		return 0;
-- 
2.22.0



More information about the Intel-gfx-trybot mailing list