foot-shooting using wrong pcpu

Bruce Evans bde at
Sun Nov 9 02:13:01 PST 2003

Does anyone have any experience with the pcpu sometimes being for the
wrong cpu on i386's?  I have a local locking bug which seems to cause
this.  The usual symptoms are that curpmap is sometimes 0 in cpu_switch(),
and cpu_switch() sometimes switches cpuN to run cpuM's idle thread for
M != N (this sometimes appears to work for a few switches but eventually
the stacks trash each other).  Problems in cpu_switch() seem to be
more symptoms than causes.  I can't see how either the pcpu selector
or the pcpu GDT entry could get trashed (aren't these almost constant
after booting?  All lgdt's are early, and %fs is always KPSEL in the
kernel except in the TLB shootdown IPI with default (?) options).  I
mostly look at pcu data in SMPprvspace since %fs is hard to use and
"show pcpu" doesn't show enough, and everything in SMPprvspace seems
reasonable except curpmap is sometimes 0.


More information about the freebsd-smp mailing list