parlib: Fix u32/u64 issue with pvcalarm
[akaros.git] / tests / lock_test.c
index 337d346..6072153 100644 (file)
 /* OS dependent #incs */
 #ifdef __ros__
 
-#include <parlib.h>
-#include <vcore.h>
-#include <timing.h>
-#include <spinlock.h>
-#include <mcs.h>
-#include <arch/arch.h>
-#include <event.h>
-
-#include <tsc-compat.h>
-#include <measure.h>
+#include <parlib/parlib.h>
+#include <parlib/stdio.h>
+#include <parlib/vcore.h>
+#include <parlib/timing.h>
+#include <parlib/spinlock.h>
+#include <parlib/mcs.h>
+#include <parlib/arch/arch.h>
+#include <parlib/event.h>
+
+#include <parlib/tsc-compat.h>
+#include <benchutil/measure.h>
 
 #else
 
-#include "../user/parlib/include/tsc-compat.h"
+#include "../user/parlib/include/parlib/tsc-compat.h"
 #include "misc-compat.h"
 #include "linux-lock-hacks.h" /* TODO: have a build system and lib / C file */
 
-#include "../user/benchutil/include/measure.h"
+#include "../user/benchutil/include/benchutil/measure.h"
 #include "../user/benchutil/measure.c"
 
 static void os_prep_work(pthread_t *worker_threads, int nr_threads)
@@ -445,7 +446,7 @@ __thread int __vcore_context = 0;
  */
 
 const char *argp_program_version = "lock_test v0.1475263";
-const char *argp_program_bug_address = "<akaros@lists.eecs.berkeley.edu>";
+const char *argp_program_bug_address = "<akaros+subscribe@googlegroups.com>";
 
 static char doc[] = "lock_test -- spinlock benchmarking";
 static char args_doc[] = "-w NUM -l NUM -t LOCK";
@@ -732,9 +733,9 @@ static void os_prep_work(pthread_t *worker_threads, int nr_threads)
        atomic_init(&indir_idx, 0);
        atomic_init(&preempt_cnt, 0);
        atomic_init(&indir_cnt, 0);
-       pthread_can_vcore_request(FALSE);       /* 2LS won't manage vcores */
+       parlib_never_yield = TRUE;
        pthread_need_tls(FALSE);
-       pthread_lib_init();                                     /* gives us one vcore */
+       pthread_mcp_init();                                     /* gives us one vcore */
        register_ev_handler(EV_VCORE_PREEMPT, trace_preempt, 0);
        register_ev_handler(EV_CHECK_MSGS, trace_indir, 0);
        if (pargs.fake_vc_ctx) {
@@ -743,11 +744,8 @@ 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)) {
-               printf("Failed to request %d more vcores, currently have %d\n",
-                      nr_threads - 1, num_vcores());
-               exit(-1);
-       }
+       vcore_request_total(nr_threads);
+       parlib_never_vc_request = TRUE;
        for (int i = 0; i < nr_threads; i++) {
                printd("Vcore %d mapped to pcore %d\n", i,
                       __procinfo.vcoremap[i].pcoreid);