Quoting Chunming Zhou (2018-10-23 02:50:08)
> v2:
> add a mutex between sync_cb execution and free.
> v3:
> clearly separating the roles for pt_lock and cb_mutex (Chris)
> v4:
> the cb_mutex should be taken outside of the pt_lock around this if() block. 
> (Chris)
> 
> Tested by syncobj_basic and syncobj_wait of igt.
> 
> Signed-off-by: Chunming Zhou <david1.z...@amd.com>
> Cc: Daniel Vetter <dan...@ffwll.ch>
> Cc: Chris Wilson <ch...@chris-wilson.co.uk>
> Cc: Christian König <christian.koe...@amd.com>
> ---
>  drivers/gpu/drm/drm_syncobj.c | 51 ++++++++++++++++++-----------------
>  include/drm/drm_syncobj.h     |  8 ++++--
>  2 files changed, 33 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 57bf6006394d..315f08132f6d 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -125,23 +125,24 @@ static int drm_syncobj_fence_get_or_add_callback(struct 
> drm_syncobj *syncobj,
>         if (!ret)
>                 return 1;
>  
> -       spin_lock(&syncobj->lock);
> +       mutex_lock(&syncobj->cb_mutex);
>         /* We've already tried once to get a fence and failed.  Now that we
>          * have the lock, try one more time just to be sure we don't add a
>          * callback when a fence has already been set.
>          */
> +       spin_lock(&syncobj->pt_lock);
>         if (!list_empty(&syncobj->signal_pt_list)) {
> -               spin_unlock(&syncobj->lock);
> +               spin_unlock(&syncobj->pt_lock);
>                 drm_syncobj_search_fence(syncobj, 0, 0, fence);
>                 if (*fence)

mutex_unlock(&syncobj->cb_mutex);

With that,
Reviewed-by: Chris Wilson <ch...@chris-wilson.co.uk>

Can you please resend with Cc: intel-...@lists.freedesktop.org so we can
double check the fix.
-Chris
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to