linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Cc: linux-pci@vger.kernel.org, "Lukas Wunner" <lukas@wunner.de>,
	"Stefan Roese" <sr@denx.de>, "Andy Lavr" <andy.lavr@gmail.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"David Laight" <David.Laight@ACULAB.COM>,
	"Rajat Jain" <rajatja@google.com>,
	linux@yadro.com
Subject: Re: [PATCH v8 00/24] PCI: Allow BAR movement during boot and hotplug
Date: Mon, 10 Aug 2020 17:21:24 -0500	[thread overview]
Message-ID: <20200810222124.GA952697@bjorn-Precision-5520> (raw)
In-Reply-To: <20200427182358.2067702-1-s.miroshnichenko@yadro.com>

On Mon, Apr 27, 2020 at 09:23:34PM +0300, Sergei Miroshnichenko wrote:
> Currently PCI hotplug works on top of resources which are usually reserved
> not by the kernel, but by BIOS, bootloader, firmware, etc. These resources
> are gaps in the address space where BARs of new devices may fit, and extra
> bus number per port, so bridges can be hot-added. This series aim the BARs
> problem: it shows the kernel how to redistribute them on the run, so the
> hotplug becomes predictable and cross-platform. A follow-up patchset will
> propose a solution for bus numbers.
> 
> To arrange a space for BARs of new hotplugged devices, the kernel can pause
> the drivers of working PCI devices and reshuffle the assigned BARs. When a
> driver is un-paused by the kernel, it should ioremap() the new addresses of
> its BARs.
> 
> Drivers indicate their support of the feature by implementing the new hooks
> .rescan_prepare() and .rescan_done() in the struct pci_driver. If a driver
> doesn't yet support the feature, BARs of its devices will be considered as
> immovable and handled in the same way as resources with the PCI_FIXED flag:
> they are guaranteed to remain untouched.
> 
> Tested on a number of x86_64 machines without any special kernel command
> line arguments:
>  - PC: i7-5930K + ASUS X99-A;
>  - PC: i5-8500 + ASUS Z370-F;
>  - Supermicro Super Server/H11SSL-i: AMD EPYC 7251;
>  - HP ProLiant DL380 G5: Xeon X5460;
>  - Dell Inspiron N5010: i5 M 480;
>  - Dell Precision M6600: i7-2920XM.
> ...

There's a lot of good work here, and I apologize that we haven't made
much progress on merging it.  I suspect this will become more and more
important with Thunderbolt.

It does touch a lot of the ugliest and least maintainable code under
drivers/pci, which is *good* if we can clean it up a little bit in the
process, but it is also risky.

I expect that a few problems are inevitable because of BIOS issues,
driver issues, and devices that can't tolerate their BARs being moved.
We've tripped over a few of those devices in the past.

Those can be really hard to debug and fix since we won't have the
hardware in question.  To make them tractable, I think we will really
need some way to test at least the resource assignment pieces of this
"in vitro" without needing the actual hardware.  E.g., maybe we could
add enough diagnostics so that a dmesg log would contain all the
information needed to reproduce a PCI hierarchy, the initial resource
assignments, and subsequent hotplug events in some sort of test
fixture, maybe a qemu boot or similar.

Bjorn

      parent reply	other threads:[~2020-08-10 22:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 18:23 [PATCH v8 00/24] PCI: Allow BAR movement during boot and hotplug Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 01/24] PCI: Fix race condition in pci_enable/disable_device() Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 02/24] PCI: Ensure a bridge has I/O and MEM access for hot-added devices Sergei Miroshnichenko
2020-04-29  6:30   ` kbuild test robot
2020-04-27 18:23 ` [PATCH v8 03/24] PCI: hotplug: Initial support of the movable BARs feature Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 04/24] PCI: Add version of release_child_resources() aware of fixed BARs Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 05/24] PCI: hotplug: Fix reassigning the released BARs Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 06/24] PCI: hotplug: Recalculate every bridge window during rescan Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 07/24] PCI: hotplug: Don't allow hot-added devices to steal resources Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 08/24] PCI: Reassign BARs if BIOS/bootloader had assigned not all of them Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 09/24] PCI: hotplug: Try to reassign movable BARs only once Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 10/24] PCI: hotplug: Calculate fixed parts of bridge windows Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 11/24] PCI: Include fixed BARs into the bus size calculating Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 12/24] PCI: hotplug: movable BARs: Compute limits for relocated bridge windows Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 13/24] PCI: Make sure bridge windows include their fixed BARs Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 14/24] PCI: hotplug: Add support of fixed BARs to pci_assign_resource() Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 15/24] PCI: hotplug: Sort fixed BARs before assignment Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 16/24] x86/PCI/ACPI: Fix up PCIBIOS_MIN_MEM if value computed from e820 is invalid Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 17/24] PCI: hotplug: Configure MPS after manual bus rescan Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 18/24] PCI: hotplug: Don't disable the released bridge windows immediately Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 19/24] PCI: pciehp: Trigger a domain rescan on hp events when enabled movable BARs Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 20/24] PCI: Don't claim fixed BARs Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 21/24] PCI: hotplug: Don't reserve bus space when enabled movable BARs Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 22/24] PCI: hotplug: Enable the movable BARs feature by default Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 23/24] PCI/portdrv: Declare support of movable BARs Sergei Miroshnichenko
2020-04-27 18:23 ` [PATCH v8 24/24] nvme-pci: Handle " Sergei Miroshnichenko
2020-04-28 12:59 ` [PATCH v8 00/24] PCI: Allow BAR movement during boot and hotplug Christian König
2020-05-04  9:30   ` Sergei Miroshnichenko
2020-08-10 22:21 ` Bjorn Helgaas [this message]

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=20200810222124.GA952697@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=David.Laight@ACULAB.COM \
    --cc=andy.lavr@gmail.com \
    --cc=ardb@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@yadro.com \
    --cc=lukas@wunner.de \
    --cc=rajatja@google.com \
    --cc=s.miroshnichenko@yadro.com \
    --cc=sr@denx.de \
    /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;
as well as URLs for NNTP newsgroup(s).