]> git.hungrycats.org Git - linux/commitdiff
PCI: pciehp: Fix wait time in timeout message
authorYinghai Lu <yinghai@kernel.org>
Tue, 23 Sep 2014 02:07:35 +0000 (20:07 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2014 10:29:23 +0000 (12:29 +0200)
commit d433889cd5a0933fbd90f1e65bff5a8d7963cc52 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/hotplug/pciehp_hpc.c

index 2a412fa3b338f4b8399685c5b46e43a4e925871a..af91077d35139a18fd16c5d141229ac4376dc3b7 100644 (file)
@@ -173,7 +173,7 @@ static void pcie_wait_cmd(struct controller *ctrl)
        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(jiffies - ctrl->cmd_started));
 }
 
 /**