linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: avoid bridge feature re-probing on hotplug
@ 2018-12-11  2:18 Michael S. Tsirkin
  2018-12-11  2:45 ` xuyandong
  2018-12-11 14:18 ` Bjorn Helgaas
  0 siblings, 2 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2018-12-11  2:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: xuyandong, stable, Yinghai Lu, Jesse Barnes, Bjorn Helgaas, linux-pci

commit 1f82de10d6 ("PCI/x86: don't assume prefetchable ranges are
64bit") added probing of bridge support for 64 bit memory
each time bridge is re-enumerated.

Unfortunately this probing is destructive if any device behind
the bridge is in use at this time.

There's no real need to re-probe the bridge features as the
regiters in question never change - detect that using
the memory flag being set and skip the probing.
Avoiding repeated calls to pci_bridge_check_ranges might be even nicer
would be a bigger patch and probably not appropriate on stable.

Reported-by: xuyandong <xuyandong2@huawei.com>
Cc: stable@vger.kernel.org
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

This issue has been reported on upstream Linux and Centos.

 drivers/pci/setup-bus.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index ed960436df5e..7ab42f76579e 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -741,6 +741,13 @@ static void pci_bridge_check_ranges(struct pci_bus *bus)
 	struct resource *b_res;
 
 	b_res = &bridge->resource[PCI_BRIDGE_RESOURCES];
+
+	/* Don't re-check after this was called once already:
+	 * important since bridge might be in use.
+	 */
+	if (b_res[1].flags & IORESOURCE_MEM)
+		return;
+
 	b_res[1].flags |= IORESOURCE_MEM;
 
 	pci_read_config_word(bridge, PCI_IO_BASE, &io);
-- 
MST

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-16 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-11  2:18 [PATCH] pci: avoid bridge feature re-probing on hotplug Michael S. Tsirkin
2018-12-11  2:45 ` xuyandong
2018-12-11  4:11   ` Michael S. Tsirkin
2018-12-11 14:18 ` Bjorn Helgaas
2018-12-11 19:01   ` Michael S. Tsirkin
2018-12-16 19:38   ` Michael S. Tsirkin

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).