All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Yury M." <yurypm@arista.com>
Cc: Lukas Wunner <lukas@wunner.de>,
	bhelgaas@google.com,  linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	 James Sewart <jamessewart@arista.com>
Subject: Re: [PATCH] PCI: Stop waiting for link status after config read failure
Date: Fri, 4 Sep 2026 23:20:03 +0300 (EEST)	[thread overview]
Message-ID: <4186a2bb-2f4d-e536-0acf-cfa4994e2cb4@linux.intel.com> (raw)
In-Reply-To: <6f916404-63b5-40a3-a429-befe42a08629@arista.com>

[-- Attachment #1: Type: text/plain, Size: 1626 bytes --]

On Fri, 4 Sep 2026, Yury M. wrote:

> what to you think about this check:
> if ((pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnksta) || 
> PCI_POSSIBLE_ERROR(lnksta)) && pci_dev_is_disconnected(pdev))
>     return -ENODEV;

Apparently you're ignoring my feedback. :-(

--
 i.
 
> On 9/4/26 13:20, Lukas Wunner wrote:
> > On Fri, Sep 04, 2026 at 11:13:18AM +0000, Yury Murashka wrote:
> > > With a nested PCIe topology with multiple layers of hotplug, a link can go
> > > down near the bottom of the topology shortly before a link above it goes
> > > down. In that case, pcie_wait_for_link_status() can wait for the full
> > > timeout while every read of the link status register fails because the
> > > device has disappeared.
> > > 
> > > Return immediately when reading the link status fails so event processing
> > > can continue.
> > [...]
> > > +++ b/drivers/pci/pci.c
> > > @@ -4580,7 +4581,8 @@ static int pcie_wait_for_link_status(struct pci_dev
> > > *pdev,
> > >     	end_jiffies = jiffies +
> > > msecs_to_jiffies(PCIE_LINK_RETRAIN_TIMEOUT_MS);
> > >   	do {
> > > -		pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnksta);
> > > +		if (pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnksta))
> > > +			return -ENODEV;
> > >   		if ((lnksta & lnksta_mask) == lnksta_match)
> > >   			return 0;
> > >   		msleep(1);
> > It might be clearer if you check for pci_dev_is_disconnected() directly
> > instead of relying on a PCIBIOS_DEVICE_NOT_FOUND return value which is
> > generated as a side effect of the device being gone.
> > 
> > Thanks,
> > 
> > Lukas
> 
> 

  reply	other threads:[~2026-09-04 20:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 11:13 [PATCH] PCI: Stop waiting for link status after config read failure Yury Murashka
2026-09-04 11:28 ` sashiko-bot
2026-09-04 11:59 ` Ilpo Järvinen
2026-09-04 12:20 ` Lukas Wunner
2026-09-04 15:36   ` Yury M.
2026-09-04 20:20     ` Ilpo Järvinen [this message]
2026-09-05 10:06     ` Lukas Wunner
2026-09-09 13:15       ` Yury M.
2026-09-07 12:38 ` [PATCH v2] " Yury Murashka
2026-09-07 12:53   ` sashiko-bot

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=4186a2bb-2f4d-e536-0acf-cfa4994e2cb4@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=jamessewart@arista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=yurypm@arista.com \
    /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.