Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: weipengliang <weipengliang@xiaomi.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,
	Frederic Weisbecker <frederic@kernel.org>,
	Niklas Schnelle <schnelle@linux.ibm.com>,
	Danilo Krummrich <dakr@kernel.org>,
	Uwe Kleine-Konig <u.kleine-koenig@baylibre.com>,
	Samiullah Khawaja <skhawaja@google.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Subject: Re: [PATCH] PCI: Avoid unnecessary cpu_hotplug_disable() for non-NUMA devices
Date: Fri, 22 May 2026 09:12:24 +0200	[thread overview]
Message-ID: <ahAB2BFymPVFGKaG@wunner.de> (raw)
In-Reply-To: <20260522061124.1660-1-weipengliang@xiaomi.com>

On Fri, May 22, 2026 at 02:11:24PM +0800, weipengliang wrote:
> 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().

Hm, this will retain the cpu_hotplug_enable() outside the else-branch,
which isn't very readable IMHO.  How about moving cpu_hotplug_enable()
directly below each rcu_read_unlock() call?

> @@ -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

I'd also move the cpu_hotplug_disable() below INIT_WORK_ONSTACK().
For one it minimizes the critical section, and also INIT_WORK_ONSTACK()
initializes a portion of "arg" declared immediately above, so it's
more readable to keep declaration + initialization together.

Thanks,

Lukas

  reply	other threads:[~2026-05-22  7:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  6:11 [PATCH] PCI: Avoid unnecessary cpu_hotplug_disable() for non-NUMA devices weipengliang
2026-05-22  7:12 ` Lukas Wunner [this message]
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

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=ahAB2BFymPVFGKaG@wunner.de \
    --to=lukas@wunner.de \
    --cc=bhelgaas@google.com \
    --cc=dakr@kernel.org \
    --cc=frederic@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=schnelle@linux.ibm.com \
    --cc=skhawaja@google.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=weipengliang@xiaomi.com \
    /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