Re: [PATCH v2 02/17] iommufd: Add iommufd_group

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

 



On Wed, Mar 08, 2023 at 11:18:11AM +0800, Baolu Lu wrote:
> On 3/8/23 8:35 AM, Jason Gunthorpe wrote:
> > When the hwpt to device attachment is fairly static we could get
> > away with the simple approach of keeping track of the groups via a
> > device list. But with replace this is infeasible.
> > 
> > Add an automatically managed struct that is 1:1 with the iommu_group
> > per-ictx so we can store the necessary tracking information there.
> > 
> > Signed-off-by: Jason Gunthorpe<jgg@xxxxxxxxxx>
> 
> The iommufd_get_group() helper looks long. I went through it carefully
> and didn't find any problems. However, is it possible to add a mutex in
> ictx to protect the group array? Can it be simpler?

We have a spinlock to protect the array, that is why it is so long
because we don't want to hold the spinlock and also allocate memory.

This is still the "short" version because it doesn't also use RCU :)

It is true though, it would be nice if xarray.c had a helper for this
"return existing w/ ref or allocate and ref" pattern.

Jason



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux