Re: [PATCH v3 6/7] x86/i387.c: Thread xstate is initialized only onBSP once

From: Konrad Rzeszutek Wilk
Date: Fri Nov 11 2011 - 13:24:42 EST


On Wed, Nov 09, 2011 at 04:34:16PM -0800, Fenghua Yu wrote:
> From: Fenghua Yu <fenghua.yu@xxxxxxxxx>
>
> init_thread_xstate() is only called on BSP once to avoid to override
> xstate_size.
>
> Signed-off-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
> ---
> arch/x86/kernel/i387.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
> index 739d859..f721a61 100644
> --- a/arch/x86/kernel/i387.c
> +++ b/arch/x86/kernel/i387.c
> @@ -93,6 +93,7 @@ void __cpuinit fpu_init(void)
> {
> unsigned long cr0;
> unsigned long cr4_mask = 0;
> + static int once = 1;
>
> if (cpu_has_fxsr)
> cr4_mask |= X86_CR4_OSFXSR;
> @@ -107,8 +108,14 @@ void __cpuinit fpu_init(void)
> cr0 |= X86_CR0_EM;
> write_cr0(cr0);
>
> - if (!smp_processor_id())
> + /*
> + * init_thread_xstate is only called on BSP once to avoid to override

"to avoid overriding xstate_size"

> + * xstate_size.
> + */
> + if (!smp_processor_id() && once) {
> + once = 0;
> init_thread_xstate();
> + }
>
> mxcsr_feature_mask_init();
> /* clean state in init */
> --
> 1.6.0.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/