RE: [RFC v2 03/11] vfio: Set device->group in helper function

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

 



> From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> Sent: Thursday, November 24, 2022 8:27 PM
> 
> This avoids referencing device->group in __vfio_register_dev()

this is not true. There is still reference to device->group when adding
the device to the group->device_list.

this remark will become true if you put it after patch04.

> +static int vfio_device_set_group(struct vfio_device *device,
> +				 enum vfio_group_type type)
>  {
> -	int ret;
> +	struct vfio_group *group;
> +
> +	if (type == VFIO_IOMMU)
> +		group = vfio_group_find_or_alloc(device->dev);
> +	else
> +		group = vfio_noiommu_group_alloc(device->dev, type);

Do we need a WARN_ON(type == VFIO_NO_IOMMU)? 

> @@ -638,6 +651,7 @@ void vfio_unregister_group_dev(struct vfio_device
> *device)
>  	/* Balances device_add in register path */
>  	device_del(&device->device);
> 
> +	/* Balances vfio_device_set_group in register path */

"vfio_device_set_group()"

>  	vfio_device_remove_group(device);
>  }
>  EXPORT_SYMBOL_GPL(vfio_unregister_group_dev);
> --
> 2.34.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux