On Fri, Feb 27, 2015 at 11:50 AM, Steven Rostedt <[email protected]> wrote:
> On Fri, 27 Feb 2015 10:59:52 -0800
> Linus Torvalds <[email protected]> wrote:
>
>> Presumably there is some initialization missing - I suspect that the
>> cached value of cr4 is from the *previous* time the CPU was up, and we
>> don't correctly initialize the cached copy at early CPU bringup.
>
> Found it. The problem is that there's two cpu_init()s in common.c. Andy
> only added the cr4 init to one of them.
>
>
> x86: Init per-cpu shadow copy of CR4 for i386 too
>
> The commit 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4" added
> a shadow CR4 such that reads and writes that do not modify the CR4
> execute much faster than always reading the register itself.
> The change modified cpu_init() in common.c, so that the shadow CR4 gets
> initialized before anything uses it. Unfortunately, there's two
> cpu_init()s in common.c. There's one for x86_64 and one for i386. The
> commit only added the shadow init to x86_64. The i386 needs the init
> too.
>
> Link: http://lkml.kernel.org/r/[email protected]
> Fixes: 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4"
> Signed-off-by: Steven Rostedt <[email protected]>

Looks suspiciously identical to my patch :)

Acked-by: Andy Lutomirski <[email protected]>

> ---
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index b5c8ff5e9dfc..2346c95c6ab1 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -1396,6 +1396,12 @@ void cpu_init(void)
>
>         wait_for_master_cpu(cpu);
>
> +       /*
> +        * Initialize the CR4 shadow before doing anything that could
> +        * try to read it.
> +        */
> +       cr4_init_shadow();
> +
>         show_ucode_info_early();
>
>         printk(KERN_INFO "Initializing CPU#%d\n", cpu);



-- 
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
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