Re: [PATCH] drm/syncobj: Avoid kmalloc(GFP_KERNEL) under spinlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 26-10-18 om 08:20 schreef Chunming Zhou:
> drivers/gpu/drm/drm_syncobj.c:202:4-14: ERROR: function drm_syncobj_find_signal_pt_for_point called on line 390 inside lock on line 389 but uses GFP_KERNEL
>
>   Find functions that refer to GFP_KERNEL but are called with locks held.
>
> Generated by: scripts/coccinelle/locks/call_kern.cocci
>
> v2:
> syncobj->timeline still needs protect.
>
> v3:
> use a global signaled fence instead of re-allocation.
>
> v4:
> Don't need moving lock.
> Don't expose func.
>
> v5:
> rename func and directly return.
>
> Tested by: syncobj_wait and ./deqp-vk -n dEQP-VK.*semaphore* with
> lock debug kernel options enabled.
>
> Signed-off-by: Chunming Zhou <david1.zhou@xxxxxxx>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Christian König <easy2remember.chk@xxxxxxxxxxxxxx>
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> CC: Julia Lawall <julia.lawall@xxxxxxx>
> Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_syncobj.c | 36 ++++++++++++++++++-----------------
>  1 file changed, 19 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index b7eaa603f368..d1c6f21c72b5 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -80,6 +80,23 @@ struct drm_syncobj_signal_pt {
>  	struct list_head list;
>  };
>  
> +static DEFINE_SPINLOCK(signaled_fence_lock);
> +static struct dma_fence signaled_fence;
> +
> +static struct dma_fence *drm_syncobj_get_stub_fence(void)
> +{
> +	spin_lock(&signaled_fence_lock);
> +	if (!signaled_fence.ops) {
> +		dma_fence_init(&signaled_fence,
> +			       &drm_syncobj_stub_fence_ops,
> +			       &signaled_fence_lock,
> +			       0, 0);
> +		dma_fence_signal_locked(&signaled_fence);
> +	}
> +	spin_unlock(&signaled_fence_lock);
Could this be used by drm_syncobj_assign_null_handle too? Maybe as a separate patch?

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>

~Maarten
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux