lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 25 Dec 2008 14:46:12 -0800
From:	"Yinghai Lu" <yinghai@...nel.org>
To:	"Rusty Russell" <rusty@...tcorp.com.au>
Cc:	"Ingo Molnar" <mingo@...e.hu>, "Hugh Dickins" <hugh@...itas.com>,
	"Stephen Rothwell" <sfr@...b.auug.org.au>,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: linux-next: parsing mem=700M broken

On Thu, Dec 25, 2008 at 3:40 AM, Rusty Russell <rusty@...tcorp.com.au> wrote:
> On Wednesday 24 December 2008 18:39:04 Yinghai Lu wrote:
>> for cpu caps on boot cpu setup still need
>
> OK, how about these?  I cleaned up description a little, and put
> it in own function.

looks good.

YH

>
> Subject: [PATCH] x86: clean up setup_clear/force_cpu_cap handling
> From: Yinghai Lu <yinghai.lu@...nel.org>
>
> Impact: fix and cleanup
>
> setup_force_cpu_cap() only has one user (xen) but it should not reuse
> cleared_cpu_cpus.  It will have problems for smp.
>
> Need to have cpu_cpus_set array too, and need to combine it before
> we AND into boot_cpu_data.x86_capability.
>
> Signed-off-by: Yinghai Lu <yinghai.lu@...nel.org>
> Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
> ---
>  arch/x86/include/asm/cpufeature.h |    4 ++--
>  arch/x86/include/asm/processor.h  |    3 ++-
>  arch/x86/kernel/cpu/common.c      |   17 ++++++++++++-----
>  3 files changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
> --- a/arch/x86/include/asm/cpufeature.h
> +++ b/arch/x86/include/asm/cpufeature.h
> @@ -188,11 +188,11 @@ extern const char * const x86_power_flag
>  #define clear_cpu_cap(c, bit)  clear_bit(bit, (unsigned long *)((c)->x86_capability))
>  #define setup_clear_cpu_cap(bit) do { \
>        clear_cpu_cap(&boot_cpu_data, bit);     \
> -       set_bit(bit, (unsigned long *)cleared_cpu_caps); \
> +       set_bit(bit, (unsigned long *)cpu_caps_cleared); \
>  } while (0)
>  #define setup_force_cpu_cap(bit) do { \
>        set_cpu_cap(&boot_cpu_data, bit);       \
> -       clear_bit(bit, (unsigned long *)cleared_cpu_caps);      \
> +       set_bit(bit, (unsigned long *)cpu_caps_set);    \
>  } while (0)
>
>  #define cpu_has_fpu            boot_cpu_has(X86_FEATURE_FPU)
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -130,7 +130,8 @@ extern struct cpuinfo_x86   new_cpu_data;
>  extern struct cpuinfo_x86      new_cpu_data;
>
>  extern struct tss_struct       doublefault_tss;
> -extern __u32                   cleared_cpu_caps[NCAPINTS];
> +extern __u32                   cpu_caps_cleared[NCAPINTS];
> +extern __u32                   cpu_caps_set[NCAPINTS];
>
>  #ifdef CONFIG_SMP
>  DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -219,7 +219,8 @@ static char __cpuinit *table_lookup_mode
>        return NULL;            /* Not found */
>  }
>
> -__u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata;
> +__u32 cpu_caps_cleared[NCAPINTS] __cpuinitdata;
> +__u32 cpu_caps_set[NCAPINTS] __cpuinitdata;
>
>  /* Current gdt points %fs at the "master" per-cpu area: after this,
>  * it's on the real one. */
> @@ -512,6 +513,16 @@ static void __cpuinit identify_cpu_witho
>  #endif
>  }
>
> +static void __cpuinit override_capabilities(u32 x86_capability[])
> +{
> +       unsigned int i;
> +
> +       for (i = 0; i < NCAPINTS; i++) {
> +               x86_capability[i] &= ~cpu_caps_cleared[i];
> +               x86_capability[i] |= cpu_caps_set[i];
> +       }
> +}
> +
>  /*
>  * Do minimum CPU detection early.
>  * Fields really needed: vendor, cpuid_level, family, model, mask,
> @@ -703,6 +714,9 @@ static void __cpuinit identify_cpu(struc
>        detect_ht(c);
>  #endif
>
> +       /* Command-line override before we AND into smp all cpus cap. */
> +       override_capabilities(c->x86_capability);
> +
>        /*
>         * On SMP, boot_cpu_data holds the common feature set between
>         * all CPUs; so make sure that we indicate which features are
> @@ -714,10 +728,6 @@ static void __cpuinit identify_cpu(struc
>                for (i = 0; i < NCAPINTS; i++)
>                        boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
>        }
> -
> -       /* Clear all flags overriden by options */
> -       for (i = 0; i < NCAPINTS; i++)
> -               c->x86_capability[i] &= ~cleared_cpu_caps[i];
>
>  #ifdef CONFIG_X86_MCE
>        /* Init Machine Check Exception if available. */
>
>
> Subject: x86: override_capabilities in early_identify_cpu
> From: Rusty Russell <rusty@...tcorp.com.au>
>
> Impact: future-proof
>
> This does nothing at the moment, but once early_param() are parsed before
> setup_arch, it will ensure we respect commandline overrides on the boot
> cpu's capabilities.
>
> Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
> Cc: Yinghai Lu <yinghai.lu@...nel.org>
>
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -559,6 +559,8 @@ static void __init early_identify_cpu(st
>
>        if (this_cpu->c_early_init)
>                this_cpu->c_early_init(c);
> +
> +       override_capabilities(c->x86_capability);
>
>        validate_pat_support(c);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ