[PATCH] drm/i915/gvt: Keep obj->dma_buf link NULL during exporting

Zhenyu Wang zhenyuw at linux.intel.com
Tue Jan 16 02:26:24 UTC 2018


On 2018.01.15 14:41:42 +0800, Tina Zhang wrote:
> According to commit (319c933c71f3dbdb2b3274d1634d3494c70efa06)
> Author: Daniel Vetter <daniel.vetter at ffwll.ch>
> Date:   Thu Aug 15 00:02:46 2013 +0200
> 
>     drm/prime: proper locking+refcounting for obj->dma_buf link
> 
> obj->dma_buf link should be reinstated at import time.
> 
> Gvt-g dma-buf buffer exposeing might be simpler, as there won't be much
> racing during Gvt-g dma-buf exposing. In other words, Gvt-g dma-buf
> exposing can guarantee exposing happens before gem close ioctl, and Gvt-g
> is the only exporter of the guest framebuffer.
> 
> But following the drm prime scheme can give Gvt-g a chance to increase a
> dma-buf reference count during importing. Otherwise, we have to increase
> the reference during exposing, which will break the case that the only
> reference userspace has held was through the dma-buf fd and the reference
> count is one.
> 
> Signed-off-by: Tina Zhang <tina.zhang at intel.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang at intel.com>
> Cc: Hang Yuan <hang.yuan at intel.com>
> Cc: Gerd Hoffmann <kraxel at redhat.com>
> ---
>  drivers/gpu/drm/i915/gvt/dmabuf.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index 2ab584f..2fb7b34 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -472,7 +472,6 @@ int intel_vgpu_get_dmabuf(struct intel_vgpu *vgpu, unsigned int dmabuf_id)
>  		ret = PTR_ERR(dmabuf);
>  		goto out_free_gem;
>  	}
> -	obj->base.dma_buf = dmabuf;
>  
>  	i915_gem_object_put(obj);
>  
> -- 

This makes sense to me, applied for -next, thanks!

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20180116/109b32c0/attachment.sig>


More information about the intel-gvt-dev mailing list