[RFC] Old paca being written by firmware after kexec
Milton Miller
miltonm at bga.com
Sat Oct 8 01:05:12 EST 2005
On Oct 7, 2005, at 1:56 AM, Michael Ellerman wrote:
> Hi again,
>
> Here's a first cut at a patch. It needs some spit and polish, but I
> thought
> I'd throw it out over the weekend in case anyone has any comments.
>
> This seems to fix my bug, although on one reboot I got a cpu stuck -
> which
> may or may not be related.
>
> cheers
>
...
> --- kexec.orig/arch/ppc64/kernel/machine_kexec.c
> +++ kexec/arch/ppc64/kernel/machine_kexec.c
> @@ -24,6 +24,7 @@
> #include <asm/mmu.h>
> #include <asm/sections.h> /* _end */
> #include <asm/prom.h>
> +#include <asm/plpar_wrappers.h>
>
> #define HASH_GROUP_SIZE 0x80 /* size of each hash group, asm/mmu.h */
>
> @@ -191,10 +192,26 @@ void kexec_smp_down(void *arg)
> /* NOTREACHED */
> }
>
> +static void vpa_shutdown(int cpu)
> +{
> + unsigned long vpa = __pa(&paca[cpu].lppaca);
> + long ret;
> +
> + ret = unregister_vpa(get_hard_smp_processor_id(cpu), vpa);
> +
> + if (ret)
> + printk(KERN_ERR "WARNING: vpa_shutdown: VPA deregistration "
> + "failed with code %d\n", ret);
> +}
> +
> static void kexec_prepare_cpus(void)
> {
> int my_cpu, i, notified=-1;
>
> + /* FIXME: I'd rather do this after the loop but we clobber hw_cpu_id
> */
i'd rather each cpu do it in kexec-cpu-down
we can skip on panic
however, that means we should register on the cpu to make sure we
don't miss one going down.
> + for_each_cpu(i)
> + vpa_shutdown(i);
> +
> smp_call_function(kexec_smp_down, NULL, 0, /* wait */0);
> my_cpu = get_cpu();
>
> @@ -203,6 +220,8 @@ static void kexec_prepare_cpus(void)
> if (i == my_cpu)
> continue;
>
> + /* FIXME: Why do we abuse hw_cpu_id and not cpu_start? */
> +
We abuse hw_cpuid becaus this makes all cases the same. the cpu
is saying this is no longer me
> while (paca[i].hw_cpu_id != -1) {
> barrier();
> if (!cpu_possible(i)) {
>
>
Another thing to investigate:
if we start SMT threads but tell the kernel no-smt, i saw a case where
we put hw_cpuids in the paca but never started them.
milton
More information about the Linuxppc64-dev
mailing list