<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Am 15.02.19 um 19:16 schrieb Jason Ekstrand:<br>
</div>
<blockquote type="cite" cite="mid:CAOFGe9611MqmsvdvZS4_vuJjrrUAmjK5-41Z6tpaxTHJsB8CwA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Feb 15, 2019 at 11:51 AM Christian König <<a href="mailto:ckoenig.leichtzumerken@gmail.com" moz-do-not-send="true">ckoenig.leichtzumerken@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<div class="gmail-m_5249618168223624859moz-cite-prefix">Am 15.02.19 um 17:49 schrieb Jason Ekstrand:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Feb 15, 2019 at 9:52 AM Lionel Landwerlin via dri-devel <<a href="mailto:dri-devel@lists.freedesktop.org" target="_blank" moz-do-not-send="true">dri-devel@lists.freedesktop.org</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px
                      0px 0px 0.8ex;border-left:1px solid
                      rgb(204,204,204);padding-left:1ex">
On 15/02/2019 14:32, Koenig, Christian wrote:<br>
> Am 15.02.19 um 15:23 schrieb Lionel Landwerlin:<br>
>> Hi Christian, David,<br>
>><br>
>> For timeline semaphore we need points to signaled in order.<br>
>> I'm struggling to understand how this fence-chain implementation<br>
>> preserves ordering of the seqnos.<br>
>><br>
>> One of the scenario I can see an issue happening is when you have a<br>
>> timeline with points 1 & 2 and userspace submits for 2 different<br>
>> engines :<br>
>>      - first with let's say a blitter style engine on point 2<br>
>>      - then a 3d style engine on point 1<br>
> Yeah, and where exactly is the problem?<br>
><br>
> Seqno 1 will signal when the 3d style engine finishes work.<br>
><br>
> And seqno 2 will signal when both seqno 1 is signaled and the blitter<br>
> style engine has finished its work.<br>
</blockquote>
<div><br>
</div>
<div>That's an interesting interpretation of the spec.  I think it's legal and I could see that behavior may be desirable in some ways.<br>
</div>
</div>
</div>
</blockquote>
<br>
Well we actually had this discussion multiple times now, both internally as well as on the mailing list. Please also see the previous mails with Daniel on this topic.<br>
</div>
</blockquote>
<div><br>
</div>
<div>I dug through dri-devel and read everything I could find with a search for "timeline semaphore"  I didn't find all that much but this did come up once.<br>
</div>
</div>
</div>
</blockquote>
<br>
Need to dig through my mails as well, that was back in November/December last year.<br>
<br>
<blockquote type="cite" cite="mid:CAOFGe9611MqmsvdvZS4_vuJjrrUAmjK5-41Z6tpaxTHJsB8CwA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">My initial suggestion was actually to exactly what Leonid suggested as well.<br>
<br>
And following this I used a rather simple container for the implementation, e.g. just a ring buffer indexed by the sequence number. In this scenario userspace can specify on syncobj creation time how big the window for sequence numbers should be, e.g. in this
 implementation how big the ring buffer would be.<br>
<br>
This was rejected by our guys who actually wrote a good part of the Vulkan specification. Daniel then has gone into the same direction during the public discussion.<br>
</div>
</blockquote>
<div><br>
</div>
<div>I agree with whoever said that specifying a ringbuffer size is unacceptable.  I'm not really sure how that's relevant though.  Is a ringbuffer required to implement the behavior that is being suggested here?  Genuine question; I'm trying to get back up
 to speed.<br>
</div>
</div>
</div>
</blockquote>
<br>
Using a ring buffer was just an example how we could do it if we follow my and Lionel's suggestion.<br>
<br>
Key point is that we could simplify the implementation massively if sequence numbers don't need to depend on each other.<br>
<br>
In other words we just see the syncobj as container where fences are added and retrieved from instead of something actively involved in the signaling.
<br>
<br>
Main reason we didn't do it this way is because the AMD Vulkan team has rejected this approach.<br>
<br>
Additional to that chaining sequence numbers together is really the more defensive approach, e.g. it is less likely that applications can shoot themselves in the foot.<br>
<br>
<blockquote type="cite" cite="mid:CAOFGe9611MqmsvdvZS4_vuJjrrUAmjK5-41Z6tpaxTHJsB8CwA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div> 4. If you do get into a sticky situation, you can unblock an entire timeline by using the CPU signal ioctl to set it to a high value.
<br>
</div>
</div>
</div>
</blockquote>
<br>
Well I think that this could be problematic as well. Keep in mind that main use case for this is sharing timelines between processes.<br>
<br>
In other words you don't want applications to be able to mess with it to much.<br>
</div>
</blockquote>
<div><br>
</div>
<div>Cross-process is exactly why you want it.  Suppose you're a compositor and you have a timeline shared with another application and you've submitted work which waits on it.  Then you get a notification somehow (SIGHUP?) that the client has died leaving
 you hanging.  What do you do?  You take the semaphore that's shared with you and the client and whack it to UINT64_MAX to unblock yourself.  Of course, this can be abused and that's always the risk you take with timelines.<br>
</div>
</div>
</div>
</blockquote>
<br>
My last status is that basically everybody agrees now that wait before signal in the kernel is forbidden.<br>
<br>
So when you get a SIGHUB because your client is dead you just kill your thread waiting on it.<br>
<br>
Regards,<br>
Christian.<br>
</body>
</html>