Re: 4.14.9 with CONFIG_MCORE2 fails to boot

From: Alexander Tsoy
Date: Fri Dec 29 2017 - 16:54:03 EST


Ð ÐÑ, 29/12/2017 Ð 12:34 -0800, Linus Torvalds ÐÐÑÐÑ:
> On Fri, Dec 29, 2017 at 12:22 PM, Alexander Tsoy <alexander@xxxxxxx>
> wrote:
> > > But double-checking that "-march=core2" case is definitely worth
> > > looking into. Especially since there are clear indications that
> > > it's
> > > gcc version-dependent anyway. Alexander?
> >
> > Yes, the change suggested by Dave makes the problem go away.
>
> Ok, that's good information.
>
> It doesn't really explain *why* that commit 7f2590a110b8
> ("x86/entry/64: Use a per-CPU trampoline stack for IDT entries") ends
> up being sensitive to that compiler option, though.
>
> So it narrows the cause down, but it doesn't really root-cause the
> problem. It tends to be almost impossible to find differences in code
> generation, because they are generally all over.
>
> Ho humm. What happens if you change the "-march=core2" to
> "-mtune=core2"? Does it still boot?
>
> Because maybe the actual differences that "-march=core2" generates
> might be easier to see when compared to "-mtune=core2".

That's interesting. Compiled with -mtune=core2, the kernel fails to
boot.

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 3e73bc255e4e..f4d8f9497666 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -127,8 +127,7 @@ else
ÂÂÂÂÂÂÂÂÂcflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
ÂÂÂÂÂÂÂÂÂcflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
Â
-ÂÂÂÂÂÂÂÂcflags-$(CONFIG_MCORE2) += \
-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ$(call cc-option,-march=core2,$(call cc-option,-
mtune=generic))
+ÂÂÂÂÂÂÂÂcflags-$(CONFIG_MCORE2) += $(call cc-option,-mtune=core2)
ÂÂÂÂcflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \
ÂÂÂÂÂÂÂÂ$(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
ÂÂÂÂÂÂÂÂÂcflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-
mtune=generic)