Re: [PATCH] x86/fpu: Fix boot crash in the early FPU code

From: Maciej W. Rozycki
Date: Sun Jul 05 2015 - 06:00:33 EST


On Sat, 4 Jul 2015, Ingo Molnar wrote:

> Btw., is it a GCC bug or a known GCC property that a structure with a 16-byte
> alignment attribute does not get properly aligned on the stack?

What's the stack alignment mandated by the x86 psABI? Is that anything
beyond what the PUSH instructions imply (i.e. 4 bytes for 32-bit and 8
bytes for 64-bit targets)? Otherwise GCC might not be smart enough to
apply the right subtract and mask operations to the stack/frame pointer.
This might even have been documented with the alignment attribute.

> So fix this bug by making the variable static again, but also mark it
> __initdata this time, because fpu__init_system_mxcsr() is now an
> __init function.

You could have used `alloca' and manually aligned the structure within
the area obtained too (to avoid static storage if desired).

FWIW,

Maciej
--
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/