Revert "VMX: flush cache when vmentry back to UC guest" This reverts commit 86d60e85 as well as one related change from 62652c00 ("VMX: fix cr0.cd handling"), on the basis that all of this flushing is still insufficient and, while not known to fix anything, is known to negatively affect performance. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -2566,9 +2566,6 @@ static enum hvm_copy_result __hvm_copy( return HVMCOPY_unhandleable; #endif - if ( unlikely(curr->arch.hvm_vcpu.cache_mode == NO_FILL_CACHE_MODE) ) - curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory = 1; - while ( todo > 0 ) { count = min_t(int, PAGE_SIZE - (addr & ~PAGE_MASK), todo); @@ -2680,9 +2677,6 @@ static enum hvm_copy_result __hvm_clear( return HVMCOPY_unhandleable; #endif - if ( unlikely(curr->arch.hvm_vcpu.cache_mode == NO_FILL_CACHE_MODE) ) - curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory = 1; - while ( todo > 0 ) { count = min_t(int, PAGE_SIZE - (addr & ~PAGE_MASK), todo); --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -643,10 +643,6 @@ static void vmx_ctxt_switch_to(struct vc __invept(INVEPT_SINGLE_CONTEXT, ept_get_eptp(ept_data), 0); } - /* For guest cr0.cd setting, do not use potentially polluted cache */ - if ( unlikely(v->arch.hvm_vcpu.cache_mode == NO_FILL_CACHE_MODE) ) - wbinvd(); - vmx_restore_guest_msrs(v); vmx_restore_dr(v); } @@ -2999,13 +2995,6 @@ void vmx_vmenter_helper(const struct cpu struct hvm_vcpu_asid *p_asid; bool_t need_flush; - /* In case hypervisor access hvm memory when guest uc mode */ - if ( unlikely(curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory) ) - { - curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory = 0; - wbinvd(); - } - if ( !cpu_has_vmx_vpid ) goto out; if ( nestedhvm_vcpu_in_guestmode(curr) ) --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -169,7 +169,6 @@ struct hvm_vcpu { /* Which cache mode is this VCPU in (CR0:CD/NW)? */ u8 cache_mode; - bool_t hypervisor_access_uc_hvm_memory; struct hvm_vcpu_io hvm_io;