[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 02/10] x86/vmx: add IPT cpu feature
On Tue, Jun 30, 2020 at 02:33:45PM +0200, Michał Leszczyński wrote: > From: Michal Leszczynski <michal.leszczynski@xxxxxxx> > > Check if Intel Processor Trace feature is supported by current > processor. Define vmtrace_supported global variable. > > Signed-off-by: Michal Leszczynski <michal.leszczynski@xxxxxxx> > --- > xen/arch/x86/hvm/vmx/vmcs.c | 7 ++++++- > xen/common/domain.c | 2 ++ > xen/include/asm-x86/cpufeature.h | 1 + > xen/include/asm-x86/hvm/vmx/vmcs.h | 1 + > xen/include/public/arch-x86/cpufeatureset.h | 1 + > xen/include/xen/domain.h | 2 ++ > 6 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c > index ca94c2bedc..b73d824357 100644 > --- a/xen/arch/x86/hvm/vmx/vmcs.c > +++ b/xen/arch/x86/hvm/vmx/vmcs.c > @@ -291,6 +291,12 @@ static int vmx_init_vmcs_config(void) > _vmx_cpu_based_exec_control &= > ~(CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING); > > + rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap); > + > + /* Check whether IPT is supported in VMX operation. */ > + vmtrace_supported = cpu_has_ipt && > + (_vmx_misc_cap & VMX_MISC_PT_SUPPORTED); This function gets called for every CPU that's brought up, so you need to set it on the BSP, and then check that the APs also support the feature or else fail to bring them up AFAICT. If not you could end up with a non working system. I agree it's very unlikely to boot on a system with such differences between CPUs, but better be safe than sorry. > + > if ( _vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS > ) > { > min = 0; > @@ -305,7 +311,6 @@ static int vmx_init_vmcs_config(void) > SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS | > SECONDARY_EXEC_XSAVES | > SECONDARY_EXEC_TSC_SCALING); > - rdmsrl(MSR_IA32_VMX_MISC, _vmx_misc_cap); > if ( _vmx_misc_cap & VMX_MISC_VMWRITE_ALL ) > opt |= SECONDARY_EXEC_ENABLE_VMCS_SHADOWING; > if ( opt_vpid_enabled ) > diff --git a/xen/common/domain.c b/xen/common/domain.c > index 7cc9526139..0a33e0dfd6 100644 > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -82,6 +82,8 @@ struct vcpu *idle_vcpu[NR_CPUS] __read_mostly; > > vcpu_info_t dummy_vcpu_info; > > +bool_t vmtrace_supported; Plain bool, and I think it wants to be __read_mostly. I'm also unsure whether this is the best place to put such variable, since there are no users introduced on this patch it's hard to tell. Thanks, Roger.
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |