Enable/disable notifs for SCPs
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 10 Jul 2015 20:33:49 +0000 (16:33 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 16 Jul 2015 17:31:28 +0000 (13:31 -0400)
The intent of the checks for in_multi_mode() was really checking for
whether or not we *have* vcore context.  Since even SCPs have vcore
context (vcore 0) and the kernel can drop an SCP into vcore context
when an event arrives (a "notification"), then even SCPs need to worry
about disabling and enabling notifs.

Note that there is a brief time before vcore 0's context is set up for
the SCPs, which occurs in the vcore_lib_init() constructor.  That's all
before anything from parlib should be called, including the functions
changed here.

user/parlib/include/vcore.h
user/parlib/uthread.c

index 64742e1..59b14b8 100644 (file)
@@ -278,8 +278,7 @@ static inline uint64_t vcore_account_uptime_nsec(uint32_t vcoreid)
                 * enabling notifs.  See 6c7fb12 and 5e4825eb4 for details. */         \
                caller->flags &= ~UTHREAD_DONT_MIGRATE;                                \
                cmb();  /* turn off DONT_MIGRATE before enabling notifs */             \
-               if (in_multi_mode())                                                   \
-                       enable_notifs(vcoreid);                                            \
+               enable_notifs(vcoreid);                                                \
        }                                                                          \
 }
 
index ff196a3..e18509d 100644 (file)
@@ -754,7 +754,7 @@ bool __check_preempt_pending(uint32_t vcoreid)
  * uth_enable_notifs() unless you know what you're doing. */
 void uth_disable_notifs(void)
 {
-       if (!in_vcore_context() && in_multi_mode()) {
+       if (!in_vcore_context()) {
                assert(current_uthread);
                if (current_uthread->notif_disabled_depth++)
                        goto out;
@@ -763,14 +763,13 @@ void uth_disable_notifs(void)
                disable_notifs(vcore_id());
        }
 out:
-       if (in_multi_mode())
-               assert(!notif_is_enabled(vcore_id()));
+       assert(!notif_is_enabled(vcore_id()));
 }
 
 /* Helper: Pair this with uth_disable_notifs(). */
 void uth_enable_notifs(void)
 {
-       if (!in_vcore_context() && in_multi_mode()) {
+       if (!in_vcore_context()) {
                assert(current_uthread);
                if (--current_uthread->notif_disabled_depth)
                        return;