public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: Keith Busch <kbusch@kernel.org>
Cc: Keith Busch <kbusch@meta.com>,
	linux-pci@vger.kernel.org, helgaas@kernel.org, lukas@wunner.de,
	dan.j.williams@intel.com, guojinhui.liam@bytedance.com,
	ilpo.jarvinen@linux.intel.com
Subject: Re: [PATCHv3 3/4] pci: remove slot specific lock/unlock and save/restore
Date: Wed, 11 Feb 2026 08:22:29 -0700	[thread overview]
Message-ID: <20260211082229.4e746e32@shazbot.org> (raw)
In-Reply-To: <aYvJXRGnsIYVdVUm@kbusch-mbp>

On Tue, 10 Feb 2026 17:12:13 -0700
Keith Busch <kbusch@kernel.org> wrote:

> On Tue, Feb 10, 2026 at 04:46:23PM -0700, Alex Williamson wrote:
> > On Thu, 5 Feb 2026 13:25:32 -0800
> > Keith Busch <kbusch@meta.com> wrote:
> >   
> > > From: Keith Busch <kbusch@kernel.org>
> > > 
> > > The Linux pci driver resolves a "slot" to the "D" in the B:D.f (see
> > > PCI_SLOT()). A pcie "slot reset" is a secondary bus reset, which affects
> > > every function on every "D", not just the ones with a matching "slot".
> > > The slot lock/unlock and save/restore functions, however, are only
> > > handling a subset of the functions, breaking the rest.  
> > 
> > So are we deprecating conventional PCI hotplug slots?    
> 
> No, this still calls the slot's specific reset callback via
> pci_reset_hotplug_slot. The only thing this does is add locking, config
> state save/restore, and driver reset prepare/complete calls for the
> entire bus rather than matching "slots" on that bus. In the worst case
> scenario, this patch has the kernel do a little more work than it needed
> to.

But with this change, when vfio-pci calls pci_probe_reset_slot() we
test pci_bus_resettable() rather than pci_slot_resettable().  The
former is a superset of the latter.  Another slot on the same bus might
have a bridge card or quirked device that previously wouldn't have
affected the ability to reset a separate physical, conventional slot.
The risk is small, but the semantics are different.

> > I've always
> > understood these to be a subset of the bus, where we find the devices
> > sharing the same physical PCI slot by comparing the pci_dev.slot across
> > the bus, as done in all the code removed here.  pci_create_slot()
> > certainly is not simply a reflection of PCI_SLOT().    
> 
> pci_create_slot assigns devices that match PCI_SLOT() of the bus's
> devices, so it certainly is a reflection of that, no? The problem is
> that PCI_SLOT() macro doesn't actually reflect the true nature of what
> devices belong in the slot: the devices in a particular "slot" does not
> define the actual blast radius of resetting that "slot".

struct pci_slot, the thing created by pci_create_slot(), represents a
physical slot.  PCI_SLOT() is the bus addressing.  Not all pci_devs
have a struct pci_slot, not all pci_devs within the same physical slot
share the same B:D.F slot number (with ARI).

The vfio code does assume that 'slot' defines the blast radius of a
pci_slot_reset() and I'm confused how it should operate if we're now
going to conflate slot and bus reset scopes.
 
> > Is the error below
> > really a reflection that pci_dev.slot isn't carried over to the full
> > set of functions?  
> 
> Correct, the pci slot today in a pciehp hotplug slot is not getting
> assigned to all the functions in that slot, so slot resets completely
> miss handling those functions, which inevitably break them.

Isn't this then a pciehp hotplug issue that all children of the bus
should be linked via the struct pci_slot regardless of PCI_SLOT()?
Thanks,

Alex

  reply	other threads:[~2026-02-11 15:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 21:25 [PATCHv3 0/4] pci slot reset handling fixes Keith Busch
2026-02-05 21:25 ` [PATCHv3 1/4] pci: rename __pci_bus_reset and __pci_slot_reset Keith Busch
2026-02-06 17:22   ` Keith Busch
2026-02-10 20:44   ` dan.j.williams
2026-02-05 21:25 ` [PATCHv3 2/4] pci: allow all bus devices to use the same slot Keith Busch
2026-02-10 20:00   ` dan.j.williams
2026-02-10 20:28     ` Keith Busch
2026-02-10 20:51       ` dan.j.williams
2026-02-05 21:25 ` [PATCHv3 3/4] pci: remove slot specific lock/unlock and save/restore Keith Busch
2026-02-10 22:03   ` dan.j.williams
2026-02-10 23:25     ` Keith Busch
2026-02-10 23:48       ` dan.j.williams
2026-02-10 23:46   ` Alex Williamson
2026-02-11  0:12     ` Keith Busch
2026-02-11 15:22       ` Alex Williamson [this message]
2026-02-11 15:54         ` Keith Busch
2026-02-05 21:25 ` [PATCHv3 4/4] pci: make reset_subordinate hotplug safe Keith Busch
2026-02-10 22:14   ` dan.j.williams

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=20260211082229.4e746e32@shazbot.org \
    --to=alex@shazbot.org \
    --cc=dan.j.williams@intel.com \
    --cc=guojinhui.liam@bytedance.com \
    --cc=helgaas@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    /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