4.14.9 with CONFIG_MCORE2 fails to boot

From: Alexander Tsoy
Date: Thu Dec 28 2017 - 04:39:05 EST


Hello,

4.14.9 fails to boot if CONFIG_MCORE2 is enabled and when compiled with
gcc 6+. More details in the following bug reports:
https://bugzilla.kernel.org/show_bug.cgi?id=198263
https://bugs.gentoo.org/642268

I bisected it to the commit below:

$ git bisect good
2bc9fa0beaf10206a778f02e9e5cb62f50345b1a is the first bad commit
commit 2bc9fa0beaf10206a778f02e9e5cb62f50345b1a
Author: Andy Lutomirski <luto@xxxxxxxxxx>
Date:ÂÂÂMon Dec 4 15:07:23 2017 +0100

ÂÂÂÂx86/entry/64: Use a per-CPU trampoline stack for IDT entries

ÂÂÂÂcommit 7f2590a110b837af5679d08fc25c6227c5a8c497 upstream.

ÂÂÂÂHistorically, IDT entries from usermode have always gone directly
ÂÂÂÂto the running task's kernel stack.ÂÂRearrange it so that we enter
on
ÂÂÂÂa per-CPU trampoline stack and then manually switch to the task's
stack.
ÂÂÂÂThis touches a couple of extra cachelines, but it gives us a chance
ÂÂÂÂto run some code before we touch the kernel stack.

ÂÂÂÂThe asm isn't exactly beautiful, but I think that fully refactoring
ÂÂÂÂit can wait.

ÂÂÂÂSigned-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
ÂÂÂÂSigned-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
ÂÂÂÂReviewed-by: Borislav Petkov <bp@xxxxxxx>
ÂÂÂÂReviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
ÂÂÂÂCc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
ÂÂÂÂCc: Borislav Petkov <bp@xxxxxxxxx>
ÂÂÂÂCc: Borislav Petkov <bpetkov@xxxxxxx>
ÂÂÂÂCc: Brian Gerst <brgerst@xxxxxxxxx>
ÂÂÂÂCc: Dave Hansen <dave.hansen@xxxxxxxxx>
ÂÂÂÂCc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
ÂÂÂÂCc: David Laight <David.Laight@xxxxxxxxxx>
ÂÂÂÂCc: Denys Vlasenko <dvlasenk@xxxxxxxxxx>
ÂÂÂÂCc: Eduardo Valentin <eduval@xxxxxxxxxx>
ÂÂÂÂCc: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
ÂÂÂÂCc: H. Peter Anvin <hpa@xxxxxxxxx>
ÂÂÂÂCc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
ÂÂÂÂCc: Juergen Gross <jgross@xxxxxxxx>
ÂÂÂÂCc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
ÂÂÂÂCc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
ÂÂÂÂCc: Rik van Riel <riel@xxxxxxxxxx>
ÂÂÂÂCc: Will Deacon <will.deacon@xxxxxxx>
ÂÂÂÂCc: aliguori@xxxxxxxxxx
ÂÂÂÂCc: daniel.gruss@xxxxxxxxxxxxxx
ÂÂÂÂCc: hughd@xxxxxxxxxx
ÂÂÂÂCc: keescook@xxxxxxxxxx
ÂÂÂÂLink: https://lkml.kernel.org/r/20171204150606.225330557@linutronix
.de
ÂÂÂÂSigned-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
ÂÂÂÂSigned-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

:040000 040000 275d4746936a9e521a2b5041856f7dc1d1820dc6
8f8e869fd59c3dd781dceffa76e53e41d733a0cf MÂÂÂÂÂÂarch

$ git bisect log
git bisect start
# bad: [dad5c1402c570cd07a80113784bc20a7f930c8ae] Linux 4.14.9
git bisect bad dad5c1402c570cd07a80113784bc20a7f930c8ae
# good: [7b3775017f4e6b87dfd2c7f63d1eaf057948f31d] Linux 4.14.8
git bisect good 7b3775017f4e6b87dfd2c7f63d1eaf057948f31d
# good: [d120cd749ef9770ee98b708a83b49547dcf1c0e1] x86/entry/64:
Separate cpu_current_top_of_stack from TSS.sp0
git bisect good d120cd749ef9770ee98b708a83b49547dcf1c0e1
# bad: [97f41b41c432e5a80c91445d92c2f4b729984d36] powerpc/xmon: Avoid
tripping SMP hardlockup watchdog
git bisect bad 97f41b41c432e5a80c91445d92c2f4b729984d36
# bad: [bfd66a406fe7e590055c1d6714adc697f18664c8] PCI: Avoid bus reset
if bridge itself is broken
git bisect bad bfd66a406fe7e590055c1d6714adc697f18664c8
# bad: [8388d287e361a2fd0a39bece30a736d692d5c3d8] x86/cpufeatures: Make
CPU bugs sticky
git bisect bad 8388d287e361a2fd0a39bece30a736d692d5c3d8
# bad: [bb568391775d4a840992e2d2493f39d6e86401e3] x86/entry/64: Move
the IST stacks into struct cpu_entry_area
git bisect bad bb568391775d4a840992e2d2493f39d6e86401e3
# bad: [2bc9fa0beaf10206a778f02e9e5cb62f50345b1a] x86/entry/64: Use a
per-CPU trampoline stack for IDT entries
git bisect bad 2bc9fa0beaf10206a778f02e9e5cb62f50345b1a
# good: [c3dbef1bd0f7eb09daf49409ea533aa1b0eeb82e] x86/espfix/64: Stop
assuming that pt_regs is on the entry stack
git bisect good c3dbef1bd0f7eb09daf49409ea533aa1b0eeb82e
# first bad commit: [2bc9fa0beaf10206a778f02e9e5cb62f50345b1a]
x86/entry/64: Use a per-CPU trampoline stack for IDT entries