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.


Timed yielding in vmm_halt to avoid pegging CPU
[palacios.git] / palacios / src / palacios / vmm.c
index cef9ff5..1bd489b 100644 (file)
@@ -679,13 +679,6 @@ v3_cpu_mode_t v3_get_host_cpu_mode() {
 #endif 
 
 
-#define V3_Yield(addr)                                 \
-    do {                                               \
-       extern struct v3_os_hooks * os_hooks;           \
-       if ((os_hooks) && (os_hooks)->yield_cpu) {      \
-           (os_hooks)->yield_cpu();                    \
-       }                                               \
-    } while (0)                                                \
 
 
 
@@ -698,8 +691,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,11 +706,23 @@ 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;
     }
 }
 
 
+/*
+ * unconditional cpu yield for a period of time
+ * Otherwise identical to v3_yield
+ */
+void v3_yield_timed(struct guest_info *info, unsigned int usec)
+{
+    V3_Yield_Timed(usec);
+    
+    if (info) { 
+       info->yield_start_cycle += info->vm_info->yield_cycle_period;
+    }
+}
 
 
 void v3_print_cond(const char * fmt, ...) {