linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH kernel] powerpc/powernv: Fix clobbered MSR
@ 2017-03-02  6:41 Alexey Kardashevskiy
  2017-03-02 21:37 ` Benjamin Herrenschmidt
  2017-03-08  7:25 ` [kernel] " Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2017-03-02  6:41 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Alexey Kardashevskiy, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras

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.

Fixes: ab9bad0ead9a ("powerpc/powernv: Remove separate entry for OPAL real mode calls")
Suggested-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 arch/powerpc/platforms/powernv/opal-wrappers.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 6693f75e93d1..da8a0f7a035c 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -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:
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH kernel] powerpc/powernv: Fix clobbered MSR
  2017-03-02  6:41 [PATCH kernel] powerpc/powernv: Fix clobbered MSR Alexey Kardashevskiy
@ 2017-03-02 21:37 ` Benjamin Herrenschmidt
  2017-03-03  0:54   ` Alexey Kardashevskiy
  2017-03-08  7:25 ` [kernel] " Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2017-03-02 21:37 UTC (permalink / raw)
  To: Alexey Kardashevskiy, linuxppc-dev; +Cc: Michael Ellerman, Paul Mackerras

On Thu, 2017-03-02 at 17:41 +1100, Alexey Kardashevskiy wrote:
> 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

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH kernel] powerpc/powernv: Fix clobbered MSR
  2017-03-02 21:37 ` Benjamin Herrenschmidt
@ 2017-03-03  0:54   ` Alexey Kardashevskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2017-03-03  0:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev; +Cc: Michael Ellerman, Paul Mackerras

On 03/03/17 08:37, Benjamin Herrenschmidt wrote:
> On Thu, 2017-03-02 at 17:41 +1100, Alexey Kardashevskiy wrote:
>> 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
> 
> 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.

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.



-- 
Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kernel] powerpc/powernv: Fix clobbered MSR
  2017-03-02  6:41 [PATCH kernel] powerpc/powernv: Fix clobbered MSR Alexey Kardashevskiy
  2017-03-02 21:37 ` Benjamin Herrenschmidt
@ 2017-03-08  7:25 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-03-08  7:25 UTC (permalink / raw)
  To: Alexey Kardashevskiy, linuxppc-dev; +Cc: Alexey Kardashevskiy, Paul Mackerras

On Thu, 2017-03-02 at 06:41:24 UTC, Alexey Kardashevskiy wrote:
> 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.
> 
> Fixes: ab9bad0ead9a ("powerpc/powernv: Remove separate entry for OPAL real mode calls")
> Suggested-by: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/2a9c4f40ab2c281f95d41577ff0f7f

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-08  7:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02  6:41 [PATCH kernel] powerpc/powernv: Fix clobbered MSR Alexey Kardashevskiy
2017-03-02 21:37 ` Benjamin Herrenschmidt
2017-03-03  0:54   ` Alexey Kardashevskiy
2017-03-08  7:25 ` [kernel] " Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).