Message ID | f036c2e9a6d81670d22edfc3b872773fc5ea3d6c.1508397860.git.yi.z.zhang@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Oct 19, 2017 at 2:11 AM, Zhang Yi <yi.z.zhang@linux.intel.com> wrote: > From: Zhang Yi Z <yi.z.zhang@linux.intel.com> > > Current we only support Sub-page Protection on the 4k > page table. > > Signed-off-by: Zhang Yi Z <yi.z.zhang@linux.intel.com> > --- > xen/arch/x86/hvm/vmx/vmx.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c > index 04ae0d6..a4c24bb 100644 > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -2497,6 +2497,12 @@ const struct hvm_function_table * __init start_vmx(void) > vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; > } > > + if ( cpu_has_vmx_ept_spp ) I think this really only ought to happen if the command-line option has also been enabled. > + { > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_2MB; > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_1GB; > + } > + > setup_vmcs_dump(); > > lbr_tsx_fixup_check(); > -- > 2.7.4
On 2017-10-19 at 12:17:12 -0600, Tamas K Lengyel wrote: > On Thu, Oct 19, 2017 at 2:11 AM, Zhang Yi <yi.z.zhang@linux.intel.com> wrote: > > From: Zhang Yi Z <yi.z.zhang@linux.intel.com> > > > > Current we only support Sub-page Protection on the 4k > > page table. > > > > Signed-off-by: Zhang Yi Z <yi.z.zhang@linux.intel.com> > > --- > > xen/arch/x86/hvm/vmx/vmx.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c > > index 04ae0d6..a4c24bb 100644 > > --- a/xen/arch/x86/hvm/vmx/vmx.c > > +++ b/xen/arch/x86/hvm/vmx/vmx.c > > @@ -2497,6 +2497,12 @@ const struct hvm_function_table * __init start_vmx(void) > > vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; > > } > > > > + if ( cpu_has_vmx_ept_spp ) > > I think this really only ought to happen if the command-line option > has also been enabled. Sorry, didn't catch your point, the command line option opt_hap_2m and opt_hap_1G was enable by default, I need to disable the supper page when spp feature enabled. Did you mean that if we enable 2M/1G by command-line we couldn't disable it here? yes, it is, I will improve this logic. Thank you Tamas. > > > + { > > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_2MB; > > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_1GB; > > + } > > + > > setup_vmcs_dump(); > > > > lbr_tsx_fixup_check(); > > -- > > 2.7.4
On Fri, Oct 20, 2017 at 2:44 AM, Yi Zhang <yi.z.zhang@linux.intel.com> wrote: > On 2017-10-19 at 12:17:12 -0600, Tamas K Lengyel wrote: >> On Thu, Oct 19, 2017 at 2:11 AM, Zhang Yi <yi.z.zhang@linux.intel.com> wrote: >> > From: Zhang Yi Z <yi.z.zhang@linux.intel.com> >> > >> > Current we only support Sub-page Protection on the 4k >> > page table. >> > >> > Signed-off-by: Zhang Yi Z <yi.z.zhang@linux.intel.com> >> > --- >> > xen/arch/x86/hvm/vmx/vmx.c | 6 ++++++ >> > 1 file changed, 6 insertions(+) >> > >> > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c >> > index 04ae0d6..a4c24bb 100644 >> > --- a/xen/arch/x86/hvm/vmx/vmx.c >> > +++ b/xen/arch/x86/hvm/vmx/vmx.c >> > @@ -2497,6 +2497,12 @@ const struct hvm_function_table * __init start_vmx(void) >> > vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; >> > } >> > >> > + if ( cpu_has_vmx_ept_spp ) >> >> I think this really only ought to happen if the command-line option >> has also been enabled. > > Sorry, didn't catch your point, the command line option opt_hap_2m and > opt_hap_1G was enable by default, I need to disable the supper page > when spp feature enabled. Did you mean that if we enable 2M/1G by > command-line we couldn't disable it here? yes, it is, I will improve > this logic. Thank you Tamas. I meant that right now "cpu_has_vmx_ept_spp" looks like just checks whether the CPU supports SPP, not whether the command-line option was set to enable it. If the command line option is not set (or specifically disables SPP) then the large pages shouldn't get disabled. > >> >> > + { >> > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_2MB; >> > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_1GB; >> > + } >> > + >> > setup_vmcs_dump(); >> > >> > lbr_tsx_fixup_check(); >> > -- >> > 2.7.4
On Wed, Oct 25, 2017 at 9:32 AM, Yi Zhang <yi.z.zhang@linux.intel.com> wrote: > On 2017-10-24 at 11:43:45 -0600, Tamas K Lengyel wrote: >> On Fri, Oct 20, 2017 at 2:44 AM, Yi Zhang <yi.z.zhang@linux.intel.com> wrote: >> > On 2017-10-19 at 12:17:12 -0600, Tamas K Lengyel wrote: >> >> On Thu, Oct 19, 2017 at 2:11 AM, Zhang Yi <yi.z.zhang@linux.intel.com> wrote: >> >> > From: Zhang Yi Z <yi.z.zhang@linux.intel.com> >> >> > >> >> > Current we only support Sub-page Protection on the 4k >> >> > page table. >> >> > >> >> > Signed-off-by: Zhang Yi Z <yi.z.zhang@linux.intel.com> >> >> > --- >> >> > xen/arch/x86/hvm/vmx/vmx.c | 6 ++++++ >> >> > 1 file changed, 6 insertions(+) >> >> > >> >> > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c >> >> > index 04ae0d6..a4c24bb 100644 >> >> > --- a/xen/arch/x86/hvm/vmx/vmx.c >> >> > +++ b/xen/arch/x86/hvm/vmx/vmx.c >> >> > @@ -2497,6 +2497,12 @@ const struct hvm_function_table * __init start_vmx(void) >> >> > vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; >> >> > } >> >> > >> >> > + if ( cpu_has_vmx_ept_spp ) >> >> >> >> I think this really only ought to happen if the command-line option >> >> has also been enabled. >> > >> > Sorry, didn't catch your point, the command line option opt_hap_2m and >> > opt_hap_1G was enable by default, I need to disable the supper page >> > when spp feature enabled. Did you mean that if we enable 2M/1G by >> > command-line we couldn't disable it here? yes, it is, I will improve >> > this logic. Thank you Tamas. >> >> I meant that right now "cpu_has_vmx_ept_spp" looks like just checks >> whether the CPU supports SPP, not whether the command-line option was >> set to enable it. If the command line option is not set (or >> specifically disables SPP) then the large pages shouldn't get >> disabled. >> > > In patch 02/14, if we didn't set spp_enable, we will not set the spp cap > in vmx_secondary_exec_control, so cp_has_vmx_ept_spp flag will set when > hardware has spp cap and xen cmdlline passed the parameter "spp_enable=1" OK, thanks, I missed that. > >> > >> >> >> >> > + { >> >> > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_2MB; >> >> > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_1GB; >> >> > + } >> >> > + >> >> > setup_vmcs_dump(); >> >> > >> >> > lbr_tsx_fixup_check(); >> >> > -- >> >> > 2.7.4
On 2017-10-24 at 11:43:45 -0600, Tamas K Lengyel wrote: > On Fri, Oct 20, 2017 at 2:44 AM, Yi Zhang <yi.z.zhang@linux.intel.com> wrote: > > On 2017-10-19 at 12:17:12 -0600, Tamas K Lengyel wrote: > >> On Thu, Oct 19, 2017 at 2:11 AM, Zhang Yi <yi.z.zhang@linux.intel.com> wrote: > >> > From: Zhang Yi Z <yi.z.zhang@linux.intel.com> > >> > > >> > Current we only support Sub-page Protection on the 4k > >> > page table. > >> > > >> > Signed-off-by: Zhang Yi Z <yi.z.zhang@linux.intel.com> > >> > --- > >> > xen/arch/x86/hvm/vmx/vmx.c | 6 ++++++ > >> > 1 file changed, 6 insertions(+) > >> > > >> > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c > >> > index 04ae0d6..a4c24bb 100644 > >> > --- a/xen/arch/x86/hvm/vmx/vmx.c > >> > +++ b/xen/arch/x86/hvm/vmx/vmx.c > >> > @@ -2497,6 +2497,12 @@ const struct hvm_function_table * __init start_vmx(void) > >> > vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; > >> > } > >> > > >> > + if ( cpu_has_vmx_ept_spp ) > >> > >> I think this really only ought to happen if the command-line option > >> has also been enabled. > > > > Sorry, didn't catch your point, the command line option opt_hap_2m and > > opt_hap_1G was enable by default, I need to disable the supper page > > when spp feature enabled. Did you mean that if we enable 2M/1G by > > command-line we couldn't disable it here? yes, it is, I will improve > > this logic. Thank you Tamas. > > I meant that right now "cpu_has_vmx_ept_spp" looks like just checks > whether the CPU supports SPP, not whether the command-line option was > set to enable it. If the command line option is not set (or > specifically disables SPP) then the large pages shouldn't get > disabled. > In patch 02/14, if we didn't set spp_enable, we will not set the spp cap in vmx_secondary_exec_control, so cp_has_vmx_ept_spp flag will set when hardware has spp cap and xen cmdlline passed the parameter "spp_enable=1" > > > >> > >> > + { > >> > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_2MB; > >> > + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_1GB; > >> > + } > >> > + > >> > setup_vmcs_dump(); > >> > > >> > lbr_tsx_fixup_check(); > >> > -- > >> > 2.7.4
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 04ae0d6..a4c24bb 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2497,6 +2497,12 @@ const struct hvm_function_table * __init start_vmx(void) vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs; } + if ( cpu_has_vmx_ept_spp ) + { + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_2MB; + vmx_function_table.hap_capabilities &= ~HVM_HAP_SUPERPAGE_1GB; + } + setup_vmcs_dump(); lbr_tsx_fixup_check();