_S processes properly map/unmap vcore 0
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 26 Sep 2011 20:32:01 +0000 (13:32 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:36:07 +0000 (17:36 -0700)
To make __death easier, vcore 0 is mapped to whatever pcore the process
is running on in _S.  We were a bit lazy about unmapping it.

kern/src/process.c
kern/src/resource.c
kern/src/syscall.c

index 56724d9..c7b87b1 100644 (file)
@@ -514,7 +514,8 @@ void proc_run(struct proc *p)
                        __seq_start_write(&p->procinfo->coremap_seqctr);
                        p->procinfo->num_vcores = 0;    /* TODO (VC#) */
                        /* TODO: For now, we won't count this as an active vcore (on the
-                        * lists).  This gets unmapped in resource.c, and needs work. */
+                        * lists).  This gets unmapped in resource.c and yield_s, and needs
+                        * work. */
                        __map_vcore(p, 0, core_id()); // sort of.  this needs work.
                        __seq_end_write(&p->procinfo->coremap_seqctr);
                        /* __set_proc_current assumes the reference we give it is for
@@ -762,6 +763,7 @@ void __proc_yield_s(struct proc *p, struct trapframe *tf)
        assert(p->state == PROC_RUNNING_S);
        p->env_tf= *tf;
        env_push_ancillary_state(p);                    /* TODO: (HSS) */
+       __unmap_vcore(p, 0);    /* VC# keep in sync with proc_run _S */
        __proc_set_state(p, PROC_RUNNABLE_S);
        schedule_proc(p);
 }
index e446e9d..b2e3d52 100644 (file)
@@ -137,7 +137,7 @@ ssize_t core_request(struct proc *p)
                                __seq_start_write(&p->procinfo->coremap_seqctr);
                                // TODO: (VC#) might need to adjust num_vcores
                                // TODO: (ACR) will need to unmap remotely (receive-side)
-                               __unmap_vcore(p, 0);    /* keep in sync with proc_run _S */
+                               __unmap_vcore(p, 0);    /* VC# keep in sync with proc_run _S */
                                __seq_end_write(&p->procinfo->coremap_seqctr);
                                // will need to give up this core / idle later (sync)
                                need_to_idle = TRUE;
index c11e95a..e135f0d 100644 (file)
@@ -555,6 +555,7 @@ early_error:
 success:
        /* Here's how we'll restart the new (or old) process: */
        spin_lock(&p->proc_lock);
+       __unmap_vcore(p, 0);    /* VC# keep in sync with proc_run _S */
        __proc_set_state(p, PROC_RUNNABLE_S);
        schedule_proc(p);
        spin_unlock(&p->proc_lock);