From: Bjorn Helgaas <bhelgaas@google.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: print out exact timeout in pciehp for wait_cmd
Date: Mon, 22 Sep 2014 20:35:01 -0600 [thread overview]
Message-ID: <20140923023501.GO1880@google.com> (raw)
In-Reply-To: <1408756512-16885-3-git-send-email-yinghai@kernel.org>
On Fri, Aug 22, 2014 at 06:15:09PM -0700, Yinghai Lu wrote:
> debug print out should add back timeout that pass during wait event or
> polling.
>
> That now is cached vaule before wait.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> drivers/pci/hotplug/pciehp_hpc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
> +++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
> @@ -173,7 +173,7 @@ static void pcie_wait_cmd(struct control
> if (!rc)
> ctrl_info(ctrl, "Timeout on hotplug command %#010x (issued %u msec ago)\n",
> ctrl->slot_ctrl,
> - jiffies_to_msecs(now - ctrl->cmd_started));
> + jiffies_to_msecs(now - ctrl->cmd_started + timeout));
> }
>
> /**
I propose the modification below because I think it's more direct. Does it
make sense to you, or am I still missing something?
commit 83d752536aa9dfb1fddb04d6ef8c6bdc75492d4f
Author: Yinghai Lu <yinghai@kernel.org>
Date: Mon Sep 22 20:07:35 2014 -0600
PCI: pciehp: Fix wait time in timeout message
When we warned about a timeout on a hotplug command, we previously printed
the time between calls to pcie_write_cmd(), without accounting for any time
spent actually waiting. Consider this sequence:
pcie_write_cmd
write SLTCTL
cmd_started = jiffies # T1
pcie_write_cmd
pcie_wait_cmd
now = jiffies # T2
wait_event_timeout # we may wait here
if (timeout)
ctrl_info("Timeout on command issued %u msec ago",
jiffies_to_msecs(now - cmd_started))
We previously printed (T2 - T1), but that doesn't include the time spent in
wait_event_timeout().
Fix this by using the current jiffies value, not the one cached before
calling wait_event_timeout().
[bhelgaas: changelog, use current jiffies instead of adding timeout]
Fixes: 40b960831cfa ("PCI: pciehp: Compute timeout from hotplug command start time")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 9e0f4aec5f0c..3673a913379f 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -173,7 +173,7 @@ static void pcie_wait_cmd(struct controller *ctrl)
if (!rc)
ctrl_info(ctrl, "Timeout on hotplug command %#06x (issued %u msec ago)\n",
ctrl->slot_ctrl,
- jiffies_to_msecs(now - ctrl->cmd_started));
+ jiffies_to_msecs(jiffies - ctrl->cmd_started));
}
/**
next prev parent reply other threads:[~2014-09-23 2:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-23 1:15 [PATCH] PCI: add back missing MEM_64 mask check for hotplug path Yinghai Lu
2014-08-23 1:15 ` [PATCH] PCI: fix pcie_wait_cmd with poll mode timeout Yinghai Lu
2014-09-23 2:29 ` Bjorn Helgaas
2014-08-23 1:15 ` [PATCH] PCI: print out exact timeout in pciehp for wait_cmd Yinghai Lu
2014-09-23 2:35 ` Bjorn Helgaas [this message]
2014-09-24 1:53 ` Yinghai Lu
2014-08-23 1:15 ` [PATCH] PCI: don't release sibiling bridge resources during hotplug Yinghai Lu
2014-09-03 23:35 ` Bjorn Helgaas
2014-08-23 1:15 ` [PATCH] PCI: more debug printout for pcie_write_cmd in pciehp Yinghai Lu
2014-09-23 2:51 ` Bjorn Helgaas
2014-08-23 1:15 ` [PATCH] PCI: remove not needed pcie_disable_notification Yinghai Lu
2014-09-23 2:53 ` Bjorn Helgaas
2014-09-30 20:35 ` [PATCH] PCI: add back missing MEM_64 mask check for hotplug path Bjorn Helgaas
2014-10-01 5:06 ` Yinghai Lu
2014-10-01 20:07 ` Bjorn Helgaas
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=20140923023501.GO1880@google.com \
--to=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=yinghai@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).