[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [MINIOS] Improved unbind_all_ports().



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 27a5a62552c039c2d35379095e04c41a0aa34991
# Parent  5adde07b4b8a9b01ec98fe37db18487a8c1f39d7
[MINIOS] Improved unbind_all_ports().
Signed-off-by: Jacob Gorm Hansen <jacobg@xxxxxxx>
---
 extras/mini-os/events.c         |   27 +++++++++++++++------------
 extras/mini-os/include/events.h |    1 +
 2 files changed, 16 insertions(+), 12 deletions(-)

diff -r 5adde07b4b8a -r 27a5a62552c0 extras/mini-os/events.c
--- a/extras/mini-os/events.c   Thu Nov 30 17:14:09 2006 +0000
+++ b/extras/mini-os/events.c   Thu Nov 30 17:17:28 2006 +0000
@@ -31,26 +31,27 @@ typedef struct _ev_action_t {
     u32 count;
 } ev_action_t;
 
-
 static ev_action_t ev_actions[NR_EVS];
 void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data);
+
+static unsigned long bound_ports[NR_EVS/(8*sizeof(unsigned long))];
 
 void unbind_all_ports(void)
 {
     int i;
 
-       for(i=0;i<NR_EVS;i++)
-       {
-               if(ev_actions[i].handler != default_handler)
-               {
-                       struct evtchn_close close;
-                       mask_evtchn(i);
-                       close.port = i;
-                       HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
-               }
-       }
+    for (i = 0; i < NR_EVS; i++)
+    {
+        if (test_and_clear_bit(i, bound_ports))
+        {
+            struct evtchn_close close;
+            mask_evtchn(i);
+            close.port = i;
+            HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
+        }
+    }
 }
-
+  
 /*
  * Demux events to different handlers.
  */
@@ -114,6 +115,7 @@ int bind_virq(uint32_t virq, evtchn_hand
                printk("Failed to bind virtual IRQ %d\n", virq);
                return 1;
     }
+    set_bit(op.port,bound_ports);
     bind_evtchn(op.port, handler, data);
        return 0;
 }
@@ -188,6 +190,7 @@ int evtchn_bind_interdomain(domid_t pal,
     int err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &op);
     if (err)
                return err;
+    set_bit(op.local_port,bound_ports);
        evtchn_port_t port = op.local_port;
     clear_evtchn(port);              /* Without, handler gets invoked now! */
     *local_port = bind_evtchn(port, handler, data);
diff -r 5adde07b4b8a -r 27a5a62552c0 extras/mini-os/include/events.h
--- a/extras/mini-os/include/events.h   Thu Nov 30 17:14:09 2006 +0000
+++ b/extras/mini-os/include/events.h   Thu Nov 30 17:17:28 2006 +0000
@@ -36,6 +36,7 @@ int evtchn_bind_interdomain(domid_t pal,
 int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port,
                                                        evtchn_handler_t 
handler, void *data,
                                                        evtchn_port_t 
*local_port);
+void unbind_all_ports(void);
 
 static inline int notify_remote_via_evtchn(evtchn_port_t port)
 {

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.