futex: Disable notifs when waking waiters
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 15 Oct 2018 20:48:26 +0000 (16:48 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 22 Oct 2018 23:35:51 +0000 (19:35 -0400)
commitce5ff2deabf58b64c1d72f028083f464fcb0370c
tree122c1e9d96df063284d9abbb23bd1eb3f3dce4b9
parentb82d69219273ca96aa5453e0ddad26cfe5939567
futex: Disable notifs when waking waiters

When you call cpu_relax_vc() as a uthread, it simply spins, with the
assumption that we'd find out about the preemption via a
notification/IPI.  Although that is true, parlib will only prioritize
vcore context code.  A 2LS won't know to run particular uthread, since
the "spinning-on" relationship is unknown to the 2LS.

By putting the thread that is the target of the busy-wait in vcore
context (or pretending to, with notifs disabled), we get the behavior we
want.

Note the old version of futex code also had this problem when we
busy-waited on awaiter.data = NULL.

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