Re: [PATCH 4/5] vfio: Use a refcount_t instead of a kref in the vfio_group

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

 



On Mon, Oct 04, 2021 at 04:25:51PM -0600, Alex Williamson wrote:
> On Fri,  1 Oct 2021 20:22:23 -0300
> Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
> 
> > The next patch adds a struct device to the struct vfio_group, and it is
> > confusing/bad practice to have two krefs in the same struct. This kref is
> > controlling the period when the vfio_group is registered in sysfs, and
> > visible in the internal lookup. Switch it to a refcount_t instead.
> > 
> > The refcount_dec_and_mutex_lock() is still required because we need
> > atomicity of the list searches and sysfs presence.
> > 
> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> >  drivers/vfio/vfio.c | 19 +++++++------------
> >  1 file changed, 7 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> > index bf233943dc992f..dbe7edd88ce35c 100644
> > +++ b/drivers/vfio/vfio.c
> > @@ -69,7 +69,7 @@ struct vfio_unbound_dev {
> >  };
> >  
> >  struct vfio_group {
> > -	struct kref			kref;
> > +	refcount_t users;
> 
> Follow indenting for existing structs please.  The next patch even
> mixes following and changing formatting, so I'm not sure what rule is
> being used here.  Thanks,

Sure, I generally err toward nixing the vertical alignment. It
generally is a net harm to backporting and I don't care much for the
poor readability of 30 chars of whitespace between related
words.. I look over the patches again and check

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