[Cbe-oss-dev] [RFC] Cell: shutdown method for spu_sysdev_class
Michael Ellerman
michael at ellerman.id.au
Mon May 7 11:20:43 EST 2007
On Sun, 2007-05-06 at 02:34 +0200, Arnd Bergmann wrote:
> On Sunday 06 May 2007, Geoff Levand wrote:
> >
> > Add a shutdown method to spu_sysdev_class to allow proper spu resource
> > cleanup on system shutdown. This is needed to support kexec on the PS3
> > platform.
> >
> > Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
>
> The patch looks like it will do the right thing in general, and
> not cause any harm.
>
> > Arnd, I found I needed this to clean up the HV resources
> > during a kexec shutdown. spu_destroy_spu() then calls
> > spu_management_ops->destroy_spu().
> >
> >
> > arch/powerpc/platforms/cell/spu_base.c | 15 ++++++++++++++-
> > 1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > --- ps3-linux-dev.orig/arch/powerpc/platforms/cell/spu_base.c
> > +++ ps3-linux-dev/arch/powerpc/platforms/cell/spu_base.c
> > @@ -463,8 +463,21 @@ void spu_free(struct spu *spu)
> > }
> > EXPORT_SYMBOL_GPL(spu_free);
> >
> > +static int spu_shutdown(struct sys_device *sysdev)
> > +{
> > + struct spu *spu = container_of(sysdev, struct spu, sysdev);
> > +
> > + // what else here???
> > +
> > + spu_free_irqs(spu);
> > + spu_destroy_spu(spu);
> > + kfree(spu);
> > + return 0;
> > +}
>
> The spu may still be referenced by other data structures. I think it would
> be good style to at least do a list_del_init on spu->list and spu->full_list
> before the kfree.
>
> I'm not sure if there is anything we can do about tasks that are still
> running on the SPUs at the shutdown point, or if we even want that.
>
> One thing I'd like to understand better is how this interacts with
> kdump. Since we want to be able to dump the state of the SPU, we don't
> want to clean up the state in before loading the dump kernel! Is this
> function called both for kboot and kdump, or is there anything we can
> do to avoid it in the kdump case?
Nothing gets called in the kdump case, the kernel is panicked.
For kexec it makes sense to do any cleanup you can, but for kdump you
need to expect that the previous kernel has left everything screwed up.
One thing we should consider for kdump is stopping execution of the
spus. Although it increases the amount of code we're executing in the
panicked kernel, I think it might still be a good idea. We'd want to use
a special shutdown routine which walks as few data structures as
possible.
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/20070507/142ec738/attachment.pgp>
More information about the cbe-oss-dev
mailing list