So, picking up this thread which got dropped on the floor...

On 02/01/2014 11:19 PM, Suresh Siddha wrote:
> 
> diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
> index e8368c6..4e5f770 100644
> --- a/arch/x86/kernel/i387.c
> +++ b/arch/x86/kernel/i387.c
> @@ -5,6 +5,7 @@
>   *  General FPU state handling cleanups
>   *   Gareth Hughes <gar...@valinux.com>, May 2000
>   */
> +#include <linux/bootmem.h>
>  #include <linux/module.h>
>  #include <linux/regset.h>
>  #include <linux/sched.h>
> @@ -186,6 +187,10 @@ void fpu_init(void)
>       if (xstate_size == 0)
>               init_thread_xstate();
>  
> +     if (!current->thread.fpu.state)
> +             current->thread.fpu.state =
> +                     alloc_bootmem_align(xstate_size, __alignof__(struct 
> xsave_struct));
> +
>       mxcsr_feature_mask_init();
>       xsave_init();
>       eager_fpu_init();

So this bit is giving me a bit of a headache, specifically
alloc_bootmem_align() is an __init function and fpu_init() obviously isn't.

I am doubly confused because init_thread_xstate() only sets the xstate
without any XSAVE features, so the memory allocation we get there will
be insufficient later -- in fact, only a few lines further down the
function, when xsave_init() is called.

I'm wondering if we could put this somewhere inside
xstate_enable_boot_cpu() instead, maybe?

I'm assuming the reason you didn't want to in eager_fpu_init_bp()
anymore is because you want the allocation to happen regardless of if
eagerfpu is enabled, correct?

        -hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to