From: Jack Lange Date: Mon, 5 Apr 2010 23:18:09 +0000 (-0500) Subject: moved timer injection to track total time instead of guest time X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=1cd3b14a43f9c550a74c25dff43177e55192ceb1;p=palacios.git moved timer injection to track total time instead of guest time --- diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index d4a6fd7..6de0781 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -467,8 +467,10 @@ int v3_svm_enter(struct guest_info * info) { #endif + rdtscll(tmp_tsc); + v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); rdtscll(info->time_state.cached_host_tsc); - guest_ctrl->TSC_OFFSET = info->time_state.guest_tsc - info->time_state.cached_host_tsc; + // guest_ctrl->TSC_OFFSET = info->time_state.guest_tsc - info->time_state.cached_host_tsc; //V3_Print("Calling v3_svm_launch\n"); @@ -479,13 +481,14 @@ int v3_svm_enter(struct guest_info * info) { v3_last_exit = (uint32_t)(guest_ctrl->exit_code); - rdtscll(tmp_tsc); + //rdtscll(tmp_tsc); + // v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); //PrintDebug("SVM Returned\n"); info->num_exits++; - v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); + // Save Guest state from VMCB diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index 4c37ddf..e8d32ed 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -658,6 +658,9 @@ int v3_vmx_enter(struct guest_info * info) { vmcs_write(VMCS_GUEST_CR3, guest_cr3); } + // We do timer injection here to track real host time. + rdtscll(tmp_tsc); + v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); rdtscll(info->time_state.cached_host_tsc); if (info->vm_info->run_state == VM_STOPPED) { @@ -678,11 +681,11 @@ int v3_vmx_enter(struct guest_info * info) { return -1; } - rdtscll(tmp_tsc); + // rdtscll(tmp_tsc); + // v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); info->num_exits++; - v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); /* Update guest state */ v3_vmx_save_vmcs(info);