RE: [PATCH 13/13] vfio/mdev: add mdev available instance checking to the core

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

 



> From: Christoph Hellwig
> Sent: Tuesday, June 14, 2022 12:54 PM
> 
> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> 
> Many of the mdev drivers use a simple counter for keeping track of the
> available instances. Move this code to the core code and store the counter
> in the mdev_type. Implement it using correct locking, fixing mdpy.
> 
> Drivers provide a the value in the mdev_driver at registration time and
> the core code provides a standard sysfs attribute to return the
> available_instances.
> 
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> [count instances per-parent instead of per-type]

per-parent counting works only if the parent doesn't have overlapping
instances between types. This is probably worth a clarification in doc.

> @@ -135,6 +136,7 @@ static void mdev_device_release(struct device *dev)
> 
>  	mutex_lock(&mdev_list_lock);
>  	list_del(&mdev->next);
> +	mdev->type->parent->available_instances++;

	if (!drv->get_available)
		mdev->type->parent->available_instances++;

Otherwise this looks good to me:

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux