[PATCH 1/9] resv

Chris Wilson chris at chris-wilson.co.uk
Thu Oct 25 21:58:02 UTC 2018


---
 drivers/dma-buf/reservation.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 5fb4fd461908..56ceba720531 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -169,7 +169,6 @@ void reservation_object_add_shared_fence(struct reservation_object *obj,
 	}
 
 	BUG_ON(fobj->shared_count >= fobj->shared_max);
-	fobj->shared_count++;
 
 replace:
 	/*
@@ -177,6 +176,10 @@ void reservation_object_add_shared_fence(struct reservation_object *obj,
 	 * fobj->shared_count is protected by this lock too
 	 */
 	RCU_INIT_POINTER(fobj->shared[i], fence);
+	if (i == fobj->shared_count) {
+		barrier();
+		WRITE_ONCE(fobj->shared_count, i + 1);
+	}
 	write_seqcount_end(&obj->seq);
 	preempt_enable();
 }
-- 
2.19.1



More information about the Intel-gfx-trybot mailing list