All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: dri-devel@lists.freedesktop.org
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 2/2] dma-buf: Relax the write-seqlock for reallocating the shared fence list
Date: Fri, 12 Jul 2019 09:03:14 +0100	[thread overview]
Message-ID: <20190712080314.21018-2-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20190712080314.21018-1-chris@chris-wilson.co.uk>

As the set of shared fences is not being changed during reallocation of
the reservation list, we can skip updating the write_seqlock.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Christian König <christian.koenig@amd.com>
---
 drivers/dma-buf/reservation.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 80ecc1283d15..c71b85c8c159 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -157,15 +157,15 @@ 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; both existing
+	 * readers and new readers will see exactly the same set of
+	 * active (unsignaled) shared fences. 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-07-12  8:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12  8:03 [PATCH 1/2] dma-buf: Expand reservation_list to fill allocation Chris Wilson
2019-07-12  8:03 ` Chris Wilson [this message]
2019-07-16  9:21   ` [PATCH 2/2] dma-buf: Relax the write-seqlock for reallocating the shared fence list Daniel Vetter
2019-07-16 20:05     ` Chris Wilson
2019-07-12  8:33 ` [PATCH 1/2] dma-buf: Expand reservation_list to fill allocation Michel Dänzer
2019-07-12  8:56 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2019-07-13 15:38 ` ✓ Fi.CI.IGT: " Patchwork
2019-07-14  7:37 ` [PATCH 1/2] " Koenig, Christian
2019-07-15 10:58   ` Chris Wilson
2019-07-15 11:11 ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190712080314.21018-2-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.