Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] mini-os: select call incorrectly reports

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] mini-os: select call incorrectly reports xce_handle as ready
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jul 2008 13:50:10 -0700
Delivery-date: Thu, 24 Jul 2008 13:50:05 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216905107 -3600
# Node ID 16ba99f816a33eaf31c710fe372f46ad89155f1c
# Parent  6604234057f63449cfd53f06c2e81f5977756b9e
mini-os: select call incorrectly reports xce_handle as ready

The current implementation in minios of xc_evtchn_pending doesn't set
read=0 when there is exactly one port pending. This resulted in
select() incorrectly reporting the file descriptor as ready.

Signed-off-by: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 tools/libxc/xc_minios.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff -r 6604234057f6 -r 16ba99f816a3 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c   Thu Jul 24 14:10:45 2008 +0100
+++ b/tools/libxc/xc_minios.c   Thu Jul 24 14:11:47 2008 +0100
@@ -292,18 +292,24 @@ evtchn_port_or_error_t xc_evtchn_pending
 {
     int i;
     unsigned long flags;
+    evtchn_port_t ret = -1;
+
     local_irq_save(flags);
+    files[xce_handle].read = 0;
     for (i = 0; i < MAX_EVTCHN_PORTS; i++) {
-       evtchn_port_t port = files[xce_handle].evtchn.ports[i].port;
-       if (port != -1 && files[xce_handle].evtchn.ports[i].pending) {
-           files[xce_handle].evtchn.ports[i].pending = 0;
-           local_irq_restore(flags);
-           return port;
-       }
-    }
-    files[xce_handle].read = 0;
+        evtchn_port_t port = files[xce_handle].evtchn.ports[i].port;
+        if (port != -1 && files[xce_handle].evtchn.ports[i].pending) {
+            if (ret == -1) {
+                ret = port;
+                files[xce_handle].evtchn.ports[i].pending = 0;
+            } else {
+                files[xce_handle].read = 1;
+                break;
+            }
+        }
+    }
     local_irq_restore(flags);
-    return -1;
+    return ret;
 }
 
 int xc_evtchn_unmask(int xce_handle, evtchn_port_t port)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] mini-os: select call incorrectly reports xce_handle as ready, Xen patchbot-unstable <=