All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Qiang Yu <qiang.yu@oss.qualcomm.com>
Cc: Will Deacon <will@kernel.org>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Krzysztof Wilczy??ski <kwilczynski@kernel.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Nirmal Patel <nirmal.patel@linux.intel.com>,
	Jonathan Derrick <jonathan.derrick@linux.dev>,
	Frank Li <Frank.Li@nxp.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC v2] PCI: pciehp: Fix AB-BA deadlocks between reset_lock, pci_rescan_remove_lock and pci_slot_mutex
Date: Tue, 1 Dec 2026 12:24:49 +0100	[thread overview]
Message-ID: <aw6ugQV7LFWBq3cw@wunner.de> (raw)
In-Reply-To: <aw6he+/Vplrh036p@hu-qianyu-lv.qualcomm.com>

On Tue, Dec 01, 2026 at 02:29:15AM -0800, Qiang Yu wrote:
> On Sun, Nov 29, 2026 at 10:06:33PM +0100, Lukas Wunner wrote:
> > On Thu, Nov 26, 2026 at 12:26:45AM -0800, Qiang Yu wrote:
> > > A Root Port reset from link-down recovery takes them the other way
> > > round, pci_rescan_remove_lock -> reset_lock (the boot path, via
> > > pci_host_probe(), takes the same reverse order):
> > > 
> > >   qcom_pcie_global_irq_thread()
> > >     pci_host_handle_link_down()
> > >       pci_host_reset_root_port()
> > >         pci_lock_rescan_remove()               # pci_rescan_remove_lock
> > >         pci_bus_error_reset()
> > >           pci_reset_bridge()
> > >             pci_slot_reset()
> > >               pci_reset_hotplug_slot()
> > >                 pciehp_reset_slot()            # down_write(reset_lock)
> > 
> > Why is it necessary to lock rescan/remove for a reset?
> > This looks wrong.  I suggest removing pci_lock_rescan_remove()
> > from pci_host_reset_root_port().
> 
> It's needed because on qcom the reset goes through host->reset_root_port()
> -> qcom_pcie_reset_root_port() which powers down the PHY, disables clocks
> and regulators before re-training. So a concurrent bus scan would access
> config space and lead to NOC error in that window.

Doesn't that apply to *any* access to the devices during reset?
Why prevent a bus scan specifically?

If this is Qualcomm-specific, why is it in a generic helper?

If the Root Port is hotplug-capable, pciehp is prevented from
de-enumeration and re-enumeration by the mechanism introduced by
2af781a9edc4, so why acquire an extra lock to prevent the same thing?

I assume the NOC error causes an NMI?  Shouldn't the NMI handler catch
that and handle it gracefully?

Thanks,

Lukas

      reply	other threads:[~2026-12-01 11:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  8:26 [PATCH RFC v2] PCI: pciehp: Fix AB-BA deadlocks between reset_lock, pci_rescan_remove_lock and pci_slot_mutex Qiang Yu
2026-11-26  8:52 ` sashiko-bot
2026-11-29 21:06 ` Lukas Wunner
2026-12-01  9:08   ` Paul Cercueil
2026-12-01 10:08     ` Lukas Wunner
2026-12-01 10:50       ` Paul Cercueil
2026-12-01 10:29   ` Qiang Yu
2026-12-01 11:24     ` Lukas Wunner [this message]

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=aw6ugQV7LFWBq3cw@wunner.de \
    --to=lukas@wunner.de \
    --cc=Frank.Li@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=jonathan.derrick@linux.dev \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=nirmal.patel@linux.intel.com \
    --cc=qiang.yu@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=will@kernel.org \
    /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.