[PATCH 03/12] dma-buf: lock the reservation object during (un)map_dma_buf v3

Hillf Danton hdanton at sina.com
Sat May 25 01:59:01 UTC 2019


On Tue, 16 Apr 2019 20:38:32 +0200 Christian K├Ânig wrote:
> @@ -688,9 +689,9 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
>  	if (attach->sgt)
>  		return attach->sgt;
>  
> -	sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
> -	if (!sg_table)
> -		sg_table = ERR_PTR(-ENOMEM);
> +	reservation_object_lock(attach->dmabuf->resv, NULL);
> +	sg_table = dma_buf_map_attachment_locked(attach, direction);
> +	reservation_object_unlock(attach->dmabuf->resv);
>  
Looks better if sg_table is checked after mapping, and feed error info
back in case there is anything unusual.

>  	return sg_table;
>  }

Best Regards
Hillf



More information about the amd-gfx mailing list