All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more
@ 2018-01-22 19:32 Christian König
  2018-01-22 19:42 ` Lyude Paul
  2018-01-22 19:47 ` Chris Wilson
  0 siblings, 2 replies; 5+ messages in thread
From: Christian König @ 2018-01-22 19:32 UTC (permalink / raw)
  To: dri-devel

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

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/dma-buf/reservation.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 461afa9febd4..649c0cebf5b1 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -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,
-- 
2.14.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more
  2018-01-22 19:32 [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more Christian König
@ 2018-01-22 19:42 ` Lyude Paul
  2018-01-22 19:48   ` Christian König
  2018-01-22 19:47 ` Chris Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Lyude Paul @ 2018-01-22 19:42 UTC (permalink / raw)
  To: Christian König, dri-devel

Could you please make sure to add Cc: stable@vger.kernel.org for this? This is
causing crashing of wayland sessions on Fedora so we should definitely get
this into stable.

Other then that:

Tested-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>

On Mon, 2018-01-22 at 20:32 +0100, Christian König wrote:
> We need to set shared_count even if we already have a fence to wait for.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/dma-buf/reservation.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 461afa9febd4..649c0cebf5b1 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -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,
-- 
Cheers,
	Lyude Paul
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more
  2018-01-22 19:32 [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more Christian König
  2018-01-22 19:42 ` Lyude Paul
@ 2018-01-22 19:47 ` Chris Wilson
  2018-01-22 20:01   ` Christian König
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2018-01-22 19:47 UTC (permalink / raw)
  To: Christian König, dri-devel

Quoting Christian König (2018-01-22 19:32:39)
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more
  2018-01-22 19:42 ` Lyude Paul
@ 2018-01-22 19:48   ` Christian König
  0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2018-01-22 19:48 UTC (permalink / raw)
  To: Lyude Paul, dri-devel, Alex Deucher

Am 22.01.2018 um 20:42 schrieb Lyude Paul:
> Could you please make sure to add Cc: stable@vger.kernel.org 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.

>   This is
> causing crashing of wayland sessions on Fedora so we should definitely get
> this into stable.
>
> Other then that:
>
> Tested-by: Lyude Paul <lyude@redhat.com>
> Reviewed-by: Lyude Paul <lyude@redhat.com>
>
> On Mon, 2018-01-22 at 20:32 +0100, Christian König wrote:
>> We need to set shared_count even if we already have a fence to wait for.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/dma-buf/reservation.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
>> index 461afa9febd4..649c0cebf5b1 100644
>> --- a/drivers/dma-buf/reservation.c
>> +++ b/drivers/dma-buf/reservation.c
>> @@ -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,

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more
  2018-01-22 19:47 ` Chris Wilson
@ 2018-01-22 20:01   ` Christian König
  0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2018-01-22 20:01 UTC (permalink / raw)
  To: Chris Wilson, dri-devel

Am 22.01.2018 um 20:47 schrieb Chris Wilson:
> Quoting Christian König (2018-01-22 19:32:39)
>> 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.

> -Chris

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-22 20:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 19:32 [PATCH] dma-buf: fix reservation_object_wait_timeout_rcu once more Christian König
2018-01-22 19:42 ` Lyude Paul
2018-01-22 19:48   ` Christian König
2018-01-22 19:47 ` Chris Wilson
2018-01-22 20:01   ` Christian König

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.