<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Concurrent call to glClientWaitSync results in segfault in one of the waiters."
href="https://bugs.freedesktop.org/show_bug.cgi?id=98172#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Concurrent call to glClientWaitSync results in segfault in one of the waiters."
href="https://bugs.freedesktop.org/show_bug.cgi?id=98172">bug 98172</a>
from <span class="vcard"><a class="email" href="mailto:shinji.suzuki@gmail.com" title="shinji.suzuki@gmail.com">shinji.suzuki@gmail.com</a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=127267" name="attach_127267" title="Lock the shared state mutex and work with a local reference of so->fence">attachment 127267</a> <a href="attachment.cgi?id=127267&action=edit" title="Lock the shared state mutex and work with a local reference of so->fence">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=98172&attachment=127267'>[review]</a>
Lock the shared state mutex and work with a local reference of so->fence
Review of <span class=""><a href="attachment.cgi?id=127267" name="attach_127267" title="Lock the shared state mutex and work with a local reference of so->fence">attachment 127267</a> <a href="attachment.cgi?id=127267&action=edit" title="Lock the shared state mutex and work with a local reference of so->fence">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=98172&attachment=127267'>[review]</a>:
-----------------------------------------------------------------
I'm afraid execution of st_fence_sync() can still race.
Thread-A can run upto
success = screen->fence_finish(screen, pipe, fence, 0);
and then get prempted and Thread-B can run upto the same location.
And then
screen->fence_reference(screen, &so->fence, NULL);
can still be executed in arbitrary order. If screen->fence_refrence()
is thread-safe and return true only for the first invocation then all is fine
but likely it is not true as otherwise we will not be struggling with this
issue.
I think the gist of it is that checking of so->fence and nullifying of it
should be executed atomically. If "if (success)" is replaced with "if (success
&& so->fence)" then the program may behave correctly but I'm not confortable
about sreen->fence_ference() being called concurrently.
I'm also concerned that mutual exclusion on ctx->Shared->Mutex may introduce
unnecessarily strict serialization.
Can't we introduce per sync-object mutex so that excution of checking of
so->fence and nullyfying of it happen atomically?
Is that modification too intrusive? (At least it is unnecessary overhead when
st_fence_sync() is not executed concurrently on the same sync object.)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>