All of lore.kernel.org
 help / color / mirror / Atom feed
From: Farhan Ali <alifm@linux.ibm.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: sashiko-reviews@lists.linux.dev, linux-pci@vger.kernel.org,
	Alex Williamson <alex@shazbot.org>
Subject: Re: [PATCH v18 3/3] PCI: Fail FLR when config space is inaccessible
Date: Wed, 10 Jun 2026 14:56:48 -0700	[thread overview]
Message-ID: <49059c51-e61b-48b2-81a9-2e164e0bd763@linux.ibm.com> (raw)
In-Reply-To: <20260610200249.GA388221@bhelgaas>


On 6/10/2026 1:02 PM, Bjorn Helgaas wrote:
> [+cc Alex]
>
> On Wed, Jun 10, 2026 at 09:51:55AM -0700, Farhan Ali wrote:
>> On 6/9/2026 3:33 PM, Bjorn Helgaas wrote:
>>> On Wed, Jun 03, 2026 at 06:57:36PM +0000, sashiko-bot@kernel.org wrote:
>>>> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
>>>>
>>>> Pre-existing issues:
>> ...
>>>>> +++ b/drivers/pci/pci.c
>>>>> @@ -4396,6 +4396,9 @@ int pcie_reset_flr(struct pci_dev *dev, bool probe)
>>>>>    	if (!(dev->devcap & PCI_EXP_DEVCAP_FLR))
>>>>>    		return -ENOTTY;
>>>>> +	if (!pci_dev_config_accessible(dev, "FLR"))
>>>>> +		return -ENOTTY;
>>>>> +
>>>> [Severity: High]
>>>> This isn't a bug introduced by this patch, but does placing this
>>>> check in pcie_reset_flr() leave direct callers of pcie_flr()
>>>> exposed to 60-second hangs?
>>>>
>>>> Direct callers of pcie_flr() (like network and storage drivers
>>>> during error recovery) bypass this wrapper. They will still
>>>> experience a stall in pci_dev_wait() when attempting to reset a
>>>> device with an inaccessible config space. Should this
>>>> accessibility check be moved into pcie_flr() instead to protect
>>>> all callers?
>>> I can't remember why we have both pcie_reset_flr() and pcie_flr(),
>>> other than the fact that callers don't need to supply a "probe"
>>> argument to pcie_flr().
>>>
>>> Is there a reason to call pci_dev_config_accessible() here rather
>>> than in pcie_flr()?
>> The reason we wanted the check in pcie_reset_flr() was so to be able
>> to escalate to bus reset method if we can't do an FLR. I think the
>> check could be moved to pcie_flr(). Is that more preferable?
> What if we added a preliminary patch that folds the body of pcie_flr()
> into pcie_reset_flr() and adds:
>
>    #define pcie_flr(dev)	pcie_reset_flr(dev, PCI_RESET_DO_RESET)
>
> That would mean pcie_flr() users would start paying attention to
> PCI_DEV_FLAGS_NO_FLR_RESET and PCI_EXP_DEVCAP_FLR, which seems like a
> good thing.

Looking at the history, it seems commit 56f107d7813f ("PCI: Add 
pcie_reset_flr() with 'probe' argument") added pcie_reset_flr() to add 
the probe and remove pcie_has_flr(). It also notes that callers of 
pcie_flr() that didn't call pcie_has_flr() remain. I guess it didn't 
want to change the drivers that called pcie_flr() unconditionally?

There is also reset_intel_82599_sfp_virtfn() that mentions the need to 
FLR without checking for FLR support due to some quirk. So I wonder if 
there were genuine reasons to avoid doing the check for 
PCI_DEV_FLAGS_NO_FLR_RESET and PCI_EXP_DEVCAP_FLR?

Thanks

Farhan


  reply	other threads:[~2026-06-10 21:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 18:16 [PATCH v18 0/3] [PCI] Error recovery for vfio-pci devices on s390x Farhan Ali
2026-06-03 18:16 ` [PATCH v18 1/3] PCI: Allow per function PCI slots to fix slot reset on s390 Farhan Ali
2026-06-03 18:33   ` sashiko-bot
2026-06-03 18:16 ` [PATCH v18 2/3] PCI: Avoid saving config space state if inaccessible Farhan Ali
2026-06-03 18:16 ` [PATCH v18 3/3] PCI: Fail FLR when config space is inaccessible Farhan Ali
2026-06-03 18:57   ` sashiko-bot
2026-06-09 22:33     ` Bjorn Helgaas
2026-06-10 16:51       ` Farhan Ali
2026-06-10 20:02         ` Bjorn Helgaas
2026-06-10 21:56           ` Farhan Ali [this message]
2026-06-11 19:22             ` Bjorn Helgaas
2026-06-11 23:29               ` Farhan Ali
2026-06-12 15:44                 ` Bjorn Helgaas
2026-06-10 23:44         ` Bjorn Helgaas
2026-06-11 18:22           ` Farhan Ali

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=49059c51-e61b-48b2-81a9-2e164e0bd763@linux.ibm.com \
    --to=alifm@linux.ibm.com \
    --cc=alex@shazbot.org \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.