> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Wednesday, March 17, 2021 7:08 AM > > On Tue, Mar 16, 2021 at 07:33:55AM +0000, Tian, Kevin wrote: > > > > It is tricky to see, but the get at the start of vfio_del_group_dev() is > > > actually pairing with the put hidden inside vfio_device_put() a few lines > > > below. > > > > I feel that the put inside vfio_device_put was meant to pair with the get in > > vfio_group_create_device before this patch is applied. Because > vfio_device_ > > put may drop the last reference to the group, vfio_del_group_dev then > > issues its own get to hold the reference until the put at the end of the func. > > Here I am talking about how this patch removes 3 gets and 2 puts - > which should be a red flag. The reason it is OK is because the 3rd > extra removed get is paring with the put hidden inside another put. Fine. We are just looking at it from different angles. > > > > @@ -1008,6 +990,7 @@ void *vfio_del_group_dev(struct device *dev) > > > if (list_empty(&group->device_list)) > > > wait_event(group->container_q, !group->container); > > > > > > + /* Matches the get in vfio_group_create_device() */ > > > > There is no get there now. > > It is refering to this comment: > > /* Our reference on group is moved to the device */ > > The get is a move in this case > > Later delete the function and this becomes perfectly clear > Looks above comment is not updated after vfio_group_create_device is removed in patch03. Thanks Kevin