powerpc/powernv: Fix clobbered MSR
PATCH 1/1 powerpc/powernv: Fix clobbered MSR
If CONFIG_DEBUG_INFO_SPLIT is not set but CONFIG_DEBUG_INFO is, the kernel makefile just adds "-g" and the scripts/gcc-goto.sh test for the "asm goto ("" :::: entry)" support succedes and adds -DCC_HAVE_ASM_GOTO to KBUILD_CFLAGS/KBUILD_AFLAGS. This effectively makes OPAL_BRANCH() a noop (or something similar).
With CONFIG_DEBUG_INFO_SPLIT=y, the makefile adds "-gsplit-dwarf" which somehow makes the scripts/gcc-goto.sh test fail and not have CC_HAVE_ASM_GOTO defined so the alternative OPAL_BRANCH() is used and this particular chunk clobbers r12 where the parenting code - OPAL_CALL() - stores MSR; as the result, the kernel oops'es right after early_setup() because of broken MSR.
This replaces r12 with r11 which is overwritten right after OPAL_BRANCH(opal_tracepoint_entry) anyway.
I used gcc 5.4.1 20161205 built from sha1 ffadbf3ae29.
--- arch/powerpc/platforms/powernv/opal-wrappers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/powernv/opal-wrappers.S +2 -2
@@ -39,8 +39,8 @@ opal_tracepoint_refcount: BEGIN_FTR_SECTION; \ b 1f; \ END_FTR_SECTION(0, 1); \ - ld r12,opal_tracepoint_refcount@toc(r2); \ - cmpdi r12,0; \ + ld r11,opal_tracepoint_refcount@toc(r2); \ + cmpdi r11,0; \ bne- LABEL; \ 1:
Signature · 1 line
2.11.0
Quoted 3 lines · Alexey Kardashevskiy
With
CONFIG_DEBUG_INFO_SPLIT=y, the makefile adds "-gsplit-dwarf" which somehow makes thescripts/gcc-goto.shtest fail and not haveCC_HAVE_ASM_GOTOdefined so the alternativeOPAL_BRANCH()is used
This needs to be fixed too though. That alternative path has much more overhead accross the board. Losing "asm goto" because of a broken test is nasty.
Cheers,
Ben.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 3 lines · Alexey Kardashevskiy
With
CONFIG_DEBUG_INFO_SPLIT=y, the makefile adds "-gsplit-dwarf" which somehow makes thescripts/gcc-goto.shtest fail and not haveCC_HAVE_ASM_GOTOdefined so the alternativeOPAL_BRANCH()is usedThis needs to be fixed too though. That alternative path has much more overhead accross the board. Losing "asm goto" because of a broken test is nasty.
I just posted "[RFC PATCH kernel] gcc-goto.sh: Allow to pass with CONFIG_DEBUG_INFO_SPLIT=y" to Jason + cc: Michael, will see how it goes.
Signature · 1 line
Alexey
Michael Ellerman
AppliedQuoted 13 lines · Alexey Kardashevskiy
If
CONFIG_DEBUG_INFO_SPLITis not set butCONFIG_DEBUG_INFOis, the kernel makefile just adds "-g" and thescripts/gcc-goto.shtest for the "asm goto ("" :::: entry)" support succedes and adds -DCC_HAVE_ASM_GOTO to KBUILD_CFLAGS/KBUILD_AFLAGS. This effectively makesOPAL_BRANCH()a noop (or something similar).With
CONFIG_DEBUG_INFO_SPLIT=y, the makefile adds "-gsplit-dwarf" which somehow makes thescripts/gcc-goto.shtest fail and not haveCC_HAVE_ASM_GOTOdefined so the alternativeOPAL_BRANCH()is used and this particular chunk clobbers r12 where the parenting code -OPAL_CALL()- stores MSR; as the result, the kernel oops'es right afterearly_setup()because of broken MSR.
Quoted 8 lines
This replaces r12 with r11 which is overwritten right after
OPAL_BRANCH(opal_tracepoint_entry)anyway.I used gcc 5.4.1 20161205 built from sha1
ffadbf3ae29.Fixes ab9bad0ead9a ("powerpc/powernv: Remove separate entry for OPAL real mode calls")Suggested-by Paul Mackerras <[email protected]>Signed-off-by Alexey Kardashevskiy <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/2a9c4f40ab2c281f95d41577ff0f7f
cheers