<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="auto">
<div><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">Am 02.08.2019 18:28 schrieb Jason Ekstrand <jason@jlekstrand.net>:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">
<div class="elided-text">
<div dir="ltr">On Thu, Aug 1, 2019 at 9:05 AM Koenig, Christian <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex">
Am 01.08.19 um 15:45 schrieb Lionel Landwerlin:<br>
> Just had a few exchanges with Chris about this.<br>
> Chris suggests that if we're about to add a point to the timeline in <br>
> an unordered fashion, actually better not add it at all.<br>
><br>
> What's your take on this?<br>
<br>
That is a clear NAK. See not adding a point at all means we lose some <br>
synchronization and that is not something we can do here.<br>
<br>
In other words syncing to much if userspace does something nasty is ok <br>
and defensive programmed, but not syncing at all could have unforeseen <br>
consequences.<br>
</blockquote>
<div><br>
</div>
<div>So if process A signals 7, process B detects that and signals 3 and then process A tries to insert something which waits on 7 and signals 8, what happens?  My understanding is that it "breaks" the timeline and so, from the perspective of process A, its
 signal operation on 7 is gone and it's attempt to wait on 7 will either -EINVAL because the kernel can't find the time point or else just sit there.  Am I understanding this correctly?</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Nope, what happens is that we note the largest signaled seqno and wait for everything without returning an error.</div>
<div dir="auto"><br>
</div>
<div dir="auto"><span style="font-family: sans-serif;">For example if we have signaled 7 and then 3 then any waiting for 7 we would wait for both 3 and 7.</span><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">
<div class="elided-text">
<div>  If so, it sounds more like an attack vector than defensive programming to me.</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Yeah, completely agree. That's why I also rejected the idea to return an error on wait.</div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">
<div class="elided-text">
<div><br>
</div>
<div>Yes, more syncornization is generally better than less.  However, if you're screwing up your syncronization from userspace and getting wrong rendering results, that's your fault.  If you're causing your compositor to suddenly start seeing -EINVAL which
 gets turned into VK_ERROR_DEVICE_LOST, that's a lot worse IMO.  I'm not saying that we shouldn't try to be robust in this case; I'm just concerned that the suggest solution isn't.</div>
<div></div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Completely agree as well.</div>
<div dir="auto"><br>
</div>
<div dir="auto">The key point is we need to find a balance between keeping things working and signaling that something is wrong.</div>
<div dir="auto"><br>
</div>
<div dir="auto">I mean the two options we have is to either ignore such errors and do the most defensive thing we can. And the current solution is already pretty good at that.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Or we can signal those errors but risk that it can be used for a deny of service.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards,</div>
<div dir="auto">Christian.</div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">
<div class="elided-text">
<div><br>
</div>
<div>--Jason</div>
<div><br>
</div>
<div> </div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex">
Another idea would be to add the fence, but also set an error flag and <br>
deny any further signaling on that syncobj.<br>
<br>
Regards,<br>
Christian.<br>
<br>
> I'm fine with this, but rather than add another variant of add_point() <br>
> maybe we change change the existing.<br>
><br>
> Thanks,<br>
><br>
> -Lionel<br>
><br>
> On 29/07/2019 11:20, Chunming Zhou wrote:<br>
>> It is normal that binary syncobj replaces the underlying fence.<br>
>><br>
>> Signed-off-by: Chunming Zhou <<a href="mailto:david1.zhou@amd.com">david1.zhou@amd.com</a>><br>
>> ---<br>
>>   drivers/gpu/drm/drm_syncobj.c | 3 ---<br>
>>   1 file changed, 3 deletions(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/drm_syncobj.c <br>
>> b/drivers/gpu/drm/drm_syncobj.c<br>
>> index 929f7c64f9a2..bc7ec1679e4d 100644<br>
>> --- a/drivers/gpu/drm/drm_syncobj.c<br>
>> +++ b/drivers/gpu/drm/drm_syncobj.c<br>
>> @@ -151,9 +151,6 @@ void drm_syncobj_add_point(struct drm_syncobj <br>
>> *syncobj,<br>
>>       spin_lock(&syncobj->lock);<br>
>>         prev = drm_syncobj_fence_get(syncobj);<br>
>> -    /* You are adding an unorder point to timeline, which could <br>
>> cause payload returned from query_ioctl is 0! */<br>
>> -    if (prev && prev->seqno >= point)<br>
>> -        DRM_ERROR("You are adding an unorder point to timeline!\n");<br>
>>       dma_fence_chain_init(chain, prev, fence, point);<br>
>>       rcu_assign_pointer(syncobj->fence, &chain->base);<br>
><br>
><br>
<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a></blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>