parlib: Catch broken uses of notif_disabled_depth
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 25 Apr 2017 18:25:02 +0000 (14:25 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 3 May 2017 16:13:02 +0000 (12:13 -0400)
commita200280533e6e285cfdf1f1ca7b91f7458fb607b
tree914dffbcf5416f4255892d0168ecd5aef3e24fda
parente6f6b5502d5c43a43ce893d12a1f27a8c852f8bd
parlib: Catch broken uses of notif_disabled_depth

Uthreads can disable notifs, such as when grabbing PDR locks, and then
yield to vcore context.  However, they can only do so if their yield
callback lets go of the lock.  At that point, we'll reenable their notifs.
It's broken to have notifs disabled while yielding under any other
circumstance.

Note that the spin_pdr_unlock() call, often made in the yield callback,
will not reenable notifs, since it is being called by vcore context - not
the original uthread that grabbed the lock.  Vcore context is unlocking on
behalf of the uthread.  This is the "atomically block and unlock" that is
the basis for all of the higher-level blocking sync primitives (e.g.
mutex).

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/uthread.c