diff options
author | rstone <rstone@FreeBSD.org> | 2012-12-23 15:50:37 +0000 |
---|---|---|
committer | rstone <rstone@FreeBSD.org> | 2012-12-23 15:50:37 +0000 |
commit | 97587080eadabbd5fde12c70cd32748fe67d4f19 (patch) | |
tree | 4a43f54f18fb5edaab03d725f081222833446ec4 /contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp | |
parent | babb1e87f13c8aafcdbe450f1985694c481cdad8 (diff) | |
download | FreeBSD-src-97587080eadabbd5fde12c70cd32748fe67d4f19.zip FreeBSD-src-97587080eadabbd5fde12c70cd32748fe67d4f19.tar.gz |
Correct a series of errors in the hand-rolled locking for drace_debug.c:
- Use spinlock_enter()/spinlock_exit() to prevent a thread holding a
debug lock from being preempted to prevent other threads waiting
on that lock from starvation.
- Handle the possibility of CPU migration in between the fetch of curcpu
and the call to spinlock_enter() by saving curcpu in a local variable.
- Use memory barriers to prevent reordering of loads and stores of the
data protected by the lock outside of the critical section
- Eliminate false sharing of the locks by moving them into the structures
that they protect and aligning them to a cacheline boundary.
- Record the owning thread in the lock to make debugging future problems
easier.
Reviewed by: rpaulo (initial version)
MFC after: 2 weeks
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp')
0 files changed, 0 insertions, 0 deletions