<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">okay</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Chris Wilson <chris@chris-wilson.co.uk><br>
<b>Sent:</b> Tuesday, March 6, 2018 4:24:21 PM<br>
<b>To:</b> Liu, Monk; dri-devel@freedesktop.org<br>
<b>Cc:</b> Liu, Monk<br>
<b>Subject:</b> Re: [PATCH] dma-buf/reservation: should keep later one in add fence(v2)</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Quoting Monk Liu (2018-03-06 03:53:10)<br>
> v2:<br>
> still check context first to avoid warning from dma_fence_is_later<br>
> apply this fix in add_shared_replace as well<br>
> <br>
> Change-Id: If6a979ba9fd6c923b82212f35f07a9ff31c86767<br>
> Signed-off-by: Monk Liu <Monk.Liu@amd.com><br>
> ---<br>
>  drivers/dma-buf/reservation.c | 6 ++++--<br>
>  1 file changed, 4 insertions(+), 2 deletions(-)<br>
> <br>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c<br>
> index 314eb10..c6e3c86 100644<br>
> --- a/drivers/dma-buf/reservation.c<br>
> +++ b/drivers/dma-buf/reservation.c<br>
> @@ -118,7 +118,8 @@ reservation_object_add_shared_inplace(struct reservation_object *obj,<br>
>                 old_fence = rcu_dereference_protected(fobj->shared[i],<br>
>                                                 reservation_object_held(obj));<br>
>  <br>
> -               if (old_fence->context == fence->context) {<br>
> +               if (old_fence->context == fence->context &&<br>
> +                       dma_fence_is_later(fence, old_fence)) {<br>
<br>
This should be true by construction. Adding an older fence on the same<br>
context is a programming bug, imo. Between different callers the resv<br>
should have been locked and the fenced operations serialised, from the<br>
same caller, you shouldn't be handling more than one output fence?<br>
-Chris<br>
</div>
</span></font></div>
</body>
</html>