From: Patrick G. Bridges Date: Fri, 7 Oct 2011 15:47:32 +0000 (-0600) Subject: Cleaned up configuration of time management; most advanced time features are X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=281d544b5352321631fb51c394e1ae0a9680b752 Cleaned up configuration of time management; most advanced time features are now marked as experimental. TSC offseting support is turned back on in svm.c and vmx.c, but the offset should now always be zero unless time dilation support is turned on (and it is currently broken). --- diff --git a/Kconfig b/Kconfig index b7fc9a0..8518fd8 100644 --- a/Kconfig +++ b/Kconfig @@ -212,16 +212,19 @@ endmenu menu "Time Management" -config VIRTUALIZE_TIME - bool "Enable Time virtualization" +config TIME_DILATION + bool "Control Guest/Host Time Offseting" default n + depends on EXPERIMENTAL help - Enables the timer virtualization extensions - + Controls the relative speeds of the guest and host processor + to allow the VM to provide the illusion of the guest seeing time + pass at a different rate than the host system does. + config TIME_HIDE_VM_COST bool "Hide VMM Run Cost" default n - depends on VIRTUALIZE_TIME + depends on EXPERIMENTAL help Offset guest time from host time sufficiently to hide the cost of running in the virtual machine. This can aid the consistency of @@ -231,12 +234,12 @@ config TIME_HIDE_VM_COST config TIME_VIRTUALIZE_TSC bool "Fully virtualize guest TSC" default n - depends on VIRTUALIZE_TIME + depends on EXPERIMENTAL help Virtualize the processor time stamp counter in the guest, generally increasing consistency between various time sources but also potentially making guest time run slower than real time. - + endmenu diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 6064855..cd741c9 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -569,7 +569,7 @@ int v3_svm_enter(struct guest_info * info) { #endif v3_time_enter_vm(info); - // guest_ctrl->TSC_OFFSET = v3_tsc_host_offset(&info->time_state); + guest_ctrl->TSC_OFFSET = v3_tsc_host_offset(&info->time_state); //V3_Print("Calling v3_svm_launch\n"); diff --git a/palacios/src/palacios/vmm_time.c b/palacios/src/palacios/vmm_time.c index fa8f5cd..fd4a2e8 100644 --- a/palacios/src/palacios/vmm_time.c +++ b/palacios/src/palacios/vmm_time.c @@ -104,6 +104,7 @@ int v3_offset_time( struct guest_info * info, sint64_t offset ) return 0; } +#ifdef V3_CONFIG_TIME_DILATION static uint64_t compute_target_host_time(struct guest_info * info) { struct vm_time * time_state = &(info->time_state); @@ -194,11 +195,13 @@ static int skew_guest_time(struct guest_info * info) { return 0; } +#endif /* V3_CONFIG_TIME_DILATION */ // Control guest time in relation to host time so that the two stay // appropriately synchronized to the extent possible. int v3_adjust_time(struct guest_info * info) { +#ifdef V3_CONFIG_TIME_DILATION /* First deal with yielding if we want to slow down the guest */ yield_host_time(info); @@ -206,7 +209,7 @@ int v3_adjust_time(struct guest_info * info) { * or because the VMM is doing something that takes a long time to emulate) * allow guest time to jump forward a bit */ skew_guest_time(info); - +#endif return 0; } @@ -231,7 +234,11 @@ v3_time_enter_vm( struct guest_info * info ) host_time = v3_get_host_time(time_state); guest_time = v3_get_guest_time(time_state); time_state->enter_time = host_time; +#ifdef V3_CONFIG_TIME_DILATION time_state->guest_host_offset = (sint64_t)guest_time - (sint64_t)host_time; +#else + time_state->guest_host_offset = 0; +#endif return 0; } diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index bdfc8c0..ca875bb 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -750,7 +750,7 @@ static void print_exit_log(struct guest_info * info) { */ int v3_vmx_enter(struct guest_info * info) { int ret = 0; - //uint32_t tsc_offset_low, tsc_offset_high; + uint32_t tsc_offset_low, tsc_offset_high; struct vmx_exit_info exit_info; struct vmx_data * vmx_info = (struct vmx_data *)(info->vmm_data); @@ -795,10 +795,10 @@ int v3_vmx_enter(struct guest_info * info) { // Perform last-minute time bookkeeping prior to entering the VM v3_time_enter_vm(info); - // tsc_offset_high = (uint32_t)((v3_tsc_host_offset(&info->time_state) >> 32) & 0xffffffff); - // tsc_offset_low = (uint32_t)(v3_tsc_host_offset(&info->time_state) & 0xffffffff); - // check_vmcs_write(VMCS_TSC_OFFSET_HIGH, tsc_offset_high); - // check_vmcs_write(VMCS_TSC_OFFSET, tsc_offset_low); + tsc_offset_high = (uint32_t)((v3_tsc_host_offset(&info->time_state) >> 32) & 0xffffffff); + tsc_offset_low = (uint32_t)(v3_tsc_host_offset(&info->time_state) & 0xffffffff); + check_vmcs_write(VMCS_TSC_OFFSET_HIGH, tsc_offset_high); + check_vmcs_write(VMCS_TSC_OFFSET, tsc_offset_low); if (v3_update_vmcs_host_state(info)) { v3_enable_ints();