Skip to contentSkip to conversation

dma-buf: fix reservation_object_wait_timeout_rcu once more

PATCH In review Christian König 3 participants 5 messages Jan 22, 2018 DMA buffer sharing framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-buf: fix reservation_object_wait_timeout_rcu once more

We need to set shared_count even if we already have a fence to wait for.

---
 drivers/dma-buf/reservation.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma-buf/reservation.c +2 -2
index 461afa9febd4..649c0cebf5b1 100644
@@ -506,14 +506,14 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
 		fence = NULL;
 	}
 
-	if (!fence && wait_all) {
+	if (wait_all) {
 		struct reservation_object_list *fobj =
 						rcu_dereference(obj->fence);
 
 		if (fobj)
 			shared_count = fobj->shared_count;
 
-		for (i = 0; i < shared_count; ++i) {
+		for (i = 0; !fence && i < shared_count; ++i) {
 			struct dma_fence *lfence = rcu_dereference(fobj->shared[i]);
 
 			if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Tested-by Reviewed-by on v1 1/1
#1 lore raw

Could you please make sure to add Cc: [email protected] for this? This is causing crashing of wayland sessions on Fedora so we should definitely get this into stable.

Other then that:

Quoted 31 lines · Christian König

We need to set shared_count even if we already have a fence to wait for.

---
 drivers/dma-buf/reservation.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma-buf/reservation.c +2 -2
index 461afa9febd4..649c0cebf5b1 100644
@@ -506,14 +506,14 @@ long reservation_object_wait_timeout_rcu(struct
 reservation_object *obj,
 		fence = NULL;
 	}
 
-	if (!fence && wait_all) {
+	if (wait_all) {
 		struct reservation_object_list *fobj =
 						rcu_dereference(obj-
 >fence);
 
 		if (fobj)
 			shared_count = fobj->shared_count;
 
-		for (i = 0; i < shared_count; ++i) {
+		for (i = 0; !fence && i < shared_count; ++i) {
 			struct dma_fence *lfence = rcu_dereference(fobj-
Quoted 1 line

shared[i]);

if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,

Signature · 6 lines
Cheers,
	Lyude Paul
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Am 22.01.2018 um 20:42 schrieb Lyude Paul:

Quoted 1 line

Could you please make sure to add Cc: [email protected] for this?

Sure, just pushed into our upstream branch.

Alex can you pick that up for your next drm-fixes pull request?

Sorry for the noise,
Christian.

Quoted 4 lines

This is
causing crashing of wayland sessions on Fedora so we should definitely get this into stable.

Quoted 37 lines

Other then that:

Quoted 31 lines · Christian König

We need to set shared_count even if we already have a fence to wait for.

---
  drivers/dma-buf/reservation.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma-buf/reservation.c +2 -2
index 461afa9febd4..649c0cebf5b1 100644
@@ -506,14 +506,14 @@ long reservation_object_wait_timeout_rcu(struct
 reservation_object *obj,
  		fence = NULL;
  	}
 
-	if (!fence && wait_all) {
+	if (wait_all) {
  		struct reservation_object_list *fobj =
  						rcu_dereference(obj-
 > fence);
 
  		if (fobj)
  			shared_count = fobj->shared_count;
 
-		for (i = 0; i < shared_count; ++i) {
+		for (i = 0; !fence && i < shared_count; ++i) {
  			struct dma_fence *lfence = rcu_dereference(fobj-
Quoted 1 line

shared[i]);

if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
In reply to Christian König

Quoting Christian König (2018-01-22 19:32:39)

Quoted 1 line

We need to set shared_count even if we already have a fence to wait for.

You mean for the

if (ret > 0 && wait_all && (i + 1 < shared_count)

clause.

In the case of having the exclusive fence, i=0 (erm, once), but shared_count may still be just 1 and so we still fail to wait for the shared fence in addition to the exclusive fence.
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Am 22.01.2018 um 20:47 schrieb Chris Wilson:

Quoted 11 lines

Quoting Christian König (2018-01-22 19:32:39)

Quoted 1 line

We need to set shared_count even if we already have a fence to wait for.

You mean for the

if (ret > 0 && wait_all && (i + 1 < shared_count)

clause.

In the case of having the exclusive fence, i=0 (erm, once), but shared_count may still be just 1 and so we still fail to wait for the shared fence in addition to the exclusive fence.

Ah, crap. Good point. V2 is on the list, please take a look.

Thanks,
Christian.

Quoted 1 line

-Chris

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel