Replace uses of the "ghetto incremental interface"
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 25 Feb 2016 16:10:39 +0000 (11:10 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 2 May 2016 21:11:15 +0000 (17:11 -0400)
Many places that were using vcore_request_more() really wanted to use
vcore_request_total().

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
14 files changed:
tests/lock_test.c
tests/mcp_halt.c
tests/mhello.c
tests/old/eth_audio.c
tests/old/manycore_test.c
tests/old/msr_cycling_vcores.c
tests/old/msr_dumb_while.c
tests/old/msr_get_cores.c
tests/old/msr_get_singlecore.c
tests/old/syscall.c
tests/pthread_barrier_test.c
tests/pthread_test.c
tests/vmm/vmrunkernel.c
user/utest/pvcalarm.c

index 8ad9bdd..80e2a2a 100644 (file)
@@ -743,11 +743,7 @@ static void os_prep_work(pthread_t *worker_threads, int nr_threads)
                clear_kevent_q(EV_VCORE_PREEMPT);
                clear_kevent_q(EV_CHECK_MSGS);
        }
-       if (vcore_request_more(nr_threads - 1)) {
-               printf("Failed to request %d more vcores, currently have %d\n",
-                      nr_threads - 1, num_vcores());
-               exit(-1);
-       }
+       vcore_request_total(nr_threads);
        for (int i = 0; i < nr_threads; i++) {
                printd("Vcore %d mapped to pcore %d\n", i,
                       __procinfo.vcoremap[i].pcoreid);
index e79a69f..4231581 100644 (file)
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
         * just mhello showing its warts due to trying to work outside uthread.c */
        ros_syscall_blockon = __ros_syscall_spinon;
 
-       vcore_request_more(nr_vcores - 1); /* since we already have 1 */
+       vcore_request_total(nr_vcores);
 
        while (1)
                sys_halt_core(0);
index 2ef9cea..8d0d09c 100644 (file)
@@ -38,7 +38,6 @@ static void __ros_syscall_spinon(struct syscall *sysc)
 int main(int argc, char** argv)
 {
        uint32_t vcoreid;
-       int retval;
 
        /* vcore_context test */
        assert(!in_vcore_context());
@@ -88,9 +87,8 @@ int main(int argc, char** argv)
                       vcoreid, &temp, temp);
                printf("Multi-Goodbye, world, from PID: %d!\n", sys_getpid());
                printf("Requesting %d vcores\n", max_vcores() - 1);
-               retval = vcore_request_more(max_vcores() - 1); /* since we already have 1 */
-               //retval = vcore_request(5);
-               printf("This is vcore0, right after vcore_request, retval=%d\n", retval);
+               vcore_request_total(max_vcores());
+               printf("This is vcore0, right after vcore_request\n");
                /* vcore_context test */
                assert(!in_vcore_context());
        }
index 2d39b1c..cfb5de1 100644 (file)
@@ -65,7 +65,7 @@ int main()
 /* end: stuff userspace needs to do before switching to multi-mode */
        /* ETHAUD */
        /* Switch into _M mode */
-       retval = vcore_request_more(1);
+       vcore_request_total(1);
 
        /* Stay alive for a minute (will take interrupts) */
        udelay(60000000);
index 0eb8953..d33a740 100644 (file)
@@ -26,7 +26,7 @@ int main(int argc, char** argv)
 {
        assert(vcore_id() == 0);
        mcs_barrier_init(&b,max_vcores());
-       vcore_request_more(max_vcores() - 1);
+       vcore_request_total(max_vcores());
        do_work_son(0);
        return 0;
 }
index a785715..391ad07 100644 (file)
@@ -20,7 +20,7 @@ int main(int argc, char** argv)
        printf("Good chance this doesn't work anymore!\n");
        mcs_barrier_init(&b, max_vcores());
 
-       vcore_request_more(max_vcores());
+       vcore_request_total(max_vcores());
        printf("We're screwed!\n");
 
        /* should never make it here */
@@ -44,7 +44,7 @@ void vcore_entry(void)
                        udelay(15000000);
                        printf("Proc %d requesting its cores again\n", getpid());
                        begin = read_tsc();
-                       vcore_request_more(max_vcores() - 1); /* since we already have 1 */
+                       vcore_request_total(max_vcores());
                        mcs_barrier_wait(&b, vcoreid);
                        end = read_tsc();
                        printf("Took %llu usec (%llu nsec) to get my yielded cores back.\n",
index 4588124..6eb3f20 100644 (file)
@@ -14,7 +14,7 @@ int main(int argc, char** argv)
        /* Get EV_ALARM on vcore 1, with IPI. */
        enable_kevent(EV_ALARM, 1, EVENT_IPI | EVENT_VCORE_PRIVATE);
 
-       vcore_request_more(max_vcores());
+       vcore_request_total(max_vcores());
 
        /* should never make it here */
        return -1;
index 34d1c78..5d39981 100644 (file)
@@ -56,7 +56,7 @@ int main(int argc, char** argv)
 /* end: stuff userspace needs to do before switching to multi-mode */
 
        begin = read_tsc();
-       retval = vcore_request_more(max_vcores());
+       retval = vcore_request_total(max_vcores());
        if (retval)
                printf("Fucked!\n");
        mcs_barrier_wait(&b, vcoreid);
@@ -68,9 +68,7 @@ int main(int argc, char** argv)
               udiff(begin, end), ndiff(begin, end), max_vcores());
        udelay(5000000);
        begin = read_tsc();
-       retval = vcore_request_more(max_vcores() - 1);
-       if (retval)
-               printf("Fucked!\n");
+       vcore_request_total(max_vcores());
        mcs_barrier_wait(&b, vcoreid);
        end = read_tsc();
        printf("Took %llu usec (%llu nsec) to receive %d cores (warm).\n",
index 823d774..613b600 100644 (file)
@@ -49,9 +49,7 @@ int main(int argc, char** argv)
 /* end: stuff userspace needs to do before switching to multi-mode */
 
        /* get into multi mode */
-       retval = vcore_request_more(1);
-       if (retval)
-               printf("Fucked!\n");
+       vcore_request_total(1);
 
        printf("Proc %d requesting another vcore\n", getpid());
        begin = read_tsc();
index 58e17db..c711fec 100644 (file)
@@ -21,7 +21,7 @@ struct schedule_ops ghetto_sched_ops = {
 
 int main(int argc, char** argv)
 {
-       int num_started, retval;
+       int num_started;
        unsigned int ev_type;
 
        /* register our syscall handler (2LS does this) */
@@ -63,9 +63,7 @@ int main(int argc, char** argv)
        enable_notifs(0);
 /* end: stuff userspace needs to do before switching to multi-mode */
 
-       retval = vcore_request_more(1);
-       if (retval < 0)
-               printf("No cores granted, Rut Ro Raggy!\n");
+       vcore_request_total(1);
        /* now we're back in thread 0 on vcore 0 */
        ev_q->ev_flags = EVENT_IPI;
        ev_q->ev_vcore = 0;
index 2408454..1ab1fc6 100644 (file)
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
                /* Only do the vcore trickery if requested */
                pthread_can_vcore_request(FALSE);       /* 2LS won't manage vcores */
                pthread_mcp_init();                                     /* gives us one vcore */
-               vcore_request_more(nr_vcores - 1);              /* ghetto incremental interface */
+               vcore_request_total(nr_vcores);
                for (int i = 0; i < nr_vcores; i++) {
                        printd("Vcore %d mapped to pcore %d\n", i,
                                   __procinfo.vcoremap[i].pcoreid);
index fa3ff32..e0c7709 100644 (file)
@@ -85,7 +85,7 @@ int main(int argc, char** argv)
                pthread_can_vcore_request(FALSE);       /* 2LS won't manage vcores */
                pthread_need_tls(FALSE);
                pthread_mcp_init();                                     /* gives us one vcore */
-               vcore_request_more(nr_vcores - 1);              /* ghetto incremental interface */
+               vcore_request_total(nr_vcores);
                for (int i = 0; i < nr_vcores; i++) {
                        printf_safe("Vcore %d mapped to pcore %d\n", i,
                                    __procinfo.vcoremap[i].pcoreid);
index c29d19e..f4a8fe5 100644 (file)
@@ -846,7 +846,7 @@ int main(int argc, char **argv)
                pthread_can_vcore_request(FALSE);       /* 2LS won't manage vcores */
                pthread_need_tls(FALSE);
                pthread_mcp_init();                                     /* gives us one vcore */
-               vcore_request_more(nr_threads - 1);             /* ghetto incremental interface */
+               vcore_request_total(nr_threads);
                for (int i = 0; i < nr_threads; i++) {
                        xp = __procinfo.vcoremap;
                        fprintf(stderr, "%p\n", __procinfo.vcoremap);
index 0b57fd4..8cb8ec2 100644 (file)
@@ -16,7 +16,7 @@ bool test_pvcalarms(void) {
 
        pthread_can_vcore_request(FALSE);
        pthread_mcp_init();
-       vcore_request_more(max_vcores() - num_vcores());
+       vcore_request_total(max_vcores());
        for (int i=0; i<max_vcores(); i++)
                count[i] = 0;