public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: dan.j.williams@intel.com
Cc: Keith Busch <kbusch@meta.com>,
	linux-pci@vger.kernel.org, helgaas@kernel.org, alex@shazbot.org,
	lukas@wunner.de, guojinhui.liam@bytedance.com,
	ilpo.jarvinen@linux.intel.com
Subject: Re: [PATCHv2 4/4] pci: make reset_subordinate hotplug safe
Date: Wed, 4 Feb 2026 15:31:05 -0700	[thread overview]
Message-ID: <aYPIqfS73JOxL_lu@kbusch-mbp> (raw)
In-Reply-To: <697da44e6d895_1d3310085@dwillia2-mobl4.notmuch>

On Fri, Jan 30, 2026 at 10:42:22PM -0800, dan.j.williams@intel.com wrote:
> Keith Busch wrote:
> > From: Keith Busch <kbusch@kernel.org>
> > 
> > Use the slot reset method when resetting the bridge if the bus contains
> 
> What about some renames to make this easier to read, because it is
> ironic that this says "Use the slot reset method" when the functional
> change is to now start using the __pci_reset_slot() method. If I am
> reading this "slot reset vs reset slot" conversion correctly.

Yep, I thnk you've got the sense of the naming issues here.
 
> Something like:
> 
> s/__pci_reset_slot/pci_try_masked_slot_reset/
> 
> Since it is a conditional reset, and it is masking slot events.
> 
> ...but pulling that string also means:
> 
> s/__pci_reset_bus/pci_try_reset_bus/

Yeah, there are a lot of refactoring opportunities here. My experience
with the pci subsystem, though, is that it is a bit conservative (and
perhaps rightfully so) on accepting refactor churn. 

> > -	mutex_unlock(&pci_slot_mutex);
> > -	return pci_bus_reset(bridge->subordinate, PCI_RESET_DO_RESET);
> > +	return __pci_reset_bridge(bridge, false);
> 
> Similar to how PCI_RESET_{DO_RESET,PROBE} makes the ambiguous
> "true/false" readable, how about adding something like:
> 
> #define PCI_SLOT_RESET_MASKED true
> #define PCI_SLOT_RESET_UNMASKED false

Sure, can do. Not sure I like the existing PROBE vs DO_RESET though. I
think the probe should just open code the checks in its own function
(which already exist) so that the DO_RESET doesn't duplicate literally
every check the preceding PROBE does. But that's a refactoring thing.

> > +	mutex_unlock(&pci_slot_mutex);
> > +
> > +	if (save)
> > +		return __pci_reset_bus(bus);
> > +	return pci_bus_reset(bridge->subordinate, PCI_RESET_DO_RESET);
> 
> Logic looks equivalent in the PCI_SLOT_RESET_UNMASKED case, I think it
> wants a comment that it turns into a "try_reset" when
> PCI_SLOT_RESET_MASKED...
> 
> > +}
> > +
> > +int pci_reset_bridge(struct pci_dev *bridge)
> > +{
> > +	return __pci_reset_bridge(bridge, true);
> > +}
> 
> ...and maybe that comment is helped by naming this helper
> pci_try_reset_bridge()?

Sounds good.
 
> I would want a second opinion on the renames before saying they are
> absolutely required.

Thanks for the reviews. I'll think on this a it and mix in your
suggestions for the next version.

> ...note I did not look at anything beyond the claims in the changelog,
> like potential unwanted knock-on effect from the new masking.

I'm more concerned about the previous patch in this series. I have no
experience with slots that can reset a subset of attached bus devices,
but apparently they exist. Not that it should cause a problem beyond
extra locking and config space access that would't be necessary, which
should just cost a few unnecessary cpu cycles.

  reply	other threads:[~2026-02-04 22:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30 16:59 [PATCHv2 0/4] pci: slot handling fixes Keith Busch
2026-01-30 16:59 ` [PATCHv2 1/4] PCI: Fix incorrect unlocking in pci_slot_trylock() Keith Busch
2026-01-30 16:59 ` [PATCHv2 2/4] pci: fix slot reset device locking Keith Busch
2026-01-30 16:59 ` [PATCHv2 3/4] pci: remove slot specific lock/unlock and save/restore Keith Busch
2026-01-31  5:58   ` dan.j.williams
2026-02-04 21:33     ` Keith Busch
2026-02-02 20:27   ` Keith Busch
2026-01-30 16:59 ` [PATCHv2 4/4] pci: make reset_subordinate hotplug safe Keith Busch
2026-01-31  6:42   ` dan.j.williams
2026-02-04 22:31     ` Keith Busch [this message]
2026-01-31  0:18 ` [PATCHv2 0/4] pci: slot handling fixes Bjorn Helgaas

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=aYPIqfS73JOxL_lu@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=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@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