rendez: Make sure we can block before sleeping A lot of rendezvouses don't block, but any of them could. By checking in advance, instead of deep in sem_down(), we'll catch those cases where we could have blocked but rarely do. Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/src/rendez.c b/kern/src/rendez.c index 576eaf6..857821c 100644 --- a/kern/src/rendez.c +++ b/kern/src/rendez.c
@@ -22,6 +22,8 @@ { int8_t irq_state = 0; struct cv_lookup_elm cle; + + assert(can_block(this_pcpui_ptr())); /* Do a quick check before registering and sleeping. this is the 'check, * signal, check again' pattern, where the first check is an optimization. * Many rendezes will already be satisfied, so we want to avoid excessive @@ -69,6 +71,7 @@ struct cv_lookup_elm cle; struct timer_chain *pcpui_tchain = &per_cpu_info[core_id()].tchain; + assert(can_block(this_pcpui_ptr())); if (!usec) return; /* Doing this cond check early, but then unlocking again. Mostly just to