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-devel

[Xen-devel] [PATCH] mini-os: select call incorrectly reports xce_handle

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] mini-os: select call incorrectly reports xce_handle as ready
From: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
Date: Wed, 23 Jul 2008 18:01:12 +0100
Delivery-date: Wed, 23 Jul 2008 10:01:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)
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>
---
diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c
+++ b/tools/libxc/xc_minios.c
@@ -287,22 +287,28 @@
 
 evtchn_port_or_error_t xc_evtchn_pending(int xce_handle)
 {
     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;
-       }
+        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;
+            }
+        }
     }
-    files[xce_handle].read = 0;
     local_irq_restore(flags);
-    return -1;
+    return ret;
 }
 
 int xc_evtchn_unmask(int xce_handle, evtchn_port_t port)
 {
     unmask_evtchn(port);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] mini-os: select call incorrectly reports xce_handle as ready, Diego Ongaro <=