SMP: stopping/restarting CPUs on powerpc arch
geoffrey levand
geoffrey.levand at mail.ru
Mon Dec 26 01:30:46 UTC 2011
Hi,
i was implementing and testing core dump feature of HDD driver on PS3 powerpc arch and
tried to enter KDB manually with sysctl debug.kdb.panic=1.
And i'm getting the following message from KDB: timeout stopping cpus.
I took a look at generic_stop_cpus which sends IPI to every CPU.
On powerpc, IPI_STOP is implemented the following way:
cpuid = PCPU_GET(cpuid);
savectx(&stoppcbs[cpuid]);
savectx(PCPU_GET(curpcb));
CPU_SET_ATOMIC(cpuid, &stopped_cpus);
while (!CPU_ISSET(cpuid, &started_cpus))
cpu_spinwait();
CPU_CLR_ATOMIC(cpuid, &stopped_cpus);
CPU_CLR_ATOMIC(cpuid, &started_cpus);
generic_stop_cpus waits until all CPUs clear its ID in stopped_cpus bitmap.
If you take a look at the previous snippet of code then the bit is indeed set but then cleared immediately.
And that is why i get timeout message in kdb i think.
Or do i not undestand something here ? Could someone please clarify.
I could be wrong but i think it should be like this:
cpuid = PCPU_GET(cpuid);
savectx(&stoppcbs[cpuid]);
savectx(PCPU_GET(curpcb));
CPU_CLR_ATOMIC(cpuid, &started_cpus); <------------- move here
CPU_SET_ATOMIC(cpuid, &stopped_cpus);
while (!CPU_ISSET(cpuid, &started_cpus))
cpu_spinwait();
CPU_CLR_ATOMIC(cpuid, &stopped_cpus);
Thanks
Regards
More information about the freebsd-hackers
mailing list