Subject: Re: unrecoverable exception on G5 with CONFIG_PPC_EARLY_DEBUG enabled

From: Michael Ellerman <[email-masked]>
Date: Mon, 20 Jun 2016 19:23:43 +1000

On Sat, 2016-06-18 at 22:47 +0530, Aneesh Kumar K.V wrote:
> Michael Ellerman <[email-masked]> writes:
> > On Fri, 2016-06-17 at 08:33 +1000, Benjamin Herrenschmidt wrote:
> > > On Thu, 2016-06-16 at 22:49 +0300, Denis Kirjanov wrote:
> > > > -
> > > > +BEGIN_MMU_FTR_SECTION
> > > > +       b       2f
> > > > +END_MMU_FTR_SECTION_IFSET(MMU_FTR_RADIX)
> > > >         andi.   r10,r12,MSR_RI  /* check for unrecoverable exception
> > > > */
> > > >         beq-    2f
> > > 
> > > Are we taking an SLB miss before we do the fixup maybe ?
> > 
> > Yeah that's the only explanation that makes any sense.
> > 
> > I think instead of patching down this low we should instead be redirecting SLB
> > misses to unknown_exception() when radix is enabled. Aneesh?
> 
> The 2f branch ends up doing unrecoverable exception. Or are you
> suggesting something else ?

I meant more like diverting to unknown_exception() higher up the call stack, but
that's complicated.

How about this? Denis does this work?

cheers

diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 4c9440629128..8bcc1b457115 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1399,11 +1399,12 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_RADIX)
 	lwz	r9,PACA_EXSLB+EX_CCR(r13)	/* get saved CR */
 
 	mtlr	r10
-BEGIN_MMU_FTR_SECTION
-	b	2f
-END_MMU_FTR_SECTION_IFSET(MMU_FTR_RADIX)
 	andi.	r10,r12,MSR_RI	/* check for unrecoverable exception */
+BEGIN_MMU_FTR_SECTION
 	beq-	2f
+FTR_SECTION_ELSE
+	b	2f
+ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_RADIX)
 
 .machine	push
 .machine	"power4"