x86: avoid explicit TLB flush when saving exec state
authorJan Beulich <jbeulich@suse.com>
Wed, 24 Jan 2018 16:59:22 +0000 (17:59 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 24 Jan 2018 16:59:22 +0000 (17:59 +0100)
Now that it's obvious that only a single dirty CPU can exist for a vCPU,
it becomes clear that flush_mask() doesn't need to be invoked when
sync_local_execstate() was already run. And with the IPI handler
clearing FLUSH_TLB from the passed flags anyway if
__sync_local_execstate() returns true, it also becomes clear that
FLUSH_TLB doesn't need to be passed here in the first place; neither of
the two places actually have a need to flush the TLB in any event (quite
possibly FLUSH_TLB was being passed there solely for flush_area_mask()
to make it past its no-op check).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/domain.c

index d3b6b3c675bf90f9b61f697fbaf0b537f4a3fb7b..cc8d7b029bf4c03476fef3490627564783293a0c 100644 (file)
@@ -1693,7 +1693,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
     if ( unlikely(dirty_cpu != cpu) && dirty_cpu != VCPU_CPU_CLEAN )
     {
         /* Remote CPU calls __sync_local_execstate() from flush IPI handler. */
-        flush_mask(cpumask_of(dirty_cpu), FLUSH_TLB | FLUSH_VCPU_STATE);
+        flush_mask(cpumask_of(dirty_cpu), FLUSH_VCPU_STATE);
     }
 
     if ( prev != next )
@@ -1800,11 +1800,10 @@ void sync_vcpu_execstate(struct vcpu *v)
 {
     if ( v->dirty_cpu == smp_processor_id() )
         sync_local_execstate();
-
-    if ( vcpu_cpu_dirty(v) )
+    else if ( vcpu_cpu_dirty(v) )
     {
         /* Remote CPU calls __sync_local_execstate() from flush IPI handler. */
-        flush_mask(cpumask_of(v->dirty_cpu), FLUSH_TLB | FLUSH_VCPU_STATE);
+        flush_mask(cpumask_of(v->dirty_cpu), FLUSH_VCPU_STATE);
     }
 }