lkml.org 
[lkml]   [2011]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/8] x86, i387.c: thread xstate is initialized only on BSP once
On Wed, 5 Oct 2011, Fenghua Yu wrote:

> From: Fenghua Yu <fenghua.yu@intel.com>
>
> init_thread_xstate() is only called on BSP once to avoid to override
> xstate_size.
>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> ---
> 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..de2b48a 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;
>
> 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
> + * xstate_size.
> + */
> + if (!smp_processor_id() && once) {

Brilliant change. Makes sure that init_thread_xstate() is NEVER
called. Was this crap tested at all?

> + once = 0;
> init_thread_xstate();
> + }
>
> mxcsr_feature_mask_init();
> /* clean state in init */
> --
> 1.6.0.3
>
>


\
 
 \ /
  Last update: 2011-10-05 20:53    [from the cache]
©2003-2011 Jasper Spaans