]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r244631
authorrstone <rstone@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 8 Mar 2013 21:07:01 +0000 (21:07 +0000)
committerrstone <rstone@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 8 Mar 2013 21:07:01 +0000 (21:07 +0000)
commitce2d8cc760d3cf9f5f924a4e8325d312f7b605cf
treecb3eb65bfca47eb0de1634e8a65e0e629bcf049a
parent0e4fb5b3eaf24e0478dee6e1a04c43291c65b96f
MFC r244631
  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)

git-svn-id: svn://svn.freebsd.org/base/stable/9@248073 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/cddl/dev/dtrace/dtrace_debug.c