[XEN] Abstract setting of master event-pending flag into asm/event.h.
authorkfraser@dhcp93.uk.xensource.com <kfraser@dhcp93.uk.xensource.com>
Wed, 14 Jun 2006 12:48:04 +0000 (13:48 +0100)
committerkfraser@dhcp93.uk.xensource.com <kfraser@dhcp93.uk.xensource.com>
Wed, 14 Jun 2006 12:48:04 +0000 (13:48 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/traps.c
xen/common/event_channel.c
xen/include/asm-ia64/event.h
xen/include/asm-x86/event.h

index 031ee87e4ff2419e54c7185971d6c8d055907e10..9da6f65c5bf07ae22ea9e65dc8b9abc193f601bd 100644 (file)
@@ -1279,7 +1279,7 @@ asmlinkage int do_general_protection(struct cpu_user_regs *regs)
 static void nmi_softirq(void)
 {
     /* Only used to defer wakeup of dom0,vcpu0 to a safe (non-NMI) context. */
-    evtchn_notify(dom0->vcpu[0]);
+    vcpu_kick(dom0->vcpu[0]);
 }
 
 static void nmi_dom0_report(unsigned int reason_idx)
index bad68023f689e451b4fa9e80ee17fc889107ef6e..d10da394967faf832ef1afef349e78cc12b9a11d 100644 (file)
@@ -493,10 +493,9 @@ void evtchn_set_pending(struct vcpu *v, int port)
 
     if ( !test_bit        (port, s->evtchn_mask) &&
          !test_and_set_bit(port / BITS_PER_LONG,
-                           &v->vcpu_info->evtchn_pending_sel) &&
-         !test_and_set_bit(0, &v->vcpu_info->evtchn_upcall_pending) )
+                           &v->vcpu_info->evtchn_pending_sel) )
     {
-        evtchn_notify(v);
+        vcpu_mark_events_pending(v);
     }
     
     /* Check if some VCPU might be polling for this event. */
@@ -682,10 +681,9 @@ static long evtchn_unmask(evtchn_unmask_t *unmask)
     if ( test_and_clear_bit(port, s->evtchn_mask) &&
          test_bit          (port, s->evtchn_pending) &&
          !test_and_set_bit (port / BITS_PER_LONG,
-                            &v->vcpu_info->evtchn_pending_sel) &&
-         !test_and_set_bit (0, &v->vcpu_info->evtchn_upcall_pending) )
+                            &v->vcpu_info->evtchn_pending_sel) )
     {
-        evtchn_notify(v);
+        vcpu_mark_events_pending(v);
     }
 
     spin_unlock(&d->evtchn_lock);
index ae51c69eab400d57fc6831ac5f5d97cee9ec7c31..19113a56e0cd8bc409519c52158db6d5bd1a1a88 100644 (file)
@@ -12,7 +12,7 @@
 #include <public/arch-ia64.h>
 #include <asm/vcpu.h>
 
-static inline void evtchn_notify(struct vcpu *v)
+static inline void vcpu_kick(struct vcpu *v)
 {
     /*
      * NB1. 'vcpu_flags' and 'processor' must be checked /after/ update of
@@ -32,6 +32,12 @@ static inline void evtchn_notify(struct vcpu *v)
         vcpu_pend_interrupt(v, v->domain->shared_info->arch.evtchn_vector);
 }
 
+static inline void vcpu_mark_events_pending(struct vcpu *v)
+{
+    if ( !test_and_set_bit(0, &v->vcpu_info->evtchn_upcall_pending) )
+        vcpu_kick(v);
+}
+
 /* Note: Bitwise operations result in fast code with no branches. */
 #define event_pending(v)                        \
     (!!(v)->vcpu_info->evtchn_upcall_pending &  \
index c5b3c4526e7817a489082849a060097c7cb66b73..7085bd31380390fc590e6423b7e2521588a927ea 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __ASM_EVENT_H__
 #define __ASM_EVENT_H__
 
-static inline void evtchn_notify(struct vcpu *v)
+static inline void vcpu_kick(struct vcpu *v)
 {
     /*
      * NB1. 'vcpu_flags' and 'processor' must be checked /after/ update of
@@ -26,6 +26,12 @@ static inline void evtchn_notify(struct vcpu *v)
         smp_send_event_check_cpu(v->processor);
 }
 
+static inline void vcpu_mark_events_pending(struct vcpu *v)
+{
+    if ( !test_and_set_bit(0, &v->vcpu_info->evtchn_upcall_pending) )
+        vcpu_kick(v);
+}
+
 static inline int local_events_need_delivery(void)
 {
     struct vcpu *v = current;