WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] pcifront poll loop now checks gettimeofday rather than j

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] pcifront poll loop now checks gettimeofday rather than jiffies,
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 Mar 2006 12:36:07 +0000
Delivery-date: Thu, 16 Mar 2006 12:37:14 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 00aba64e034e70a262cbe3b729b3601ce8142eda
# Parent  1569bc48b0b8cbe7504c225752f7d36b8df2e537
pcifront poll loop now checks gettimeofday rather than jiffies,
as the latter does not increase while interrupts are disabled.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 1569bc48b0b8 -r 00aba64e034e 
linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c
--- a/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c        Wed Mar 15 
19:25:50 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pcifront/pci_op.c        Thu Mar 16 
11:31:16 2006
@@ -40,8 +40,10 @@
 {
        int err = 0;
        struct xen_pci_op *active_op = &pdev->sh_info->op;
-       unsigned long irq_flags, poll_end;
+       unsigned long irq_flags;
        evtchn_port_t port = pdev->evtchn;
+       nsec_t ns, ns_timeout;
+       struct timeval tv;
 
        spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
 
@@ -52,15 +54,25 @@
        set_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags);
        notify_remote_via_evtchn(port);
 
-       poll_end = jiffies + 5*HZ;
+       /*
+        * We set a poll timeout of 5 seconds but give up on return after
+        * 4 seconds. It is better to time out too late rather than too early
+        * (in the latter case we end up continually re-executing poll() with a
+        * timeout in the past). 1s difference gives plenty of slack for error.
+        */
+       do_gettimeofday(&tv);
+       ns_timeout = timeval_to_ns(&tv) + 4 * (nsec_t)NSEC_PER_SEC;
+
        clear_evtchn(port);
 
        while (test_bit(_XEN_PCIF_active,
                        (unsigned long *)&pdev->sh_info->flags)) {
-               if (HYPERVISOR_poll(&port, 1, poll_end))
+               if (HYPERVISOR_poll(&port, 1, jiffies + 5*HZ))
                        BUG();
                clear_evtchn(port);
-               if (time_after(jiffies, poll_end)) {
+               do_gettimeofday(&tv);
+               ns = timeval_to_ns(&tv);
+               if (ns > ns_timeout) {
                        dev_err(&pdev->xdev->dev,
                                "pciback not responding!!!\n");
                        clear_bit(_XEN_PCIF_active,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] pcifront poll loop now checks gettimeofday rather than jiffies,, Xen patchbot -unstable <=