All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: Avoid unnecessary cpu_hotplug_disable() for non-NUMA devices
@ 2026-05-22  6:11 weipengliang
  2026-05-22  7:12 ` Lukas Wunner
  0 siblings, 1 reply; 11+ messages in thread
From: weipengliang @ 2026-05-22  6:11 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, Lukas Wunner, Frederic Weisbecker, Niklas Schnelle,
	Danilo Krummrich, Uwe Kleine-Konig, Samiullah Khawaja,
	Manivannan Sadhasivam, weipengliang

When a PCI device is on an invalid/offline NUMA node or is a VF being
probed from PF context, the code path calls local_pci_probe() directly
without needing work_on_cpu(). In these cases, the cpu_hotplug_disable()
/ cpu_hotplug_enable() round-trip is unnecessary overhead.

Move cpu_hotplug_disable() into the NUMA-valid else branch so non-NUMA
devices skip it entirely, returning early after local_pci_probe().
---
 drivers/pci/pci-driver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index e3f59001785a..d3df90f58cf4 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -384,7 +384,6 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
 	node = dev_to_node(&dev->dev);
 	dev->is_probed = 1;
 
-	cpu_hotplug_disable();
 	/*
 	 * Prevent nesting work_on_cpu() for the case where a Virtual Function
 	 * device is probed from work_on_cpu() of the Physical device.
@@ -392,9 +391,13 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
 	if (node < 0 || node >= MAX_NUMNODES || !node_online(node) ||
 	    pci_physfn_is_probed(dev)) {
 		error = local_pci_probe(&ddi);
+		dev->is_probed = 0;
+		return error;
 	} else {
 		struct pci_probe_arg arg = { .ddi = &ddi };
 
+		cpu_hotplug_disable();
+
 		INIT_WORK_ONSTACK(&arg.work, local_pci_probe_callback);
 		/*
 		 * The target election and the enqueue of the work must be within
-- 
2.47.1.windows.1


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

end of thread, other threads:[~2026-05-22 10:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22  6:11 [PATCH] PCI: Avoid unnecessary cpu_hotplug_disable() for non-NUMA devices weipengliang
2026-05-22  7:12 ` Lukas Wunner
2026-05-22  7:54   ` [PATCH v2] " weipengliang
2026-05-22  8:02     ` Lukas Wunner
2026-05-22  8:11       ` weipengliang
2026-05-22  8:22       ` weipengliang
2026-05-22  8:42       ` weipengliang
2026-05-22  8:48         ` [PATCH v3] " weipengliang
2026-05-22  9:56           ` sashiko-bot
2026-05-22 10:53           ` [PATCH v4] " weipengliang
2026-05-22  8:32     ` [PATCH v2] " sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.