SMP: stopping/restarting CPUs on powerpc arch

geoffrey levand geoffrey.levand at mail.ru
Tue Dec 27 11:33:03 UTC 2011


Nevermind. I changed something in IPI handling and that caused this problem. Now the CPUs can be stopped but KDB just hangs
after it was entered. Thread ID and process ID are printed on the console but that's it. After that nothing works anymore.


26 декабря 2011, 06:24 от geoffrey levand <geoffrey.levand at mail.ru>:
> 
> 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