[Mesa-dev] [PATCH 1/2] gallium/u_queue: guard fence->signalled checks with fence->mutex

Edward O'Callaghan funfunctor at folklore1984.net
Sun Jul 10 04:44:27 UTC 2016


This series is,

Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 07/10/2016 03:44 AM, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> I have seen a hang during application shutdown that could be explained by the
> following race condition which this patch fixes:
> 
> 1. Worker thread enters util_queue_fence_signal, sets fence->signalled = true.
> 2. Main thread calls util_queue_job_wait, which returns immediately.
> 3. Main thread deletes the job and fence structures, leaving garbage behind.
> 4. Worker thread calls pipe_condvar_broadcast, which gets stuck forever because
>    it is accessing garbage.
> ---
>  src/gallium/auxiliary/util/u_queue.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c
> index 627c08a..2429336 100644
> --- a/src/gallium/auxiliary/util/u_queue.c
> +++ b/src/gallium/auxiliary/util/u_queue.c
> @@ -41,9 +41,6 @@ util_queue_fence_signal(struct util_queue_fence *fence)
>  void
>  util_queue_job_wait(struct util_queue_fence *fence)
>  {
> -   if (fence->signalled)
> -      return;
> -
>     pipe_mutex_lock(fence->mutex);
>     while (!fence->signalled)
>        pipe_condvar_wait(fence->cond, fence->mutex);
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160710/f83a09e8/attachment.sig>


More information about the mesa-dev mailing list