[PATCH v2 2/3] drm/i915/gvt: use atomic operations to change the vGPU status

Tian, Kevin kevin.tian at intel.com
Thu Nov 10 08:41:34 UTC 2022


> From: Zhi Wang
> Sent: Thursday, November 10, 2022 3:00 PM
> 
> Several vGPU status are used to decide the availability of GVT-g core logics
> when creating a vGPU. Use atomic operations on chaning the vGPU status to

chaning -> changing

> @@ -162,7 +162,6 @@ void intel_gvt_debugfs_add_vgpu(struct intel_vgpu
> *vgpu)
>  	snprintf(name, 16, "vgpu%d", vgpu->id);
>  	vgpu->debugfs = debugfs_create_dir(name, vgpu->gvt-
> >debugfs_root);
> 
> -	debugfs_create_bool("active", 0444, vgpu->debugfs, &vgpu->active);

this is incorrect implying userspace might be broken when doing bisect.

just merge with next patch.

> @@ -655,7 +655,7 @@ static int intel_vgpu_open_device(struct vfio_device
> *vfio_dev)
>  {
>  	struct intel_vgpu *vgpu = vfio_dev_to_vgpu(vfio_dev);
> 
> -	if (vgpu->attached)
> +	if (test_bit(INTEL_VGPU_STATUS_ATTACHED, vgpu->status))
>  		return -EEXIST;

this check is unnecessary. It's guaranteed by vfio core.

> @@ -702,11 +702,12 @@ static void intel_vgpu_close_device(struct
> vfio_device *vfio_dev)
>  {
>  	struct intel_vgpu *vgpu = vfio_dev_to_vgpu(vfio_dev);
> 
> -	if (!vgpu->attached)
> -		return;
> +	WARN_ON_ONCE(!test_bit(INTEL_VGPU_STATUS_ATTACHED, vgpu-
> >status));

no need.



More information about the intel-gvt-dev mailing list