From: "Jan Beulich" Subject: [PATCH] EPT: fix handling of super page level limit Date: Wed, 05 May 2010 16:38:40 +0100 Message-ID: <4BE1AD2002000078000016BF@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4369E410.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com 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. --=__Part4369E410.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Just like for other global VMX controls, the maximum super page level used must be globally consistent (and not change post-init). Additionally, the original patch yet again introduced a message printed on each CPU, which this patch moves to a place where it gets issued just once. Signed-off-by: Jan Beulich --- 2010-05-04.orig/xen/arch/x86/hvm/vmx/vmcs.c 2010-04-12 11:28:20.0000000= 00 +0200 +++ 2010-05-04/xen/arch/x86/hvm/vmx/vmcs.c 2010-05-05 16:28:23.0000000= 00 +0200 @@ -91,6 +91,10 @@ static void __init vmx_display_features( =20 if ( !printed ) printk(" - none\n"); + + if ( vmx_ept_super_page_level_limit ) + printk("EPT supports %s super page.\n", + vmx_ept_super_page_level_limit > 1 ? "1G" : "2M"); } =20 static u32 adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, u32 msr) @@ -114,6 +118,7 @@ static void vmx_init_vmcs_config(void) u32 _vmx_pin_based_exec_control; u32 _vmx_cpu_based_exec_control; u32 _vmx_secondary_exec_control =3D 0; + u8 ept_super_page_level_limit =3D 0; u32 _vmx_vmexit_control; u32 _vmx_vmentry_control; =20 @@ -189,15 +194,9 @@ static void vmx_init_vmcs_config(void) uint64_t cap; rdmsrl(MSR_IA32_VMX_EPT_VPID_CAP, cap); if ( cap & VMX_EPT_SUPER_PAGE_1G ) - { - vmx_ept_super_page_level_limit =3D 2; - printk("EPT support 1G super page.\n"); - } + ept_super_page_level_limit =3D 2; else if ( cap & VMX_EPT_SUPER_PAGE_2M ) - { - vmx_ept_super_page_level_limit =3D 1;=20 - printk("EPT support 2M super page.\n"); - } + ept_super_page_level_limit =3D 1; } } =20 @@ -235,6 +234,7 @@ static void vmx_init_vmcs_config(void) vmx_pin_based_exec_control =3D _vmx_pin_based_exec_control; vmx_cpu_based_exec_control =3D _vmx_cpu_based_exec_control; vmx_secondary_exec_control =3D _vmx_secondary_exec_control; + vmx_ept_super_page_level_limit =3D ept_super_page_level_limit; vmx_vmexit_control =3D _vmx_vmexit_control; vmx_vmentry_control =3D _vmx_vmentry_control; cpu_has_vmx_ins_outs_instr_info =3D !!(vmx_basic_msr_high & = (1U<<22)); @@ -247,6 +247,7 @@ static void vmx_init_vmcs_config(void) BUG_ON(vmx_pin_based_exec_control !=3D _vmx_pin_based_exec_control= ); BUG_ON(vmx_cpu_based_exec_control !=3D _vmx_cpu_based_exec_control= ); BUG_ON(vmx_secondary_exec_control !=3D _vmx_secondary_exec_control= ); + BUG_ON(vmx_ept_super_page_level_limit > ept_super_page_level_limit= ); BUG_ON(vmx_vmexit_control !=3D _vmx_vmexit_control); BUG_ON(vmx_vmentry_control !=3D _vmx_vmentry_control); BUG_ON(cpu_has_vmx_ins_outs_instr_info !=3D --=__Part4369E410.0__= Content-Type: text/plain; name="ept-super-page.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ept-super-page.patch" Just like for other global VMX controls, the maximum super page level=0Ause= d must be globally consistent (and not change post-init).=0A=0AAdditionally= , the original patch yet again introduced a message=0Aprinted on each CPU, = which this patch moves to a place where it gets=0Aissued just once.=0A=0ASi= gned-off-by: Jan Beulich =0A=0A--- 2010-05-04.orig/xen= /arch/x86/hvm/vmx/vmcs.c 2010-04-12 11:28:20.000000000 +0200=0A+++ = 2010-05-04/xen/arch/x86/hvm/vmx/vmcs.c 2010-05-05 16:28:23.000000000 = +0200=0A@@ -91,6 +91,10 @@ static void __init vmx_display_features(=0A =0A = if ( !printed )=0A printk(" - none\n");=0A+=0A+ if ( = vmx_ept_super_page_level_limit )=0A+ printk("EPT supports %s super = page.\n",=0A+ vmx_ept_super_page_level_limit > 1 ? "1G" : = "2M");=0A }=0A =0A static u32 adjust_vmx_controls(u32 ctl_min, u32 = ctl_opt, u32 msr)=0A@@ -114,6 +118,7 @@ static void vmx_init_vmcs_config(vo= id)=0A u32 _vmx_pin_based_exec_control;=0A u32 _vmx_cpu_based_exec_= control;=0A u32 _vmx_secondary_exec_control =3D 0;=0A+ u8 ept_super_= page_level_limit =3D 0;=0A u32 _vmx_vmexit_control;=0A u32 = _vmx_vmentry_control;=0A =0A@@ -189,15 +194,9 @@ static void vmx_init_vmcs_= config(void)=0A uint64_t cap;=0A rdmsrl(MSR_IA32_VM= X_EPT_VPID_CAP, cap);=0A if ( cap & VMX_EPT_SUPER_PAGE_1G = )=0A- {=0A- vmx_ept_super_page_level_limit =3D = 2;=0A- printk("EPT support 1G super page.\n");=0A- = }=0A+ ept_super_page_level_limit =3D 2;=0A = else if ( cap & VMX_EPT_SUPER_PAGE_2M )=0A- {=0A- = vmx_ept_super_page_level_limit =3D 1; =0A- printk("EPT = support 2M super page.\n");=0A- }=0A+ ept_super_p= age_level_limit =3D 1;=0A }=0A }=0A =0A@@ -235,6 +234,7 @@ = static void vmx_init_vmcs_config(void)=0A vmx_pin_based_exec_contro= l =3D _vmx_pin_based_exec_control;=0A vmx_cpu_based_exec_control = =3D _vmx_cpu_based_exec_control;=0A vmx_secondary_exec_control =3D = _vmx_secondary_exec_control;=0A+ vmx_ept_super_page_level_limit =3D = ept_super_page_level_limit;=0A vmx_vmexit_control =3D = _vmx_vmexit_control;=0A vmx_vmentry_control =3D _vmx_vmentry= _control;=0A cpu_has_vmx_ins_outs_instr_info =3D !!(vmx_basic_msr_h= igh & (1U<<22));=0A@@ -247,6 +247,7 @@ static void vmx_init_vmcs_config(voi= d)=0A BUG_ON(vmx_pin_based_exec_control !=3D _vmx_pin_based_exec_co= ntrol);=0A BUG_ON(vmx_cpu_based_exec_control !=3D _vmx_cpu_based_ex= ec_control);=0A BUG_ON(vmx_secondary_exec_control !=3D _vmx_seconda= ry_exec_control);=0A+ BUG_ON(vmx_ept_super_page_level_limit > = ept_super_page_level_limit);=0A BUG_ON(vmx_vmexit_control !=3D = _vmx_vmexit_control);=0A BUG_ON(vmx_vmentry_control !=3D _vmx_vment= ry_control);=0A BUG_ON(cpu_has_vmx_ins_outs_instr_info !=3D=0A --=__Part4369E410.0__= 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.xensource.com http://lists.xensource.com/xen-devel --=__Part4369E410.0__=--