Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1716530
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Sinan Kaya <okaya@codeaurora.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v11 1/4] PCI: Don't ignore valid response before CRS timeout |
| Date | Mon, 21 Aug 2017 16:10:05 +0200 |
| Message-ID | <ugVyZ-5o7-71@gated-at.bofh.it> (permalink) |
| References | <ufX9L-Un-3@gated-at.bofh.it> <ufX9M-Un-11@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503324178; bh=KdJsclzRdGWQgriRI7DeFF7cDYXAwlOp++6lClZXJaw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=RxhBUVHlhBD/zKx3+ShDD7zNQdVp+51IHKIRtTIKUC6risKpUG5DPQ23yy8wQ+SMZ +SsR6or8F/pnjlFp96BLSV5zG1J9+ibB7b63NKtqUJ7m4Ean2a/5dsrfcq6lQgvxDG VyqmMMNFqBITxMoFOOQcn1Yqbdsa2FNSZvr4Y6Bk= |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503324177; bh=KdJsclzRdGWQgriRI7DeFF7cDYXAwlOp++6lClZXJaw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Fr6yk3VePTMAo7khKGxAjItTLcV3AmYcwdD1g8mXpPUMfLGdmZGuGoMRqB27MNqTk SsRStmUjk2MQL6O+sMMZ0+8sWLN8VzD5mpK2Ui5uIEdbPe0t8VWL6SCBPlQcVmbjOr OWYyUJhjEgmX8yVp9BItDn/KDYlPEvBLaKquesgo= |
| Dmarc-Filter | OpenDMARC Filter v1.3.2 smtp.codeaurora.org C2A8D60376 |
| Authentication-Results | pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org |
| Authentication-Results | pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Language | en-US |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 73 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-pci@vger.kernel.org, Timur Tabi <timur@codeaurora.org>, linux-kernel@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com>, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org |
| X-Original-Date | Mon, 21 Aug 2017 10:02:55 -0400 |
| X-Original-Message-ID | <f7127748-24cd-37bd-544a-8cba6bf5906d@codeaurora.org> |
| X-Original-References | <20170818212310.15145.21732.stgit@bhelgaas-glaptop.roam.corp.google.com> <20170818213203.15145.36487.stgit@bhelgaas-glaptop.roam.corp.google.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1716530 |
Show key headers only | View raw
On 8/18/2017 5:32 PM, Bjorn Helgaas wrote:
> While waiting for a device to become ready (i.e., to return a non-CRS
> completion to a read of its Vendor ID), if we got a valid response to the
> very last read before timing out, we printed a warning and gave up on the
> device even though it was actually ready.
>
> For a typical 60s timeout, we wait about 65s (it's not exact because of the
> exponential backoff), but we treated devices that became ready between 33s
> and 65s as though they failed.
>
> Move the Device ID read later so we check whether the device is ready
> immediately, before checking for a timeout.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/probe.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index c31310db0404..08ea844ac4ba 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1849,15 +1849,16 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
>
> msleep(delay);
> delay *= 2;
> - if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))
> - return false;
> - /* Card hasn't responded in 60 seconds? Must be stuck. */
> +
There is still a problem here. We'll wait some time above and return without checking if
we actually found the card or not.
> if (delay > crs_timeout) {
> printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not responding\n",
> pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
> PCI_FUNC(devfn));
> return false;
> }
> +
> + if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))
> + return false;
> }
>
> return true;
>
>
Here is another shot at it. Sorry, I don't have a diff syntax. I made up the function
by copy paste.
while ((*l & 0xffff) == 0x0001) {
if (!crs_timeout)
return false;
/* Card hasn't responded in 60 seconds? Must be stuck. */
if (delay > crs_timeout) {
printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not responding\n",
pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
PCI_FUNC(devfn));
return false;
}
msleep(delay);
delay *= 2;
if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))
return false;
}
--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v11 1/4] PCI: Don't ignore valid response before CRS timeout Bjorn Helgaas <bhelgaas@google.com> - 2017-08-18 23:40 +0200
Re: [PATCH v11 1/4] PCI: Don't ignore valid response before CRS timeout Sinan Kaya <okaya@codeaurora.org> - 2017-08-21 16:10 +0200
Re: [PATCH v11 1/4] PCI: Don't ignore valid response before CRS timeout Bjorn Helgaas <helgaas@kernel.org> - 2017-08-21 19:50 +0200
csiph-web