Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1718040

[PATCH V12 1/5] PCI: Don't ignore valid response before CRS timeout

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From Sinan Kaya <okaya@codeaurora.org>
Newsgroups linux.kernel
Subject [PATCH V12 1/5] PCI: Don't ignore valid response before CRS timeout
Date Wed, 23 Aug 2017 07:00:01 +0200
Message-ID <uhvVL-4pb-5@gated-at.bofh.it> (permalink)
X-Original-To linux-pci@vger.kernel.org, timur@codeaurora.org, alex.williamson@redhat.com
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503464176; bh=K70AuNQZATZbVji4X69+sUcnX7fd/Jf8kcDV5r57vwE=; h=From:To:Cc:Subject:Date:From; b=YXPSAJek/klWcnlbP+gS4x55wnVP5U81sad12b9GMFDUqgzBQ3WGbjnTJl7bFO/kK fubZbR0cJaspkN2Hyv1JDRwG4r3usPh2r2eRgP7vDLHrXSOSd+S+b/KFM6gKc4lsBI mCsmHko9menaTqLSbluXJ19uBtPSPVrc9p6jFmDg=
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503464176; bh=K70AuNQZATZbVji4X69+sUcnX7fd/Jf8kcDV5r57vwE=; h=From:To:Cc:Subject:Date:From; b=YXPSAJek/klWcnlbP+gS4x55wnVP5U81sad12b9GMFDUqgzBQ3WGbjnTJl7bFO/kK fubZbR0cJaspkN2Hyv1JDRwG4r3usPh2r2eRgP7vDLHrXSOSd+S+b/KFM6gKc4lsBI mCsmHko9menaTqLSbluXJ19uBtPSPVrc9p6jFmDg=
Dmarc-Filter OpenDMARC Filter v1.3.2 smtp.codeaurora.org 42C1E603D2
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
X-Mailer git-send-email 1.9.1
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 51
Organization linux.* mail to news gateway
X-Original-Cc linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bjorn Helgaas <bhelgaas@google.com>, Sinan Kaya <okaya@codeaurora.org>, linux-kernel@vger.kernel.org
X-Original-Date Wed, 23 Aug 2017 00:56:07 -0400
X-Original-Message-ID <1503464171-6471-1-git-send-email-okaya@codeaurora.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1718040

Show key headers only | View raw


From: Bjorn Helgaas <bhelgaas@google.com>

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>
[okaya: reorder reads so that we check device presence after sleep]
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/pci/probe.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c31310d..2849e0e 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1847,17 +1847,18 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 		if (!crs_timeout)
 			return false;
 
-		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. */
 		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;
 	}
 
 	return true;
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH V12 1/5] PCI: Don't ignore valid response before CRS timeout Sinan Kaya <okaya@codeaurora.org> - 2017-08-23 07:00 +0200

csiph-web