From: kfraser@dhcp93.uk.xensource.com Date: Wed, 14 Jun 2006 12:48:04 +0000 (+0100) Subject: [XEN] Abstract setting of master event-pending flag into asm/event.h. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15955^2~9 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a5e28e588e5d34af10013ecf45786dc90ce0afac;p=xen.git [XEN] Abstract setting of master event-pending flag into asm/event.h. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 031ee87e4f..9da6f65c5b 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -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) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index bad68023f6..d10da39496 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -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); diff --git a/xen/include/asm-ia64/event.h b/xen/include/asm-ia64/event.h index ae51c69eab..19113a56e0 100644 --- a/xen/include/asm-ia64/event.h +++ b/xen/include/asm-ia64/event.h @@ -12,7 +12,7 @@ #include #include -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 & \ diff --git a/xen/include/asm-x86/event.h b/xen/include/asm-x86/event.h index c5b3c4526e..7085bd3138 100644 --- a/xen/include/asm-x86/event.h +++ b/xen/include/asm-x86/event.h @@ -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;