summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/booke/interrupt.c
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2011-06-23 22:21:28 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2011-06-23 22:21:28 +0000
commit1d215b1285ab0897c64a473f1b6b30f0311b87d0 (patch)
tree76a642e618833d9949a5962d0c3847b6ff888af7 /sys/powerpc/booke/interrupt.c
parent1f9c357d9bfe97631d50ce6a97e271360f417bbb (diff)
downloadFreeBSD-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/booke/interrupt.c')
-rw-r--r--sys/powerpc/booke/interrupt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/powerpc/booke/interrupt.c b/sys/powerpc/booke/interrupt.c
index c0bdee1..e268537 100644
--- a/sys/powerpc/booke/interrupt.c
+++ b/sys/powerpc/booke/interrupt.c
@@ -118,7 +118,7 @@ powerpc_decr_interrupt(struct trapframe *framep)
struct thread *td;
struct trapframe *oldframe;
- td = PCPU_GET(curthread);
+ td = curthread;
critical_enter();
atomic_add_int(&td->td_intr_nesting_level, 1);
oldframe = td->td_intr_frame;
OpenPOWER on IntegriCloud