x86: limit issuing of IBPB during context switch
PATCH 1/1 x86: limit issuing of IBPB during context switch
When the outgoing vCPU had IBPB issued upon entering Xen there's no need for a 2nd barrier during context switch.
xen/arch/x86/domain.c +2 -1
@@ -2098,7 +2098,8 @@ void context_switch(struct vcpu *prev, sctxt_switch_levelling (next); -if ( opt_ibpb_ctxt_switch && !is_idle_domain (nextd) ) +if ( opt_ibpb_ctxt_switch && !is_idle_domain (nextd) && + !(prevd->arch.spec_ctrl_flags & SCF_entry_ibpb) ) { static DEFINE_PER_CPU(unsigned int, last);unsigned int *last_id = &this_cpu (last);
Quoted 4 lines · Jan Beulich
When the outgoing vCPU had IBPB issued upon entering Xen there's no need for a 2nd barrier during context switch.
Signed-off-by Jan Beulich <[email protected]>
That's already accounted for by opt_ibpb_ctxt_switch conditionally being not set.
~Andrew
Quoted 8 lines · Andrew Cooper
Quoted 4 lines · Jan Beulich
When the outgoing vCPU had IBPB issued upon entering Xen there's no need for a 2nd barrier during context switch.
Signed-off-by Jan Beulich <[email protected]>That's already accounted for by
opt_ibpb_ctxt_switchconditionally being not set.
That option defaults to false only if both PV and HVM have the entry barrier turned on. In fact, if it wasn't for Dom0 I was first thinking the global could go away and only the per-domain setting could be inspected here.
Jan