From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Lukas Wunner <lukas@wunner.de>,
Chris Chiu <chris.chiu@canonical.com>,
linux-pci@vger.kernel.org, regressions@lists.linux.dev,
linux-cxl@vger.kernel.org, linuxarm@huawei.com
Subject: Re: Regression: Re: [PATCH v2 4/6] PCI: Distribute available resources for root buses too
Date: Wed, 26 Oct 2022 11:38:32 +0300 [thread overview]
Message-ID: <Y1jyCHS2ka2rYEtN@black.fi.intel.com> (raw)
In-Reply-To: <20221025150500.000059ba@huawei.com>
On Tue, Oct 25, 2022 at 03:05:00PM +0100, Jonathan Cameron wrote:
> On Tue, 25 Oct 2022 15:36:06 +0300
> Mika Westerberg <mika.westerberg@linux.intel.com> wrote:
>
> > Hi,
> >
> > On Mon, Oct 24, 2022 at 02:25:12PM +0300, Mika Westerberg wrote:
> > > On Mon, Oct 24, 2022 at 02:13:10PM +0300, Mika Westerberg wrote:
> > > > Hi,
> > > >
> > > > On Fri, Oct 14, 2022 at 03:48:58PM +0100, Jonathan Cameron wrote:
> > > > > > Thanks for the detailed report! I wonder if you could try the below
> > > > > > patch and see if it changes anything?
> > > > > Thanks for the quick response.
> > > > >
> > > > > Doesn't fix it unfortunately.
> > > >
> > > > I'm back now.
> > > >
> > > > Trying to reproduce this with mainline kernel (arm64 defconfig) and the
> > > > following command line:
> > > >
> > > > qemu-system-aarch64 \
> > > > -M virt,nvdimm=on,gic-version=3 -m 4g,maxmem=8G,slots=8 -cpu max -smp 4 \
> > > > -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \
> > > > -nographic -no-reboot \
> > > > -kernel Image \
> > > > -initrd rootfs.cpio.bz2 \
> > > > -device pcie-root-port,port=0,id=root_port13,chassis=0,slot=2 \
> > > > -device x3130-upstream,id=sw1,bus=root_port13,multifunction=on \
> > > > -device e1000,bus=root_port13,addr=0.1 \
> > > > -device xio3130-downstream,id=fun1,bus=sw1,chassis=0,slot=3 \
> > > > -device e1000,bus=fun1
> > > >
> > > > But the resulting PCIe topology is pretty flat:
> > > >
> > > > # lspci
> > > > 00:00.0 Host bridge: Red Hat, Inc. QEMU PCIe Host bridge
> > > > 00:01.0 Ethernet controller: Red Hat, Inc. Virtio network device
> > > >
> > > > I wonder what I'm missing here? Do I need to enable additional drivers
> > > > to get the topology to resemble yours?
> > >
> > > Nevermind, I was missing one \ in the command line ;-) Now I can see the
> > > topology similar to yours.
> >
> > I think I know what the problem is now - there is a multifunction device
> > with the switch upstream port and the resource distribution code is not
> > prepared to handle such (not sure how common this is in real hardware
> > but allowed by the PCIe spec).
> >
> > Simple fix would be just ignore all resource distribution if we
> > encounter such topologies but I think can still allow it, just by
> > accounting the resources reserved for the multifunction device(s).
> >
> > Can you try on your side so that you revert this revert:
> >
> > 5632e2beaf9d ("Revert "PCI: Distribute available resources for root buses, too"")
> >
> > and then apply the below patch and see if the problem goes away? Thanks!
>
> Looks good on my more complex setup that I originally hit this problem on.
Thanks for checking!
>
> A comment on the comment inline.
>
> >
> > diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> > index dc6a30ee6edf..a7ca3fecf259 100644
> > --- a/drivers/pci/setup-bus.c
> > +++ b/drivers/pci/setup-bus.c
> > @@ -1833,10 +1833,65 @@ static void pci_bus_distribute_available_resources(struct pci_bus *bus,
> > * bridges below.
> > */
> > if (hotplug_bridges + normal_bridges == 1) {
> > - dev = list_first_entry(&bus->devices, struct pci_dev, bus_list);
> > - if (dev->subordinate)
> > - pci_bus_distribute_available_resources(dev->subordinate,
> > - add_list, io, mmio, mmio_pref);
> > + /* Upstream port must be the first */
> > + bridge = list_first_entry(&bus->devices, struct pci_dev, bus_list);
> > + if (!bridge->subordinate)
> > + return;
> > +
> > + /*
> > + * It is possible to have switch upstream port as a part
> > + * of multifunction device, although not too common. For
> > + * this reason reduce the resources occupied by the
> > + * other functions before distributing the rest.
> > + */
>
> I 'think' it's quite common. I don't have one to hand but
> drivers/pci/switches/switchtec.c has drivers for a management function that I
> think are an additional function alongside the USP on a wide range of
> switch chips. It's possible those actually sit on their own port though or
> pretend to be below a DSP.
I see. Okay, I will update the comment accordingly and submit as a formal
patch along with the revert of the revert if no objections.
next prev parent reply other threads:[~2022-10-26 8:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 8:02 [PATCH v2 0/6] PCI: Allow for future resource expansion on initial root bus scan Mika Westerberg
2022-09-05 8:02 ` [PATCH v2 1/6] PCI: Fix used_buses calculation in pci_scan_child_bus_extend() Mika Westerberg
2022-09-05 8:02 ` [PATCH v2 2/6] PCI: Pass available buses also when the bridge is already configured Mika Westerberg
2022-09-05 8:02 ` [PATCH v2 3/6] PCI: Move pci_assign_unassigned_root_bus_resources() Mika Westerberg
2022-09-05 8:02 ` [PATCH v2 4/6] PCI: Distribute available resources for root buses too Mika Westerberg
2022-10-14 11:45 ` Regression: " Jonathan Cameron
2022-10-14 13:30 ` Mika Westerberg
2022-10-14 14:48 ` Jonathan Cameron
2022-10-24 11:13 ` Mika Westerberg
2022-10-24 11:25 ` Mika Westerberg
2022-10-25 12:36 ` Mika Westerberg
2022-10-25 13:23 ` Andy Shevchenko
2022-10-31 7:40 ` Mika Westerberg
2022-10-25 14:05 ` Jonathan Cameron
2022-10-26 8:38 ` Mika Westerberg [this message]
2022-10-26 8:49 ` Regression: Re: [PATCH v2 4/6] PCI: Distribute available resources for root buses too #forregzbot Thorsten Leemhuis
2022-10-26 18:17 ` Thorsten Leemhuis
2022-09-05 8:02 ` [PATCH v2 5/6] PCI: Fix whitespace and indentation Mika Westerberg
2022-09-05 8:02 ` [PATCH v2 6/6] PCI: Fix typo in pci_scan_child_bus_extend() Mika Westerberg
2022-09-21 19:52 ` [PATCH v2 0/6] PCI: Allow for future resource expansion on initial root bus scan Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y1jyCHS2ka2rYEtN@black.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=chris.chiu@canonical.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=lukas@wunner.de \
--cc=rafael.j.wysocki@intel.com \
--cc=regressions@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox