On Fri, Apr 22, 2022 at 01:50:00AM +0000, Tian, Kevin wrote: > > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > Sent: Friday, April 22, 2022 12:29 AM > > > > Every caller has a readily available vfio_device pointer, use that instead > > of passing in a generic struct device. The struct vfio_device already > > contains the group we need so this avoids complexity, extra refcountings, > > and a confusing lifecycle model. > > Using the same description as last patch leaves the impression that > the two patches do the exactly same type of change. But this > patch actually includes one more change to grab a reference on the > container. This is worth an explanation. How about this: Every caller has a readily available vfio_device pointer, use that instead of passing in a generic struct device. Change vfio_dma_rw() to take in the struct vfio_device and move the container users that would have been held by vfio_group_get_external_user_from_dev() to vfio_dma_rw() directly, like vfio_pin/unpin_pages(). Thanks, Jason