Re: [PATCH v3 12/17] iommufd: Add iommufd_device_replace()

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

 



On Fri, Mar 24, 2023 at 01:42:58AM +0000, Tian, Kevin wrote:

> > > > +	/* Move the refcounts held by the device_list to the new hwpt */
> > > > +	refcount_add(num_devices, &hwpt->obj.users);
> > > > +	if (num_devices > 1)
> > > > +		WARN_ON(refcount_sub_and_test(num_devices - 1,
> > > > +					      &old_hwpt->obj.users));
> > >
> > > A comment is welcomed to match "caller must destroy old_hwpt".
> > 
> > ??
> > 
> 
> It's not intuitive when moving the refcnt why we subtract num_devices
> from the old_hwpt only when it's greater than 1. It's really about
> the destroy must be done by the caller.


	/*
	 * Move the refcounts held by the device_list to the new hwpt. Retain a
	 * refcount for this thread as the caller will free it.
	 */


Jason



[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