[Cbe-oss-dev] [PATCH] fix reboot fail on kexec for CBE

Michael Ellerman michael at ellerman.id.au
Wed Apr 4 09:35:34 EST 2007


On Tue, 2007-04-03 at 16:12 +0200, Arnd Bergmann wrote:
> On Tuesday 03 April 2007, Akira Tsukamoto wrote:
> > [PATCH] fix reboot fail on kexec for CBE
> > 
> > This patch adds additional TLB flush for dump-capture kernel to 
> > successfully reboot triggered by kexec. 
> > 
> > The same issue might exist on PS3 platform but I have not tried 
> > yet and the patch only applies to CBE platform.
> > I really appreciate if somebody could brush up this patch, as such 
> > using magic constant value inside the code.
> 
> Thanks for the Information! Is this patch actually sufficient in that
> it enables kexec to work as expected, or did you need additional changes
> beyond it?
> 
> > ---------------------------------------------------------------
> > diff -uprNX dontdiff linux-2.6.20.4-arnd3/arch/powerpc/kernel/head_64.S linux-2.6.20.4-arnd3-aki1/arch/powerpc/kernel/head_64.S
> > --- linux-2.6.20.4-arnd3/arch/powerpc/kernel/head_64.S	2007-03-30 17:13:53.000000000 +0900
> > +++ linux-2.6.20.4-arnd3-aki1/arch/powerpc/kernel/head_64.S	2007-03-30 18:54:51.000000000 +0900
> > @@ -2010,6 +2010,9 @@ _STATIC(start_here_multiplatform)
> >  	mr	r3,r31
> >   	bl	.early_setup
> >  
> > +#if defined(CONFIG_PPC_CELL) && defined(CONFIG_CRASH_DUMP)
> > +	bl	.cbe_flush_tlb
> > +#endif
> >  	LOAD_REG_IMMEDIATE(r3, .start_here_common)
> >  	LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
> >  	mtspr	SPRN_SRR0,r3
> 
> This looks wrong, the function is called on all platforms, if
> support for cell is compiled in. Since CONFIG_PPC_CELL is set on
> the PS3, it is even active there.
> 
> > diff -uprNX dontdiff linux-2.6.20.4-arnd3/arch/powerpc/platforms/cell/cbe_regs.c linux-2.6.20.4-arnd3-aki1/arch/powerpc/platforms/cell/cbe_regs.c
> > --- linux-2.6.20.4-arnd3/arch/powerpc/platforms/cell/cbe_regs.c	2007-03-30 17:25:29.000000000 +0900
> > +++ linux-2.6.20.4-arnd3-aki1/arch/powerpc/platforms/cell/cbe_regs.c	2007-03-30 18:51:22.000000000 +0900
> > @@ -273,3 +273,21 @@ void __init cbe_regs_init(void)
> >  	}
> >  }
> >  
> > +asmlinkage void cbe_flush_tlb(void)
> > +{
> > +	int i,j;
> > +	unsigned long tmp;
> > +	int ti,ts;
> > +
> > +	for (i = 0; i < 256; i++) {
> > +		ti = 0x10 * i;
> > +		for (j = 0; j < 4; j++) {
> > +			ts = 1 << j;
> > +			tmp = ti | ts;
> > +			mtspr(947, tmp);
> > +			mtspr(948, 0);
> > +		}
> > +	}
> > +
> > +}
> > +
> 
> But the SPRs you are touching are CPU specific. Writing into them when a
> hypervisor is enabled or when running on a different CPU altogether
> probably leads to a nasty exception.

> I think it should instead be done from the ->cpu_setup function in
> identify_cpu(). Can you try if that works?
> 
> A better alternative might be to flush the TLBs from the old kernel
> before calling into the new one, at least that's how I'd expect kexec
> to work.

That is how it works. On the way down, the kexec/kdump code calls
ppc_md.hpte_clear_all() from kexec_sequence (kernel/misc_64.S).

On cell hpte_clear_all() calls into native_hpte_clear(), there are known
TODOs in there, Luke was working on those. I think we can just adapt
native_hpte_clear() to work on cell, but if we need platform specific
hacks, then cell needs its own separate clear function.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070404/a96e6955/attachment.pgp>


More information about the cbe-oss-dev mailing list