[Cbe-oss-dev] [RFC] Cell: shutdown method for spu_sysdev_class

Arnd Bergmann arnd at arndb.de
Sun May 6 10:34:58 EST 2007


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?

	Arnd <><



More information about the cbe-oss-dev mailing list