[PATCH v2] powerpc/kexec: Switch to a static PACA on the way out

Michael Ellerman michael at ellerman.id.au
Fri Jul 23 23:12:03 EST 2010


On Thu, 2010-07-08 at 17:55 +1000, Matt Evans wrote:
> With dynamic PACAs, the kexecing CPU's PACA won't lie within the kernel
> static data and there is a chance that something may stomp it when preparing
> to kexec.  This patch switches this final CPU to a static PACA just before
> we pull the switch.
> 
> Signed-off-by: Matt Evans <matt at ozlabs.org>
> ---
> v2:	Changes from Milton's review:
> 	- Use setup_paca() and move from setup_64.c,
> 	- SLB cache inval. not required,
> 	- Adjust 'paca' (oops..), and
> 	- Poison data_offset/per_cpu_offset
> 
>  arch/powerpc/include/asm/paca.h        |    2 +-
>  arch/powerpc/kernel/machine_kexec_64.c |   20 ++++++++++++++++++++
>  arch/powerpc/kernel/paca.c             |   10 ++++++++++
>  arch/powerpc/kernel/setup_64.c         |   10 ----------
>  4 files changed, 31 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
> index 8ce7963..1ff6662 100644
> --- a/arch/powerpc/include/asm/paca.h
> +++ b/arch/powerpc/include/asm/paca.h
> @@ -146,7 +146,7 @@ struct paca_struct {
>  extern struct paca_struct *paca;
>  extern __initdata struct paca_struct boot_paca;
>  extern void initialise_paca(struct paca_struct *new_paca, int cpu);
> -
> +extern void setup_paca(struct paca_struct *new_paca);
>  extern void allocate_pacas(void);
>  extern void free_unused_pacas(void);
>  
> diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
> index 26f9900..c4d0123 100644
> --- a/arch/powerpc/kernel/machine_kexec_64.c
> +++ b/arch/powerpc/kernel/machine_kexec_64.c
> @@ -273,6 +273,12 @@ static void kexec_prepare_cpus(void)
>  static union thread_union kexec_stack __init_task_data =
>  	{ };
>  
> +/*
> + * For similar reasons to the stack above, the kexecing CPU needs to be on a
> + * static PACA; we switch to kexec_paca.
> + */
> +struct paca_struct kexec_paca;
> +

Hopelessly late probably but .. we could use boot_paca which already
exists and is static.

cheers

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20100723/f999600d/attachment.pgp>


More information about the Linuxppc-dev mailing list