[PATCH] drm/i915/gvt: initialize dmabuf mutex in vgpu_create

Zhang, Tina tina.zhang at intel.com
Wed Aug 1 03:45:12 UTC 2018


Thanks Henry for this good catch!
Can you also give the help to add the dmabuf_lock mutex destruction in vgpu_destroy()?
Thanks.

BR,
Tina

> -----Original Message-----
> From: intel-gvt-dev [mailto:intel-gvt-dev-bounces at lists.freedesktop.org]
> Sent: Monday, July 30, 2018 10:53 AM
> To: intel-gvt-dev at lists.freedesktop.org
> Cc: Hang Yuan <hang.yuan at linux.intel.com>
> Subject: [PATCH] drm/i915/gvt: initialize dmabuf mutex in vgpu_create
> 
> From: Hang Yuan <hang.yuan at linux.intel.com>
> 
> Currently, the mutex used in GVT dmabuf support is not initialized until vgpu
> device is opened. If one vgpu device is opened and then removed, the mutex will
> be used in vgpu remove operation without initialization. This patch initializes the
> mutex in vgpu create operation to avoid the problem.
> 
> Fixes: e546e281d33d("drm/i915/gvt: Dmabuf support for GVT-g")
> Signed-off-by: Hang Yuan <hang.yuan at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/kvmgt.c | 1 -
>  drivers/gpu/drm/i915/gvt/vgpu.c  | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c
> b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index a22d539..cbdf915e 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1615,7 +1615,6 @@ static int kvmgt_guest_init(struct mdev_device
> *mdev)
>  	kvmgt_protect_table_init(info);
>  	gvt_cache_init(vgpu);
> 
> -	mutex_init(&vgpu->dmabuf_lock);
>  	init_completion(&vgpu->vblank_done);
> 
>  	info->track_node.track_write = kvmgt_page_track_write; diff --git
> a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c index
> f6fa916..0bc1f1e 100644
> --- a/drivers/gpu/drm/i915/gvt/vgpu.c
> +++ b/drivers/gpu/drm/i915/gvt/vgpu.c
> @@ -361,6 +361,7 @@ static struct intel_vgpu
> *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
>  	vgpu->gvt = gvt;
>  	vgpu->sched_ctl.weight = param->weight;
>  	mutex_init(&vgpu->vgpu_lock);
> +	mutex_init(&vgpu->dmabuf_lock);
>  	INIT_LIST_HEAD(&vgpu->dmabuf_obj_list_head);
>  	INIT_RADIX_TREE(&vgpu->page_track_tree, GFP_KERNEL);
>  	idr_init(&vgpu->object_idr);
> --
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev


More information about the intel-gvt-dev mailing list