diff mbox

dma-buf/reservation: should keep the new fence in add_shared_inplace

Message ID 1520305750-29001-1-git-send-email-Monk.Liu@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu, Monk March 6, 2018, 3:09 a.m. UTC
Change-Id: If6a979ba9fd6c923b82212f35f07a9ff31c86767
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/dma-buf/reservation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chunming Zhou March 6, 2018, 3:38 a.m. UTC | #1
On 2018年03月06日 11:09, Monk Liu wrote:
> Change-Id: If6a979ba9fd6c923b82212f35f07a9ff31c86767
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
>   drivers/dma-buf/reservation.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 314eb10..29b7e45 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -118,7 +118,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj,
>   		old_fence = rcu_dereference_protected(fobj->shared[i],
>   						reservation_object_held(obj));
>   
> -		if (old_fence->context == fence->context) {
> +		if (dma_fence_is_later(fence, old_fence)) {
OK, good catch, to avoid warning of different context, which should be 
"if ((old_fence->context == fence->context) && dma_fence_is_later(fence, 
old_fence)) { "
and reservation_object_add_shared_replace need this fix as well.

Regards,
David Zhou
>   			/* memory barrier is added by write_seqcount_begin */
>   			RCU_INIT_POINTER(fobj->shared[i], fence);
>   			write_seqcount_end(&obj->seq);
Liu, Monk March 6, 2018, 3:51 a.m. UTC | #2
Yeah, right 

-----Original Message-----
From: Zhou, David(ChunMing) 

Sent: 2018年3月6日 11:38
To: Liu, Monk <Monk.Liu@amd.com>; dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] dma-buf/reservation: should keep the new fence in add_shared_inplace



On 2018年03月06日 11:09, Monk Liu wrote:
> Change-Id: If6a979ba9fd6c923b82212f35f07a9ff31c86767

> Signed-off-by: Monk Liu <Monk.Liu@amd.com>

> ---

>   drivers/dma-buf/reservation.c | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/drivers/dma-buf/reservation.c 

> b/drivers/dma-buf/reservation.c index 314eb10..29b7e45 100644

> --- a/drivers/dma-buf/reservation.c

> +++ b/drivers/dma-buf/reservation.c

> @@ -118,7 +118,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj,

>   		old_fence = rcu_dereference_protected(fobj->shared[i],

>   						reservation_object_held(obj));

>   

> -		if (old_fence->context == fence->context) {

> +		if (dma_fence_is_later(fence, old_fence)) {

OK, good catch, to avoid warning of different context, which should be "if ((old_fence->context == fence->context) && dma_fence_is_later(fence,
old_fence)) { "
and reservation_object_add_shared_replace need this fix as well.

Regards,
David Zhou
>   			/* memory barrier is added by write_seqcount_begin */

>   			RCU_INIT_POINTER(fobj->shared[i], fence);

>   			write_seqcount_end(&obj->seq);
Christian König March 6, 2018, 8:03 a.m. UTC | #3
NAK, the newly added fence must always be newer than the existing one.

Christian.

Am 06.03.2018 um 04:09 schrieb Monk Liu:
> Change-Id: If6a979ba9fd6c923b82212f35f07a9ff31c86767
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
>   drivers/dma-buf/reservation.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 314eb10..29b7e45 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -118,7 +118,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj,
>   		old_fence = rcu_dereference_protected(fobj->shared[i],
>   						reservation_object_held(obj));
>   
> -		if (old_fence->context == fence->context) {
> +		if (dma_fence_is_later(fence, old_fence)) {
>   			/* memory barrier is added by write_seqcount_begin */
>   			RCU_INIT_POINTER(fobj->shared[i], fence);
>   			write_seqcount_end(&obj->seq);
Liu, Monk March 6, 2018, 8:47 a.m. UTC | #4
why? is there a design doc mentioned for this on reservation ?
diff mbox

Patch

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 314eb10..29b7e45 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -118,7 +118,7 @@  reservation_object_add_shared_inplace(struct reservation_object *obj,
 		old_fence = rcu_dereference_protected(fobj->shared[i],
 						reservation_object_held(obj));
 
-		if (old_fence->context == fence->context) {
+		if (dma_fence_is_later(fence, old_fence)) {
 			/* memory barrier is added by write_seqcount_begin */
 			RCU_INIT_POINTER(fobj->shared[i], fence);
 			write_seqcount_end(&obj->seq);