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 work on time fixing/debugging
Patrick G. Bridges [Fri, 20 Apr 2012 22:34:16 +0000 (16:34 -0600)]
palacios/include/palacios/vmm_time.h
palacios/src/palacios/vmm.c
palacios/src/palacios/vmm_time.c

index 16b8371..4a35cc2 100644 (file)
@@ -120,7 +120,7 @@ static inline uint64_t v3_get_guest_tsc(struct vm_core_time *t) {
 // Returns offset of guest TSC from host TSC
 static inline sint64_t v3_tsc_host_offset(struct vm_core_time *time_state) {
     uint64_t host_time = v3_get_host_time(time_state);
-    return ((sint64_t)host_time - (sint64_t)time_state->guest_cycles) + time_state->tsc_guest_offset;
+    return ((sint64_t)time_state->guest_cycles - (sint64_t)host_time) + time_state->tsc_guest_offset;
 }
 
 // Functions for handling exits on the TSC when fully virtualizing 
index cef9ff5..ff5a55c 100644 (file)
@@ -698,8 +698,8 @@ void v3_yield_cond(struct guest_info * info) {
        //           (void *)cur_cycle, (void *)info->yield_start_cycle, 
        //         (void *)info->yield_cycle_period);
        
-       info->yield_start_cycle += info->vm_info->yield_cycle_period;
        V3_Yield();
+        info->yield_start_cycle +=  info->vm_info->yield_cycle_period;
     }
 }
 
@@ -713,7 +713,7 @@ void v3_yield(struct guest_info * info) {
     V3_Yield();
 
     if (info) {
-       info->yield_start_cycle = v3_get_host_time(&info->time_state);
+        info->yield_start_cycle +=  info->vm_info->yield_cycle_period;
     }
 }
 
index cdd9040..491ceab 100644 (file)
@@ -211,6 +211,7 @@ int v3_rdtsc(struct guest_info * info) {
 }
 
 int v3_handle_rdtsc(struct guest_info * info) {
+    PrintDebug("Handling virtual RDTSC call.\n");
     v3_rdtsc(info);
     
     info->vm_regs.rax &= 0x00000000ffffffffLL;
@@ -246,7 +247,7 @@ int v3_rdtscp(struct guest_info * info) {
 
 
 int v3_handle_rdtscp(struct guest_info * info) {
-  PrintDebug("Handling virtual RDTSCP call.\n");
+    PrintDebug("Handling virtual RDTSCP call.\n");
 
     v3_rdtscp(info);
 
@@ -287,6 +288,7 @@ static int tsc_msr_read_hook(struct guest_info *info, uint_t msr_num,
                             struct v3_msr *msr_val, void *priv) {
     uint64_t time = v3_get_guest_tsc(&info->time_state);
 
+    PrintDebug("Handling virtual TSC MSR read call.\n");
     V3_ASSERT(msr_num == TSC_MSR);
 
     msr_val->hi = time >> 32;
@@ -300,14 +302,15 @@ static int tsc_msr_write_hook(struct guest_info *info, uint_t msr_num,
     struct vm_core_time * time_state = &(info->time_state);
     uint64_t guest_time, new_tsc;
 
-           V3_ASSERT(msr_num == TSC_MSR);
+    PrintDebug("Handling virtual TSC MSR write call.\n");
+    V3_ASSERT(msr_num == TSC_MSR);
 
-           new_tsc = (((uint64_t)msr_val.hi) << 32) | (uint64_t)msr_val.lo;
-           guest_time = v3_get_guest_time(time_state);
-           time_state->tsc_guest_offset = (sint64_t)(new_tsc - guest_time); 
+    new_tsc = (((uint64_t)msr_val.hi) << 32) | (uint64_t)msr_val.lo;
+    guest_time = v3_get_guest_time(time_state);
+    time_state->tsc_guest_offset = (sint64_t)(new_tsc - guest_time); 
 
-           return 0;
-       }
+    return 0;
+}
 
 static int
 handle_time_configuration(struct v3_vm_info * vm, v3_cfg_tree_t *cfg) {