ia64/xen-unstable

changeset 19560:423a7f500059

x86: fix next->vcpu_dirty_cpumask checking in context_switch()

There was a timing window where flush_tlb_mask() could be called with
an empty mask (triggering a WARN_ON() in send_IPI_mask_flat() along
with APIC errors) because rather than using the already taken snapshot
of next's vcpu_dirty_cpumask struct vcpu's field was used directly,
which can get its only bit cleared by remote CPUs.

Replacing the structure field's use by the local variable then made
the inner cpus_empty() check completely redundant with the one in the
surrounding if()'s condition.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 20 14:56:31 2009 +0100 (2009-04-20)
parents cc2267c6d53b
children 69ba67bdbf93
files xen/arch/x86/domain.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Mon Apr 20 13:48:31 2009 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Mon Apr 20 14:56:31 2009 +0100
     1.3 @@ -1308,8 +1308,7 @@ void context_switch(struct vcpu *prev, s
     1.4      if ( unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask)) )
     1.5      {
     1.6          /* Other cpus call __sync_lazy_execstate from flush ipi handler. */
     1.7 -        if ( !cpus_empty(next->vcpu_dirty_cpumask) )
     1.8 -            flush_tlb_mask(next->vcpu_dirty_cpumask);
     1.9 +        flush_tlb_mask(dirty_mask);
    1.10      }
    1.11  
    1.12      if ( is_hvm_vcpu(prev) && !list_empty(&prev->arch.hvm_vcpu.tm_list) )