From: Lukas Wunner <lukas@wunner.de>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
oohall@gmail.com, Chris Chiu <chris.chiu@canonical.com>,
Sathyanarayanan Kuppuswamy
<sathyanarayanan.kuppuswamy@linux.intel.com>,
Ashok Raj <ashok.raj@intel.com>,
Sheng Bi <windy.bi.enflame@gmail.com>,
Ravi Kishore Koppuravuri <ravi.kishore.koppuravuri@intel.com>,
Stanislav Spassov <stanspas@amazon.de>,
Yang Su <yang.su@linux.alibaba.com>,
shuo.tan@linux.alibaba.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3] PCI/PM: Bail out early in pci_bridge_wait_for_secondary_bus() if link is not trained
Date: Sun, 16 Apr 2023 09:48:46 +0200 [thread overview]
Message-ID: <20230416074846.GA14021@wunner.de> (raw)
In-Reply-To: <20230414101147.GA66750@black.fi.intel.com>
On Fri, Apr 14, 2023 at 01:11:47PM +0300, Mika Westerberg wrote:
> To summarize the v4 patch would look something like below. Only compile
> tested but I will run real testing later today. I think it now includes
> the 1s optimization and also checking of the active link reporting
> support for the devices behind slow links. Let me know is I missed
> something.
The patch seems to be based on a branch which has the v3 patch applied
instead of on pci.git/reset, and that makes it slightly more difficult
to review, but from a first glance it LGTM.
> It is getting rather complex unfortunately :(
I disagree. :) Basically the Gen1/Gen2 situation becomes a special case
because it has specific timing requirements (need to observe a delay
before accessing the Secondary Bus, instead of waiting for the link)
and it doesn't necessarily support link active reporting. So special
casing it seems fair to me.
> - * However, 100 ms is the minimum and the PCIe spec says the
> - * software must allow at least 1s before it can determine that the
> - * device that did not respond is a broken device. There is
> - * evidence that 100 ms is not always enough, for example certain
> - * Titan Ridge xHCI controller does not always respond to
> - * configuration requests if we only wait for 100 ms (see
> - * https://bugzilla.kernel.org/show_bug.cgi?id=203885).
> + * However, 100 ms is the minimum and the PCIe spec says the software
> + * must allow at least 1s before it can determine that the device that
> + * did not respond is a broken device. Also device can take longer than
> + * that to respond if it indicates so through Request Retry Status
> + * completions.
It *might* be worth avoiding the rewrapping of the first 3 lines to
make the patch smaller, your choice.
> +
> + /*
> + * If the port supports active link reporting we now check one
> + * more time if the link is active and if not bail out early
> + * with the assumption that the device is not present anymore.
> + */
Nit: Drop the "one more time" because it seems this is actually the
first time the link is checked.
Somewhat tangentially, I note that pcie_wait_for_link_delay() has a
"if (!pdev->link_active_reporting)" branch right at its top, however
pci_bridge_wait_for_secondary_bus() only calls the function in the
Gen3+ (> 5 GT/s) case, which always supports link active reporting.
Thus the branch is never taken when pcie_wait_for_link_delay() is called
from pci_bridge_wait_for_secondary_bus(). There's only one other caller,
pcie_wait_for_link(). So moving the "if (!pdev->link_active_reporting)"
branch to pcie_wait_for_link() *might* make the code more readable.
Just a thought.
Thanks,
Lukas
next prev parent reply other threads:[~2023-04-16 7:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 10:16 [PATCH v3] PCI/PM: Bail out early in pci_bridge_wait_for_secondary_bus() if link is not trained Mika Westerberg
2023-04-13 14:16 ` Sathyanarayanan Kuppuswamy
2023-04-14 7:42 ` Lukas Wunner
2023-04-14 10:11 ` Mika Westerberg
2023-04-16 7:48 ` Lukas Wunner [this message]
2023-04-17 6:07 ` Mika Westerberg
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=20230416074846.GA14021@wunner.de \
--to=lukas@wunner.de \
--cc=ashok.raj@intel.com \
--cc=bhelgaas@google.com \
--cc=chris.chiu@canonical.com \
--cc=linux-pci@vger.kernel.org \
--cc=mahesh@linux.ibm.com \
--cc=mika.westerberg@linux.intel.com \
--cc=oohall@gmail.com \
--cc=ravi.kishore.koppuravuri@intel.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=shuo.tan@linux.alibaba.com \
--cc=stanspas@amazon.de \
--cc=windy.bi.enflame@gmail.com \
--cc=yang.su@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox