Re: [PATCH mlx5-next v7 0/4] Dynamically assign MSI-X vectors count

Jason Gunthorpe
2021-03-30T22:44:40Z

On Tue, Mar 30, 2021 at 03:41:41PM -0500, Bjorn Helgaas wrote:
> On Tue, Mar 30, 2021 at 04:47:16PM -0300, Jason Gunthorpe wrote:
> > On Tue, Mar 30, 2021 at 10:00:19AM -0500, Bjorn Helgaas wrote:
> > > On Tue, Mar 30, 2021 at 10:57:38AM -0300, Jason Gunthorpe wrote:
> > > > On Mon, Mar 29, 2021 at 08:29:49PM -0500, Bjorn Helgaas wrote:
> > > >
> > > > > I think I misunderstood Greg's subdirectory comment. We already have
> > > > > directories like this:
> > > >
> > > > Yes, IIRC, Greg's remark applies if you have to start creating
> > > > directories with manual kobjects.
> > > >
> > > > > and aspm_ctrl_attr_group (for "link") is nicely done with static
> > > > > attributes. So I think we could do something like this:
> > > > >
> > > > > /sys/bus/pci/devices/0000:01:00.0/ # PF directory
> > > > > sriov/ # SR-IOV related stuff
> > > > > vf_total_msix
> > > > > vf_msix_count_BB:DD.F # includes bus/dev/fn of first VF
> > > > > ...
> > > > > vf_msix_count_BB:DD.F # includes bus/dev/fn of last VF
> > > >
> > > > It looks a bit odd that it isn't a subdirectory, but this seems
> > > > reasonable.
> > >
> > > Sorry, I missed your point; you'll have to lay it out more explicitly.
> > > I did intend that "sriov" *is* a subdirectory of the 0000:01:00.0
> > > directory. The full paths would be:
> > >
> > > /sys/bus/pci/devices/0000:01:00.0/sriov/vf_total_msix
> > > /sys/bus/pci/devices/0000:01:00.0/sriov/vf_msix_count_BB:DD.F
> > > ...
> >
> > Sorry, I was meaning what you first proposed:
> >
> > /sys/bus/pci/devices/0000:01:00.0/sriov/BB:DD.F/vf_msix_count
> >
> > Which has the extra sub directory to organize the child VFs.
> >
> > Keep in mind there is going to be alot of VFs here, > 1k - so this
> > will be a huge directory.
>
> With 0000:01:00.0/sriov/vf_msix_count_BB:DD.F, sriov/ will contain
> 1 + 1K files ("vf_total_msix" + 1 per VF).
>
> With 0000:01:00.0/sriov/BB:DD.F/vf_msix_count, sriov/ will contain
> 1 file and 1K subdirectories.

The smallest directory sizes is with the current patch since it
re-uses the existing VF directory. Do we care about directory size at
the sysfs level?

> No real difference now, but if we add more files per VF, a BB:DD.F/
> subdirectory would certainly be nicer.

Hard to know if that will happen, there is a lot of 'pre-driver'
configuration but it seems to mostly be living in other places.

If this is restricted to be only the generic PCI attributes (and I
think it should be) I'm having a hard time coming up with a future
extension.

> I'm dense and don't fully understand Greg's subdirectory comment.

I also don't know udev well enough. I've certainly seen drivers
creating extra subdirectories using kobjects.

> But it doesn't seem like that level of control would be in a udev rule
> anyway. A PF udev rule might *start* a program to manage MSI-X
> vectors, but such a program should be able to deal with whatever
> directory structure we want.

Yes, I can't really see this being used from udev either.

I assume there is also the usual race about triggering the uevent
before the subdirectories are created, but we have the
dev_set_uevent_suppress() thing now for that..

Jason