2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 12:43:55 +08:00
linux-next/arch/sparc/prom
David S. Miller ef3e035c3a sparc64: Fix register corruption in top-most kernel stack frame during boot.
Meelis Roos reported that kernels built with gcc-4.9 do not boot, we
eventually narrowed this down to only impacting machines using
UltraSPARC-III and derivitive cpus.

The crash happens right when the first user process is spawned:

[   54.451346] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
[   54.451346]
[   54.571516] CPU: 1 PID: 1 Comm: init Not tainted 3.16.0-rc2-00211-gd7933ab #96
[   54.666431] Call Trace:
[   54.698453]  [0000000000762f8c] panic+0xb0/0x224
[   54.759071]  [000000000045cf68] do_exit+0x948/0x960
[   54.823123]  [000000000042cbc0] fault_in_user_windows+0xe0/0x100
[   54.902036]  [0000000000404ad0] __handle_user_windows+0x0/0x10
[   54.978662] Press Stop-A (L1-A) to return to the boot prom
[   55.050713] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004

Further investigation showed that compiling only per_cpu_patch() with
an older compiler fixes the boot.

Detailed analysis showed that the function is not being miscompiled by
gcc-4.9, but it is using a different register allocation ordering.

With the gcc-4.9 compiled function, something during the code patching
causes some of the %i* input registers to get corrupted.  Perhaps
we have a TLB miss path into the firmware that is deep enough to
cause a register window spill and subsequent restore when we get
back from the TLB miss trap.

Let's plug this up by doing two things:

1) Stop using the firmware stack for client interface calls into
   the firmware.  Just use the kernel's stack.

2) As soon as we can, call into a new function "start_early_boot()"
   to put a one-register-window buffer between the firmware's
   deepest stack frame and the top-most initial kernel one.

Reported-by: Meelis Roos <mroos@linux.ee>
Tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-10-24 09:52:49 -07:00
..
bootstr_32.c arch: sparc: prom: looping issue, need additional length check in the outside looping 2013-06-19 02:10:29 -07:00
bootstr_64.c sparc64: Increase size of boot string to 1024 bytes 2014-10-07 15:41:02 -04:00
cif.S sparc64: Fix register corruption in top-most kernel stack frame during boot. 2014-10-24 09:52:49 -07:00
console_32.c Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
console_64.c Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
init_32.c sparc32: Remove superfluous extern declarations for prom_*() functions 2012-06-27 01:27:45 -07:00
init_64.c sparc64: Fix register corruption in top-most kernel stack frame during boot. 2014-10-24 09:52:49 -07:00
Makefile sparc32: drop sun4c support 2012-05-11 19:27:44 -07:00
memory.c of/sparc: convert various prom_* functions to use phandle 2010-10-09 02:33:34 -06:00
misc_32.c Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
misc_64.c sparc64: fix sparse warnings in smp_64.c 2014-05-18 19:01:31 -07:00
mp.c sparc: Remove unnecessary semicolons 2011-06-07 16:06:34 -07:00
p1275.c sparc64: Fix register corruption in top-most kernel stack frame during boot. 2014-10-24 09:52:49 -07:00
printf.c sparc: Write to prom console using indirect buffer. 2010-11-30 20:15:58 -08:00
ranges.c Disintegrate asm/system.h for Sparc 2012-03-28 18:30:03 +01:00
tree_32.c Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2011-01-10 08:57:03 -08:00
tree_64.c sparc: remove inline marking of EXPORT_SYMBOL functions 2013-06-19 02:09:23 -07:00