diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-08-11 16:48:36 +0000 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-08-11 16:48:36 +0000 |
commit | a606f89f0e99a4eefced04faa58118240bbf5b45 (patch) | |
tree | c6a1a3cd98c349d50314248a0986e1638f22e64f /xen/include/xen/event.h | |
parent | 4afea39c562671f07d648fc6474d707bf8b93a44 (diff) | |
download | xen-a606f89f0e99a4eefced04faa58118240bbf5b45.tar.gz xen-a606f89f0e99a4eefced04faa58118240bbf5b45.tar.bz2 xen-a606f89f0e99a4eefced04faa58118240bbf5b45.zip |
Clean up event-channel notification code in Xen.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/include/xen/event.h')
-rw-r--r-- | xen/include/xen/event.h | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h index 05683344ca..8f527b0c83 100644 --- a/xen/include/xen/event.h +++ b/xen/include/xen/event.h @@ -26,30 +26,14 @@ static inline void evtchn_set_pending(struct vcpu *v, int port) { struct domain *d = v->domain; shared_info_t *s = d->shared_info; - int running; - /* These three operations must happen in strict order. */ + /* These four operations must happen in strict order. */ if ( !test_and_set_bit(port, &s->evtchn_pending[0]) && !test_bit (port, &s->evtchn_mask[0]) && - !test_and_set_bit(port>>5, &v->vcpu_info->evtchn_pending_sel) ) + !test_and_set_bit(port>>5, &v->vcpu_info->evtchn_pending_sel) && + !test_and_set_bit(0, &v->vcpu_info->evtchn_upcall_pending) ) { - /* The VCPU pending flag must be set /after/ update to evtchn-pend. */ - set_bit(0, &v->vcpu_info->evtchn_upcall_pending); evtchn_notify(v); - - /* - * NB1. 'vcpu_flags' and 'processor' must be checked /after/ update of - * pending flag. These values may fluctuate (after all, we hold no - * locks) but the key insight is that each change will cause - * evtchn_upcall_pending to be polled. - * - * NB2. We save VCPUF_running across the unblock to avoid a needless - * IPI for domains that we IPI'd to unblock. - */ - running = test_bit(_VCPUF_running, &v->vcpu_flags); - vcpu_unblock(v); - if ( running ) - smp_send_event_check_cpu(v->processor); } } @@ -73,8 +57,9 @@ static inline void send_guest_virq(struct vcpu *v, int virq) */ extern void send_guest_pirq(struct domain *d, int pirq); -#define event_pending(_d) \ - ((_d)->vcpu_info->evtchn_upcall_pending && \ - !(_d)->vcpu_info->evtchn_upcall_mask) +/* Note: Bitwise operations result in fast code with no branches. */ +#define event_pending(v) \ + ((v)->vcpu_info->evtchn_upcall_pending & \ + ~(v)->vcpu_info->evtchn_upcall_mask) #endif /* __XEN_EVENT_H__ */ |