Re: Issues with "PCI/LINK: Report degraded links via link bandwidth notification"

From: Alex Williamson
Date: Mon Jan 20 2020 - 10:56:53 EST


On Sun, 19 Jan 2020 20:33:26 -0600
Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:

> [+cc NVMe, GPU driver folks]
>
> On Wed, Jan 15, 2020 at 04:10:08PM -0600, Bjorn Helgaas wrote:
> > I think we have a problem with link bandwidth change notifications
> > (see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pci/pcie/bw_notification.c).
> >
> > Here's a recent bug report where Jan reported "_tons_" of these
> > notifications on an nvme device:
> > https://bugzilla.kernel.org/show_bug.cgi?id=206197
> >
> > There was similar discussion involving GPU drivers at
> > https://lore.kernel.org/r/20190429185611.121751-2-helgaas@xxxxxxxxxx
> >
> > The current solution is the CONFIG_PCIE_BW config option, which
> > disables the messages completely. That option defaults to "off" (no
> > messages), but even so, I think it's a little problematic.
> >
> > Users are not really in a position to figure out whether it's safe to
> > enable. All they can do is experiment and see whether it works with
> > their current mix of devices and drivers.
> >
> > I don't think it's currently useful for distros because it's a
> > compile-time switch, and distros cannot predict what system configs
> > will be used, so I don't think they can enable it.
> >
> > Does anybody have proposals for making it smarter about distinguishing
> > real problems from intentional power management, or maybe interfaces
> > drivers could use to tell us when we should ignore bandwidth changes?
>
> NVMe, GPU folks, do your drivers or devices change PCIe link
> speed/width for power saving or other reasons? When CONFIG_PCIE_BW=y,
> the PCI core interprets changes like that as problems that need to be
> reported.
>
> If drivers do change link speed/width, can you point me to where
> that's done? Would it be feasible to add some sort of PCI core
> interface so the driver could say "ignore" or "pay attention to"
> subsequent link changes?
>
> Or maybe there would even be a way to move the link change itself into
> the PCI core, so the core would be aware of what's going on?

One case where we previously saw sporadic link change messages was
vfio-pci owned devices. If the transitions are based on config space
manipulation then I can trap those accesses and wrap them in a PCI core
API, but I suspect that's not the exclusive (or potentially even
primary) mechanism for initiating link changes. So I think we'd
probably need a mechanism for a driver to opt-out of link notification
for their devices (presumably the fn0 device per link would opt-out the
entire link?). Thanks,

Alex