# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Node ID d128d12ca992b6d0dc8b5577de2fbc4299bfcfd0 # Parent ae245d35457b03f680b994437bd25532b98aa523 evtchn_do_upcall() has a micro optimization which is depends on that xchg is a barrier. However xchg of IA64 has acquire semantics so that event channel notification is lost sometimes. This patch fixes it. PATCHNAME: memory_barrier_evtchn_do_upcall Signed-off-by: Isaku Yamahata diff -r ae245d35457b -r d128d12ca992 linux-2.6-xen-sparse/drivers/xen/core/evtchn.c --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Wed Jun 28 13:59:29 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c Thu Jun 29 14:40:04 2006 +0900 @@ -217,9 +217,8 @@ asmlinkage void evtchn_do_upcall(struct shared_info_t *s = HYPERVISOR_shared_info; vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; - vcpu_info->evtchn_upcall_pending = 0; - - /* NB. No need for a barrier here -- XCHG is a barrier on x86. */ + evtchn_clear_upcall_pending(vcpu_info); + l1 = xchg(&vcpu_info->evtchn_pending_sel, 0); while (l1 != 0) { l1i = __ffs(l1); diff -r ae245d35457b -r d128d12ca992 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Wed Jun 28 13:59:29 2006 +0100 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h Thu Jun 29 14:40:04 2006 +0900 @@ -63,6 +63,14 @@ extern start_info_t *xen_start_info; /* Force a proper event-channel callback from Xen. */ void force_evtchn_callback(void); +/* evtchn_do_upcall() in drivers/xen/core/evtchn.c */ +static inline void +evtchn_clear_upcall_pending(vcpu_info_t* vcpu_info) +{ + vcpu_info->evtchn_upcall_pending = 0; + /* NB. No need for a barrier here -- XCHG is a barrier on x86. */ +} + /* arch/xen/kernel/process.c */ void xen_cpu_idle (void); diff -r ae245d35457b -r d128d12ca992 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Wed Jun 28 13:59:29 2006 +0100 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Thu Jun 29 14:40:04 2006 +0900 @@ -61,6 +61,13 @@ extern start_info_t *xen_start_info; void force_evtchn_callback(void); +/* evtchn_do_upcall() in drivers/xen/core/evtchn.c */ +static inline void +evtchn_clear_upcall_pending(vcpu_info_t* vcpu_info) +{ + clear_bit(0, &vcpu_info->evtchn_upcall_pending); +} + /* Turn jiffies into Xen system time. XXX Implement me. */ #define jiffies_to_st(j) 0