Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


MOre minor fixes
Patrick G. Bridges [Fri, 1 Oct 2010 18:27:16 +0000 (12:27 -0600)]
palacios/include/palacios/vmm_time.h
palacios/src/palacios/vmm.c
palacios/src/palacios/vmm_time.c
palacios/src/palacios/vmx.c

index 3f1ad95..3f6bbac 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <palacios/vmm_types.h>
 #include <palacios/vmm_list.h>
+#include <palacios/vmm_util.h>
 
 struct guest_info;
 
@@ -71,8 +72,16 @@ void v3_init_time(struct guest_info * info);
 int v3_start_time(struct guest_info * info);
 int v3_pause_time(struct guest_info * info);
 int v3_resume_time(struct guest_info * info);
-uint64_t v3_get_host_time(struct guest_info * info);
-uint64_t v3_get_guest_time(struct guest_info * info);
+
+static inline uint64_t v3_get_host_time(struct vm_time *t) {
+    uint64_t tmp;
+    rdtscll(tmp);
+    return tmp;
+}
+
+static inline uint64_t v3_get_guest_time(struct vm_time *t) {
+    return v3_get_host_time(t) + t->host_offset;
+}
 #endif // !__V3VEE__
 
 #endif
index 8e45d5b..9061ab7 100644 (file)
@@ -277,7 +277,7 @@ v3_cpu_mode_t v3_get_host_cpu_mode() {
 
 void v3_yield_cond(struct guest_info * info) {
     uint64_t cur_cycle;
-    rdtscll(cur_cycle);
+    cur_cycle = v3_get_host_time(&info->time_state);
 
     if (cur_cycle > (info->yield_start_cycle + info->vm_info->yield_cycle_period)) {
 
@@ -286,7 +286,7 @@ void v3_yield_cond(struct guest_info * info) {
          (void *)cur_cycle, (void *)info->yield_start_cycle, (void *)info->yield_cycle_period);
        */
        V3_Yield();
-       rdtscll(info->yield_start_cycle);
+       info->yield_start_cycle = v3_get_host_time(&info->time_state);
     }
 }
 
@@ -300,7 +300,7 @@ void v3_yield(struct guest_info * info) {
     V3_Yield();
 
     if (info) {
-       rdtscll(info->yield_start_cycle);
+       info->yield_start_cycle = v3_get_host_time(&info->time_state);
     }
 }
 
index 3604bc2..874f6ea 100644 (file)
@@ -12,6 +12,7 @@
  * All rights reserved.
  *
  * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *         Patrick G. Bridges <bridges@cs.unm.edu>
  *
  * This is free software.  You are permitted to use,
  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
@@ -53,20 +54,9 @@ void v3_init_time(struct guest_info * info) {
     v3_register_hypercall(info->vm_info, TIME_CPUFREQ_HCALL, handle_cpufreq_hcall, NULL);
 }
 
-uint64_t v3_get_host_time(struct guest_info * info) {
-    uint64_t tmp;
-    rdtscll(tmp);
-    return tmp;
-}
-
-uint64_t v3_get_guest_time(struct guest_info * info) {
-    return v3_get_host_time(info) + info->time_state.host_offset;
-}
-
-
 int v3_start_time(struct guest_info * info) {
     /* We start running with guest_time == host_time */
-    uint64_t t = v3_get_host_time(info); 
+    uint64_t t = v3_get_host_time(&info->time_state); 
 
     PrintDebug("Starting initial guest time as %llu\n", t);
     info->time_state.last_update = t;
@@ -76,18 +66,18 @@ int v3_start_time(struct guest_info * info) {
 
 int v3_pause_time(struct guest_info * info) {
     V3_ASSERT(info->time_state.pause_time == 0);
-    info->time_state.pause_time = v3_get_guest_time(info);
+    info->time_state.pause_time = v3_get_guest_time(&info->time_state);
     PrintDebug("Time paused at guest time as %llu\n", 
               info->time_state.pause_time);
     return 0;
 }
 
 int v3_resume_time(struct guest_info * info) {
-    uint64_t t = v3_get_host_time(info);
+    uint64_t t = v3_get_host_time(&info->time_state);
     V3_ASSERT(info->time_state.pause_time != 0);
     info->time_state.host_offset = 
        (sint64_t)info->time_state.pause_time - (sint64_t)t;
-#ifdef OPTION_TIME_ADJUST_TSC_OFFSET
+#ifdef CONFIG_TIME_TSC_OFFSET_ADJUST
     /* XXX Adjust host_offset towards zero based on resolution/accuracy
      * constraints. */
 #endif
@@ -127,7 +117,7 @@ void v3_update_timers(struct guest_info * info) {
     uint64_t old_time = info->time_state.last_update;
     uint64_t cycles;
 
-    info->time_state.last_update = v3_get_guest_time(info);
+    info->time_state.last_update = v3_get_guest_time(&info->time_state);
     cycles = info->time_state.last_update - old_time;
 
     list_for_each_entry(tmp_timer, &(info->time_state.timers), timer_link) {
index bb93054..9a2e859 100644 (file)
@@ -670,8 +670,11 @@ int v3_vmx_enter(struct guest_info * info) {
     tsc_offset_high = 
        (uint32_t)((info->time_state.host_offset >> 32) & 0xffffffff);
     tsc_offset_low = (uint32_t)(info->time_state.host_offset & 0xffffffff);
+#ifdef CONFIG_TIME_TSC_OFFSET
     check_vmcs_write(VMCS_TSC_OFFSET_HIGH, tsc_offset_high);
     check_vmcs_write(VMCS_TSC_OFFSET, tsc_offset_low);
+#endif
+
     PrintDebug("Stored 0x %x %x into vmcs TSC offset.\n", 
               tsc_offset_high, tsc_offset_low);
     if (info->vm_info->run_state == VM_STOPPED) {