util/u_queue: read fence->signalled locked with TSAN
When TSAN is enabled we use standard mutexes instead of futexes. With futexes the fence->signalled is read using an atomic operation, to best mimic this let's protect the read with a locked mutex. This avoids TSAN reporting a race condition (false positive with futexes) with Zink when accessing the pipeline cache. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28650>
This commit is contained in:
@@ -138,6 +138,7 @@ void util_queue_fence_signal(struct util_queue_fence *fence);
|
||||
* \warning The caller must ensure that no other thread may currently be
|
||||
* waiting (or about to wait) on the fence.
|
||||
*/
|
||||
#if !THREAD_SANITIZER
|
||||
static inline void
|
||||
util_queue_fence_reset(struct util_queue_fence *fence)
|
||||
{
|
||||
@@ -150,6 +151,23 @@ util_queue_fence_is_signalled(struct util_queue_fence *fence)
|
||||
{
|
||||
return fence->signalled != 0;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
util_queue_fence_reset(struct util_queue_fence *fence)
|
||||
{
|
||||
assert(fence->signalled);
|
||||
fence->signalled = 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
util_queue_fence_is_signalled(struct util_queue_fence *fence)
|
||||
{
|
||||
mtx_lock(&fence->mutex);
|
||||
bool signalled = fence->signalled != 0;
|
||||
mtx_unlock(&fence->mutex);
|
||||
return signalled;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@@ -1,2 +1 @@
|
||||
# Placeholder file, will be filled with surpressions for TSAN
|
||||
|
||||
# Placeholder file, will be filled with surpressions for TSAN
|
||||
|
Reference in New Issue
Block a user