From patchwork Wed Aug 23 04:56:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9916557 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B6C560327 for ; Wed, 23 Aug 2017 04:56:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D77428864 for ; Wed, 23 Aug 2017 04:56:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21E4A28953; Wed, 23 Aug 2017 04:56:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C56C728864 for ; Wed, 23 Aug 2017 04:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbdHWE4e (ORCPT ); Wed, 23 Aug 2017 00:56:34 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53398 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753311AbdHWE4W (ORCPT ); Wed, 23 Aug 2017 00:56:22 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9E64760725; Wed, 23 Aug 2017 04:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503464181; bh=JQM9CWR6QUnkPdTtXqrc+jSkfOz/XPcx6pydBYpfI+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=es1wXNh6B3SAnjzfIsc1VrHRI89mDavbiW383uBZ4Ye5rs+kgtgWi/J9LpTl5nQfo 0nP43w7fTaqAMv5hjl/LP1301f84xIaCqAcEg4kG+XeCJrcPXf+bTVhicTjrnJW8uN 1s+ubrlly6Sg9oJvQEuZnHqnS+Tz6QWDUm4fQNbM= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 82EAB60722; Wed, 23 Aug 2017 04:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1503464181; bh=JQM9CWR6QUnkPdTtXqrc+jSkfOz/XPcx6pydBYpfI+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=es1wXNh6B3SAnjzfIsc1VrHRI89mDavbiW383uBZ4Ye5rs+kgtgWi/J9LpTl5nQfo 0nP43w7fTaqAMv5hjl/LP1301f84xIaCqAcEg4kG+XeCJrcPXf+bTVhicTjrnJW8uN 1s+ubrlly6Sg9oJvQEuZnHqnS+Tz6QWDUm4fQNbM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 82EAB60722 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 From: Sinan Kaya To: linux-pci@vger.kernel.org, timur@codeaurora.org, alex.williamson@redhat.com Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Bjorn Helgaas , linux-kernel@vger.kernel.org Subject: [PATCH V12 5/5] PCI: Warn periodically while waiting for device to become ready Date: Wed, 23 Aug 2017 00:56:11 -0400 Message-Id: <1503464171-6471-5-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503464171-6471-1-git-send-email-okaya@codeaurora.org> References: <1503464171-6471-1-git-send-email-okaya@codeaurora.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a print statement in pci_bus_wait_crs() so that user observes the progress of device polling instead of silently waiting for timeout to be reached. Signed-off-by: Sinan Kaya [bhelgaas: check for timeout first so we don't print "waiting, giving up", always print time we've slept (not the actual timeout, print a "ready" message if we've printed a "waiting" message] Signed-off-by: Bjorn Helgaas --- drivers/pci/probe.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 93b89dd..4b30df7 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1841,11 +1841,16 @@ bool pci_bus_wait_crs(struct pci_bus *bus, int devfn, u32 l, int timeout) */ while ((l & 0xffff) == 0x0001) { if (delay > timeout) { - printk(KERN_WARNING "pci %04x:%02x:%02x.%d: not responding\n", - pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), - PCI_FUNC(devfn)); + pr_warn("pci %04x:%02x:%02x.%d: not ready after %dms; giving up\n", + pci_domain_nr(bus), bus->number, + PCI_SLOT(devfn), PCI_FUNC(devfn), delay - 1); + return false; } + if (delay >= 1000) + pr_info("pci %04x:%02x:%02x.%d: not ready after %dms; waiting\n", + pci_domain_nr(bus), bus->number, + PCI_SLOT(devfn), PCI_FUNC(devfn), delay - 1); msleep(delay); delay *= 2; @@ -1854,6 +1859,11 @@ bool pci_bus_wait_crs(struct pci_bus *bus, int devfn, u32 l, int timeout) return false; } + if (delay >= 1000) + pr_info("pci %04x:%02x:%02x.%d: ready after %dms\n", + pci_domain_nr(bus), bus->number, + PCI_SLOT(devfn), PCI_FUNC(devfn), delay - 1); + return true; }