Re: [PATCH rc] PCI: Fix nested pci_dev_reset_iommu_prepare/done()

Nicolin Chen
2026-03-18T23:35:26Z

Hi Bjorn,

On Wed, Mar 18, 2026 at 05:57:05PM -0500, Bjorn Helgaas wrote:
> On Wed, Mar 18, 2026 at 03:00:28PM -0700, Nicolin Chen wrote:
> > Shuai found that cxl_reset_bus_function() calls pci_reset_bus_function()
> > internally while both are calling pci_dev_reset_iommu_prepare/done().
> >
> > This results in a nested pci_dev_reset_iommu_prepare/done() call:
> > cxl_reset_bus_function():
> > pci_dev_reset_iommu_prepare(); // outer
> > pci_reset_bus_function():
> > pci_dev_reset_iommu_prepare(); // inner (re-entry)
> > ...
> > pci_dev_reset_iommu_done(); // inner
> > pci_dev_reset_iommu_done(); // outer
> >
> > However, pci_dev_reset_iommu_prepare() doesn't allow a re-entry for now.
> >
> > Digging further, I found that most functions in pci_dev_specific_reset()
> > except reset_ivb_igd() are calling pcie_flr() that has nested those two
> > functions as well.
> >
> > Drop the outer callbacks in:
> > - cxl_reset_bus_function()
> > - pci_dev_specific_reset()
> >
> > Replace with adding the callbacks in:
> > + reset_ivb_igd()
>
> This needs to say clearly what the issue is. Deadlock? Crash?
> Corruption?
>
> I guess it's a deadlock when the second call to
> pci_dev_reset_iommu_prepare() acquires the group->mutex?

It will trigger a WARN_ON and fail the inner reset function:
/* Re-entry is not allowed */
if (WARN_ON(group->resetting_domain))
return -EBUSY;

> Since f5b16b802174 appeared in v7.0-rc1 (merged by Joerg), I guess
> this fix also needs to be in v7.0 -- please confirm.

Yes. I marked it "PATCH rc", hoping to cover that.

I'll send a v2 explicitly mentioning the WARN_ON and -EBUSY failure.

Nicolin