Rename vcore_request() -> vcore_request_more()
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 24 Feb 2016 22:00:19 +0000 (17:00 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 2 May 2016 21:11:15 +0000 (17:11 -0400)
vcore_request() takes an incremental number of vcores.  That is a little
confusing, when compared to an interface that takes an absolute number of
cores.

The rename of most of the usages was done with this spatch:

@@
expression NR;
@@
-vcore_request(NR)
+vcore_request_more(NR)

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
19 files changed:
tests/lock_test.c
tests/mcp_halt.c
tests/mhello.c
tests/old/condvar_test.c
tests/old/eth_audio.c
tests/old/manycore_test.c
tests/old/mproctests.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/parlib/include/parlib/vcore.h
user/parlib/vcore.c
user/pthread/pthread.c
user/utest/pvcalarm.c

index a92dab0..8ad9bdd 100644 (file)
@@ -743,7 +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(nr_threads - 1)) {
+       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);
index 52fce18..e79a69f 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(nr_vcores - 1); /* since we already have 1 */
+       vcore_request_more(nr_vcores - 1); /* since we already have 1 */
 
        while (1)
                sys_halt_core(0);
index b6f0abf..2ef9cea 100644 (file)
@@ -88,7 +88,7 @@ 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(max_vcores() - 1); /* since we already have 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_context test */
@@ -174,7 +174,7 @@ void ghetto_vcore_entry(void)
        udelay(10000000);
        #endif
 
-       vcore_request(1);
+       vcore_request_more(1);
        udelay(vcoreid * 10000000);
        //exit(0);
        while(1);
index 89bcab1..d7397a4 100644 (file)
@@ -124,7 +124,7 @@ int main(void)
         * 2LSs VC management and got up to 2 VC.  Assuming no preemption. */
        pthread_can_vcore_request(FALSE);       /* 2LS won't manage vcores */
        while (num_vcores() < 2)
-               vcore_request(1);
+               vcore_request_more(1);
        for (long i = 0; i < 1000; i++) {
                for (int j = 0; j < 10; j++) {  /* some extra chances at each point */
                        state = FALSE;
index 0447bde..2d39b1c 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(1);
+       retval = vcore_request_more(1);
 
        /* Stay alive for a minute (will take interrupts) */
        udelay(60000000);
index 37cc2a9..0eb8953 100644 (file)
@@ -26,7 +26,7 @@ int main(int argc, char** argv)
 {
        assert(vcore_id() == 0);
        mcs_barrier_init(&b,max_vcores());
-       vcore_request(max_vcores()-1);
+       vcore_request_more(max_vcores() - 1);
        do_work_son(0);
        return 0;
 }
index cdbe1c3..3160b55 100644 (file)
@@ -53,19 +53,19 @@ int main(int argc, char** argv)
                                printf("Should not see me!!!!!!!!!!!!!!!!!!\n");
                                while(1);
                        case TEST_ONE_CORE:
-                               retval = vcore_request(1);
+                               retval = vcore_request_more(1);
                                printf("One core test's core0's retval: %d\n", retval);
                                printf("Check to see it's on a worker core.\n");
                                while(1);
                        case TEST_ASK_FOR_TOO_MANY_CORES:
-                               retval = vcore_request(12);
+                               retval = vcore_request_more(12);
                                printf("Asked for too many, retval: %d\n", retval);
                                return 0;
                        case TEST_INCREMENTAL_CHANGES:
-                               retval = vcore_request(4);
+                               retval = vcore_request_more(4);
                                break;
                        default:
-                               retval = vcore_request(5);
+                               retval = vcore_request_more(5);
                }
                if (retval)
                        panic("failed to allocate cores!");
@@ -78,7 +78,7 @@ int main(int argc, char** argv)
                case TEST_YIELD_OUT_OF_ORDER:
                        udelay(10000000);
                        printf("Core 2 should have yielded, asking for another\n");
-                       retval = vcore_request(5);
+                       retval = vcore_request_more(5);
                        break;
                case TEST_YIELD_0_OUT_OF_ORDER:
                        udelay(5000000);
@@ -109,12 +109,12 @@ void vcore_entry(void)
                                // Testing asking for less than we already have
                                udelay(1000000);
                                printf("Asking for too few:\n");
-                               retval = vcore_request(2);
+                               retval = vcore_request_more(2);
                                printf("Should be -EINVAL(7): %d\n", retval);
                                // Testing getting more while running
                                printf("Asking for more while running:\n");
                                udelay(1000000);
-                               retval = vcore_request(5);
+                               retval = vcore_request_more(5);
                                printf("core2's retval: %d\n", retval);
                                break;
                        case TEST_YIELD_OUT_OF_ORDER:
@@ -124,7 +124,7 @@ void vcore_entry(void)
                        case TEST_YIELD_0_OUT_OF_ORDER:
                                udelay(7500000);
                                printf("Core 0 should have yielded, asking for another\n");
-                               retval = vcore_request(5);
+                               retval = vcore_request_more(5);
                }
        }
        global_tests(vcoreid);
@@ -144,7 +144,7 @@ static void global_tests(uint32_t vcoreid)
                        if (vcoreid == 2) {
                                printf("Core %d trying to request 0/ switch to _S\n", vcoreid);
                                udelay(3000000);
-                               retval = vcore_request(0);
+                               retval = vcore_request_more(0);
                                // will only see this if we are scheduled()
                                printf("Core %d back up! (retval:%d)\n", vcoreid, retval);
                                printf("And exiting\n");
@@ -153,7 +153,7 @@ static void global_tests(uint32_t vcoreid)
                        while(1);
                case TEST_CRAZY_YIELDS:
                        udelay(300000*vcoreid);
-                       vcore_request(5);
+                       vcore_request_more(5);
                        sys_yield(0);
                        printf("should  never see me, unless you slip into *_S\n");
                        break;
index ad1fc61..a785715 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(max_vcores());
+       vcore_request_more(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(max_vcores() - 1); /* since we already have 1 */
+                       vcore_request_more(max_vcores() - 1); /* since we already have 1 */
                        mcs_barrier_wait(&b, vcoreid);
                        end = read_tsc();
                        printf("Took %llu usec (%llu nsec) to get my yielded cores back.\n",
index 5e8e9c4..4588124 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(max_vcores());
+       vcore_request_more(max_vcores());
 
        /* should never make it here */
        return -1;
index c13d19b..34d1c78 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(max_vcores());
+       retval = vcore_request_more(max_vcores());
        if (retval)
                printf("Fucked!\n");
        mcs_barrier_wait(&b, vcoreid);
@@ -68,7 +68,7 @@ int main(int argc, char** argv)
               udiff(begin, end), ndiff(begin, end), max_vcores());
        udelay(5000000);
        begin = read_tsc();
-       retval = vcore_request(max_vcores() - 1);
+       retval = vcore_request_more(max_vcores() - 1);
        if (retval)
                printf("Fucked!\n");
        mcs_barrier_wait(&b, vcoreid);
index 983c258..823d774 100644 (file)
@@ -49,13 +49,13 @@ int main(int argc, char** argv)
 /* end: stuff userspace needs to do before switching to multi-mode */
 
        /* get into multi mode */
-       retval = vcore_request(1);
+       retval = vcore_request_more(1);
        if (retval)
                printf("Fucked!\n");
 
        printf("Proc %d requesting another vcore\n", getpid());
        begin = read_tsc();
-       retval = vcore_request(1);
+       retval = vcore_request_more(1);
        if (retval)
                printf("Fucked!\n");
        while (!core1_up)
@@ -69,7 +69,7 @@ int main(int argc, char** argv)
        udelay(2000000);
        printf("Proc %d requesting the vcore again\n", getpid());
        begin = read_tsc();
-       retval = vcore_request(1);
+       retval = vcore_request_more(1);
        if (retval)
                printf("Fucked!\n");
        while (!core1_up)
index 92baa2b..58e17db 100644 (file)
@@ -63,7 +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(1);
+       retval = vcore_request_more(1);
        if (retval < 0)
                printf("No cores granted, Rut Ro Raggy!\n");
        /* now we're back in thread 0 on vcore 0 */
index 339fc20..2408454 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(nr_vcores - 1);           /* ghetto incremental interface */
+               vcore_request_more(nr_vcores - 1);              /* ghetto incremental interface */
                for (int i = 0; i < nr_vcores; i++) {
                        printd("Vcore %d mapped to pcore %d\n", i,
                                   __procinfo.vcoremap[i].pcoreid);
index 45bc45c..fa3ff32 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(nr_vcores - 1);           /* ghetto incremental interface */
+               vcore_request_more(nr_vcores - 1);              /* ghetto incremental interface */
                for (int i = 0; i < nr_vcores; i++) {
                        printf_safe("Vcore %d mapped to pcore %d\n", i,
                                    __procinfo.vcoremap[i].pcoreid);
index 2439433..c29d19e 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(nr_threads - 1);          /* ghetto incremental interface */
+               vcore_request_more(nr_threads - 1);             /* ghetto incremental interface */
                for (int i = 0; i < nr_threads; i++) {
                        xp = __procinfo.vcoremap;
                        fprintf(stderr, "%p\n", __procinfo.vcoremap);
index 975dc4e..aa7d48b 100644 (file)
@@ -53,7 +53,7 @@ static inline uint64_t vcore_account_resume_nsec(uint32_t vcoreid);
 static inline uint64_t vcore_account_total_nsec(uint32_t vcoreid);
 void vcore_lib_init(void);
 void vcore_change_to_m(void);
-int vcore_request(long nr_new_vcores);
+int vcore_request_more(long nr_new_vcores);
 void vcore_yield(bool preempt_pending);
 void vcore_reenter(void (*entry_func)(void));
 void enable_notifs(uint32_t vcoreid);
index e59105f..96e099c 100644 (file)
@@ -241,7 +241,7 @@ void vcore_change_to_m(void)
  * num_vcores().  num_vcores() is how many you have now or very soon (accounting
  * for messages in flight that will take your cores), not how many you told the
  * kernel you want. */
-int vcore_request(long nr_new_vcores)
+int vcore_request_more(long nr_new_vcores)
 {
        long nr_to_prep_now, nr_vcores_wanted;
 
index 31f6e51..9dd4254 100644 (file)
@@ -161,7 +161,7 @@ static void pth_thread_runnable(struct uthread *uthread)
        /* Smarter schedulers should look at the num_vcores() and how much work is
         * going on to make a decision about how many vcores to request. */
        if (can_adjust_vcores)
-               vcore_request(threads_ready);
+               vcore_request_more(threads_ready);
 }
 
 /* For some reason not under its control, the uthread stopped running (compared
@@ -936,7 +936,7 @@ static void wake_slist(struct pthread_list *to_wake)
        threads_ready += nr_woken;
        mcs_pdr_unlock(&queue_lock);
        if (can_adjust_vcores)
-               vcore_request(threads_ready);
+               vcore_request_more(threads_ready);
 }
 
 int pthread_cond_broadcast(pthread_cond_t *c)
index 09e0eaa..0b57fd4 100644 (file)
@@ -16,7 +16,7 @@ bool test_pvcalarms(void) {
 
        pthread_can_vcore_request(FALSE);
        pthread_mcp_init();
-       vcore_request(max_vcores() - num_vcores());
+       vcore_request_more(max_vcores() - num_vcores());
        for (int i=0; i<max_vcores(); i++)
                count[i] = 0;