All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Vincent Liu <vincent.liu@nutanix.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: Check drivers_autoprobe for all added devices
Date: Thu, 2 Oct 2025 07:55:57 +0200	[thread overview]
Message-ID: <2025100209-hefty-catalyst-e5b2@gregkh> (raw)
In-Reply-To: <20251001151508.1684592-1-vincent.liu@nutanix.com>

On Wed, Oct 01, 2025 at 04:15:07PM +0100, Vincent Liu wrote:
> When a PCIe device is hot-plugged, or when a VF is created, the
> drivers_autoprobe sysfs attribute is not checked. This means that
> drivers_autoprobe is not working as intended, e.g. hot-plugged devices
> will still be autoprobed and bound to drivers even with
> drivers_autoprobe disabled.
> 
> Make sure all devices check drivers_autoprobe by pushing the
> drivers_autoprobe check into device_initial_probe. This should only
> affect devices on the PCI bus as device_initial_probe is only called by
> pci_bus_add_device (bus_probe_device already checks for autoprobe).
> In particular, only hot-plugged PCIe devices/VFs should be affected as
> the default value of pci/drivers_autoprobe remains 1 and can only be
> cleared from userland.
> 
> Signed-off-by: Vincent Liu <vincent.liu@nutanix.com>
> ---
>  drivers/base/bus.c |  3 +--
>  drivers/base/dd.c  | 10 +++++++++-
>  2 files changed, 10 insertions(+), 3 deletions(-)

If this is a PCI-specific issue, why not cc: the pci developers and
maintainer as well?

Also, a PCI patch shouldn't be for the driver-core only, I think the
subject line needs to have "driver core" in it.

> 
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index 5e75e1bce551..320e155c6be7 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -533,8 +533,7 @@ void bus_probe_device(struct device *dev)
>  	if (!sp)
>  		return;
>  
> -	if (sp->drivers_autoprobe)
> -		device_initial_probe(dev);
> +	device_initial_probe(dev);
>  
>  	mutex_lock(&sp->mutex);
>  	list_for_each_entry(sif, &sp->interfaces, node)
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 13ab98e033ea..37fc57e44e54 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -1077,7 +1077,15 @@ EXPORT_SYMBOL_GPL(device_attach);
>  
>  void device_initial_probe(struct device *dev)
>  {
> -	__device_attach(dev, true);
> +	struct subsys_private *sp = bus_to_subsys(dev->bus);
> +
> +	if (!sp)
> +		return;
> +
> +	if (sp->drivers_autoprobe)
> +		__device_attach(dev, true);
> +
> +	subsys_put(sp);
>  }


I don't see why this is specific to PCI VF devices.  Did you see the
recent PCI patch for not probing VF devices that was sent out yesterday?
I think that might fix this instead:
	https://lore.kernel.org/r/20251002020010.315944-1-jhubbard@nvidia.com

thanks,

greg k-h

  reply	other threads:[~2025-10-02  5:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-01 15:15 [PATCH] PCI: Check drivers_autoprobe for all added devices Vincent Liu
2025-10-02  5:55 ` Greg Kroah-Hartman [this message]
2025-10-02 12:04   ` [PATCH] driver core: " Vincent Liu
2025-10-13 18:14 ` [PATCH v2] driver core: " Vincent Liu
2025-10-14  5:14   ` Greg KH
2025-10-14 12:10     ` Vincent Liu
2025-10-21 12:49       ` Vincent Liu
2025-10-22 10:32         ` Greg KH
2025-10-14 20:07   ` Bjorn Helgaas
2025-10-15 10:23     ` Vincent Liu
2025-10-15 16:53       ` Bjorn Helgaas
2025-10-22 12:07 ` [PATCH v3] " Vincent Liu
2025-11-04 13:16   ` Vincent Liu
2025-11-20 17:00 ` [PATCH v3 RESEND] " Vincent Liu

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=2025100209-hefty-catalyst-e5b2@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dakr@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=vincent.liu@nutanix.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 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.