diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-06-23 22:21:28 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-06-23 22:21:28 +0000 |
commit | 1d215b1285ab0897c64a473f1b6b30f0311b87d0 (patch) | |
tree | 76a642e618833d9949a5962d0c3847b6ff888af7 /sys/powerpc/aim/locore32.S | |
parent | 1f9c357d9bfe97631d50ce6a97e271360f417bbb (diff) | |
download | FreeBSD-src-1d215b1285ab0897c64a473f1b6b30f0311b87d0.zip FreeBSD-src-1d215b1285ab0897c64a473f1b6b30f0311b87d0.tar.gz |
Use the ABI-mandated thread pointer register (r2 for ppc32, r13 for ppc64)
instead of a PCPU field for curthread. This averts a race on SMP systems
with a high interrupt rate where the thread looking up the value of
curthread could be preempted and migrated between obtaining the PCPU
pointer and reading the value of pc_curthread, resulting in curthread being
observed to be the current thread on the thread's original CPU. This played
merry havoc with the system, in particular with mutexes. Many thanks to
jhb for helping me work this one out.
Note that Book-E is in principle susceptible to the same problem, but has
not been modified yet due to lack of Book-E hardware.
MFC after: 2 weeks
Diffstat (limited to 'sys/powerpc/aim/locore32.S')
-rw-r--r-- | sys/powerpc/aim/locore32.S | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/powerpc/aim/locore32.S b/sys/powerpc/aim/locore32.S index 35ea99b..d0a3778 100644 --- a/sys/powerpc/aim/locore32.S +++ b/sys/powerpc/aim/locore32.S @@ -181,8 +181,7 @@ setfault: mflr 0 mfcr 12 mfsprg 4,0 - lwz 4,PC_CURTHREAD(4) - lwz 4,TD_PCB(4) + lwz 4,TD_PCB(2) /* curthread = r2 */ stw 3,PCB_ONFAULT(4) stw 0,0(3) stw 1,4(3) |