From: "Jan Beulich" Subject: [PATCH] Revert "VMX: flush cache when vmentry back to UC guest" Date: Wed, 04 Dec 2013 16:46:35 +0000 Message-ID: <529F6A7B020000780010A30F@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part82B1427B.3__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VoFb1-0006b5-13 for xen-devel@lists.xenproject.org; Wed, 04 Dec 2013 16:46:43 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Jinsong Liu , Keir Fraser , George Dunlap , Andrew Cooper , Eddie Dong , Jun Nakajima List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part82B1427B.3__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 =20 - if ( unlikely(curr->arch.hvm_vcpu.cache_mode =3D=3D NO_FILL_CACHE_MODE= ) ) - curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory =3D 1; - while ( todo > 0 ) { count =3D min_t(int, PAGE_SIZE - (addr & ~PAGE_MASK), todo); @@ -2680,9 +2677,6 @@ static enum hvm_copy_result __hvm_clear( return HVMCOPY_unhandleable; #endif =20 - if ( unlikely(curr->arch.hvm_vcpu.cache_mode =3D=3D NO_FILL_CACHE_MODE= ) ) - curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory =3D 1; - while ( todo > 0 ) { count =3D 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); } =20 - /* For guest cr0.cd setting, do not use potentially polluted cache */ - if ( unlikely(v->arch.hvm_vcpu.cache_mode =3D=3D 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; =20 - /* 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 =3D 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 { =20 /* Which cache mode is this VCPU in (CR0:CD/NW)? */ u8 cache_mode; - bool_t hypervisor_access_uc_hvm_memory; =20 struct hvm_vcpu_io hvm_io; =20 --=__Part82B1427B.3__= Content-Type: text/plain; name="xsa60-4-revert.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xsa60-4-revert.patch" Revert "VMX: flush cache when vmentry back to UC guest"=0A=0AThis reverts = commit 86d60e85 as well as one related change from=0A62652c00 ("VMX: fix = cr0.cd handling"), on the basis that all of this=0Aflushing is still = insufficient and, while not known to fix anything, is=0Aknown to negatively= affect performance.=0A=0ASigned-off-by: Jan Beulich =0A= =0A--- a/xen/arch/x86/hvm/hvm.c=0A+++ b/xen/arch/x86/hvm/hvm.c=0A@@ = -2566,9 +2566,6 @@ static enum hvm_copy_result __hvm_copy(=0A = return HVMCOPY_unhandleable;=0A #endif=0A =0A- if ( unlikely(curr->arch.= hvm_vcpu.cache_mode =3D=3D NO_FILL_CACHE_MODE) )=0A- curr->arch.hvm_= vcpu.hypervisor_access_uc_hvm_memory =3D 1;=0A-=0A while ( todo > 0 = )=0A {=0A count =3D min_t(int, PAGE_SIZE - (addr & ~PAGE_MASK),= todo);=0A@@ -2680,9 +2677,6 @@ static enum hvm_copy_result __hvm_clear(=0A= return HVMCOPY_unhandleable;=0A #endif=0A =0A- if ( unlikely(cu= rr->arch.hvm_vcpu.cache_mode =3D=3D NO_FILL_CACHE_MODE) )=0A- = curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory =3D 1;=0A-=0A = while ( todo > 0 )=0A {=0A count =3D min_t(int, PAGE_SIZE - = (addr & ~PAGE_MASK), todo);=0A--- a/xen/arch/x86/hvm/vmx/vmx.c=0A+++ = b/xen/arch/x86/hvm/vmx/vmx.c=0A@@ -643,10 +643,6 @@ static void vmx_ctxt_sw= itch_to(struct vc=0A __invept(INVEPT_SINGLE_CONTEXT, ept_get_ep= tp(ept_data), 0);=0A }=0A =0A- /* For guest cr0.cd setting, do not = use potentially polluted cache */=0A- if ( unlikely(v->arch.hvm_vcpu.cac= he_mode =3D=3D NO_FILL_CACHE_MODE) )=0A- wbinvd();=0A-=0A = vmx_restore_guest_msrs(v);=0A vmx_restore_dr(v);=0A }=0A@@ -2999,13 = +2995,6 @@ void vmx_vmenter_helper(const struct cpu=0A struct = hvm_vcpu_asid *p_asid;=0A bool_t need_flush;=0A =0A- /* In case = hypervisor access hvm memory when guest uc mode */=0A- if ( unlikely(cur= r->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory) )=0A- {=0A- = curr->arch.hvm_vcpu.hypervisor_access_uc_hvm_memory =3D 0;=0A- = wbinvd();=0A- }=0A-=0A if ( !cpu_has_vmx_vpid )=0A goto = out;=0A if ( nestedhvm_vcpu_in_guestmode(curr) )=0A--- a/xen/include/as= m-x86/hvm/vcpu.h=0A+++ b/xen/include/asm-x86/hvm/vcpu.h=0A@@ -169,7 +169,6 = @@ struct hvm_vcpu {=0A =0A /* Which cache mode is this VCPU in = (CR0:CD/NW)? */=0A u8 cache_mode;=0A- bool_t = hypervisor_access_uc_hvm_memory;=0A =0A struct hvm_vcpu_io = hvm_io;=0A =0A --=__Part82B1427B.3__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part82B1427B.3__=--