[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 10/26] xen/x86: Improve disabling of features which have dependencies



On Wed, Mar 23, 2016 at 04:36:13PM +0000, Andrew Cooper wrote:
> APIC and XSAVE have dependent features, which also need disabling if Xen
> chooses to disable a feature.
> 
> Use setup_clear_cpu_cap() rather than clear_bit(), as it takes care of
> dependent features as well.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Reviewed-by: Jan Beulich <JBeulich@xxxxxxxx>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
> v2: Move boolean_param() adjacent to use_xsave in xstate_init()
> ---
>  xen/arch/x86/apic.c       |  2 +-
>  xen/arch/x86/cpu/common.c | 12 +++---------
>  xen/arch/x86/xstate.c     |  6 +++++-
>  3 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
> index b9601ad..8df5bd3 100644
> --- a/xen/arch/x86/apic.c
> +++ b/xen/arch/x86/apic.c
> @@ -1349,7 +1349,7 @@ void pmu_apic_interrupt(struct cpu_user_regs *regs)
>  int __init APIC_init_uniprocessor (void)
>  {
>      if (enable_local_apic < 0)
> -        __clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
> +        setup_clear_cpu_cap(X86_FEATURE_APIC);
>  
>      if (!smp_found_config && !cpu_has_apic) {
>          skip_ioapic_setup = 1;
> diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
> index 0942b44..b5c023f 100644
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -16,9 +16,6 @@
>  
>  #include "cpu.h"
>  
> -static bool_t use_xsave = 1;
> -boolean_param("xsave", use_xsave);
> -
>  bool_t opt_arat = 1;
>  boolean_param("arat", opt_arat);
>  
> @@ -341,12 +338,6 @@ void identify_cpu(struct cpuinfo_x86 *c)
>       if (this_cpu->c_init)
>               this_cpu->c_init(c);
>  
> -        /* Initialize xsave/xrstor features */
> -     if ( !use_xsave )
> -             __clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
> -
> -     if ( cpu_has_xsave )
> -             xstate_init(c);
>  
>       if ( !opt_pku )
>               setup_clear_cpu_cap(X86_FEATURE_PKU);
> @@ -370,6 +361,9 @@ void identify_cpu(struct cpuinfo_x86 *c)
>  
>       /* Now the feature flags better reflect actual CPU features! */
>  
> +     if ( cpu_has_xsave )
> +             xstate_init(c);
> +
>  #ifdef NOISY_CAPS
>       printk(KERN_DEBUG "CPU: After all inits, caps:");
>       for (i = 0; i < NCAPINTS; i++)
> diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
> index f649405..5060704 100644
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -502,11 +502,15 @@ unsigned int xstate_ctxt_size(u64 xcr0)
>  /* Collect the information of processor's extended state */
>  void xstate_init(struct cpuinfo_x86 *c)
>  {
> +    static bool_t __initdata use_xsave = 1;
> +    boolean_param("xsave", use_xsave);
> +
>      bool_t bsp = c == &boot_cpu_data;
>      u32 eax, ebx, ecx, edx;
>      u64 feature_mask;
>  
> -    if ( boot_cpu_data.cpuid_level < XSTATE_CPUID )
> +    if ( (bsp && !use_xsave) ||
> +         boot_cpu_data.cpuid_level < XSTATE_CPUID )
>      {
>          BUG_ON(!bsp);
>          setup_clear_cpu_cap(X86_FEATURE_XSAVE);
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.