]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Jul 2025 08:08:36 +0000 (10:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Jul 2025 08:08:36 +0000 (10:08 +0200)
added patches:
pci-hv-do-not-set-pci_command_memory-to-reduce-vm-boot-time.patch

queue-5.10/pci-hv-do-not-set-pci_command_memory-to-reduce-vm-boot-time.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/pci-hv-do-not-set-pci_command_memory-to-reduce-vm-boot-time.patch b/queue-5.10/pci-hv-do-not-set-pci_command_memory-to-reduce-vm-boot-time.patch
new file mode 100644 (file)
index 0000000..0f88e15
--- /dev/null
@@ -0,0 +1,63 @@
+From 23e118a48acf7be223e57d98e98da8ac5a4071ac Mon Sep 17 00:00:00 2001
+From: Dexuan Cui <decui@microsoft.com>
+Date: Mon, 2 May 2022 00:42:55 -0700
+Subject: PCI: hv: Do not set PCI_COMMAND_MEMORY to reduce VM boot time
+
+From: Dexuan Cui <decui@microsoft.com>
+
+commit 23e118a48acf7be223e57d98e98da8ac5a4071ac upstream.
+
+Currently when the pci-hyperv driver finishes probing and initializing the
+PCI device, it sets the PCI_COMMAND_MEMORY bit; later when the PCI device
+is registered to the core PCI subsystem, the core PCI driver's BAR detection
+and initialization code toggles the bit multiple times, and each toggling of
+the bit causes the hypervisor to unmap/map the virtual BARs from/to the
+physical BARs, which can be slow if the BAR sizes are huge, e.g., a Linux VM
+with 14 GPU devices has to spend more than 3 minutes on BAR detection and
+initialization, causing a long boot time.
+
+Reduce the boot time by not setting the PCI_COMMAND_MEMORY bit when we
+register the PCI device (there is no need to have it set in the first place).
+The bit stays off till the PCI device driver calls pci_enable_device().
+With this change, the boot time of such a 14-GPU VM is reduced by almost
+3 minutes.
+
+Link: https://lore.kernel.org/lkml/20220419220007.26550-1-decui@microsoft.com/
+Tested-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
+Signed-off-by: Dexuan Cui <decui@microsoft.com>
+Reviewed-by: Michael Kelley <mikelley@microsoft.com>
+Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Cc: Jake Oshins <jakeo@microsoft.com>
+Link: https://lore.kernel.org/r/20220502074255.16901-1-decui@microsoft.com
+Signed-off-by: Wei Liu <wei.liu@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/controller/pci-hyperv.c |   17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+--- a/drivers/pci/controller/pci-hyperv.c
++++ b/drivers/pci/controller/pci-hyperv.c
+@@ -1820,12 +1820,17 @@ static void prepopulate_bars(struct hv_p
+                               }
+                       }
+                       if (high_size <= 1 && low_size <= 1) {
+-                              /* Set the memory enable bit. */
+-                              _hv_pcifront_read_config(hpdev, PCI_COMMAND, 2,
+-                                                       &command);
+-                              command |= PCI_COMMAND_MEMORY;
+-                              _hv_pcifront_write_config(hpdev, PCI_COMMAND, 2,
+-                                                        command);
++                              /*
++                               * No need to set the PCI_COMMAND_MEMORY bit as
++                               * the core PCI driver doesn't require the bit
++                               * to be pre-set. Actually here we intentionally
++                               * keep the bit off so that the PCI BAR probing
++                               * in the core PCI driver doesn't cause Hyper-V
++                               * to unnecessarily unmap/map the virtual BARs
++                               * from/to the physical BARs multiple times.
++                               * This reduces the VM boot time significantly
++                               * if the BAR sizes are huge.
++                               */
+                               break;
+                       }
+               }
index 3f493b07ab65da86cff978b90e0ca906a80d0780..e71ebc9320f9f7a89a0101167f590400f77776c1 100644 (file)
@@ -74,3 +74,4 @@ drm-bridge-cdns-dsi-fix-the-clock-variable-for-mode_valid.patch
 drm-bridge-cdns-dsi-fix-connecting-to-next-bridge.patch
 drm-bridge-cdns-dsi-check-return-value-when-getting-default-phy-config.patch
 drm-bridge-cdns-dsi-wait-for-clk-and-data-lanes-to-be-ready.patch
+pci-hv-do-not-set-pci_command_memory-to-reduce-vm-boot-time.patch