Jan Beulich
2013-Dec-04 16:46 UTC
[PATCH] 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 <jbeulich@suse.com> --- 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; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
George Dunlap
2013-Dec-04 16:54 UTC
Re: [PATCH] Revert "VMX: flush cache when vmentry back to UC guest"
On 12/04/2013 04:46 PM, Jan Beulich wrote:> 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 <jbeulich@suse.com>Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com> -George
Liu, Jinsong
2013-Dec-04 16:55 UTC
Re: [PATCH] Revert "VMX: flush cache when vmentry back to UC guest"
Jan Beulich wrote:> 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 <jbeulich@suse.com>Acked-by: Liu Jinsong <jinsong.liu@intel.com>> > --- 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;
Dong, Eddie
2013-Dec-05 03:20 UTC
Re: [PATCH] Revert "VMX: flush cache when vmentry back to UC guest"
Acked by Eddie Dong <eddie.dong@intel.com> -----Original Message----- From: Jan Beulich [mailto:JBeulich@suse.com] Sent: Thursday, December 05, 2013 12:47 AM To: xen-devel Cc: Andrew Cooper; George Dunlap; Dong, Eddie; Liu, Jinsong; Nakajima, Jun; Keir Fraser Subject: [PATCH] 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 <jbeulich@suse.com> --- 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;