X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=4a1b4044cd2d3bb1904da7cf5101cb176c764a54;hb=82b8b87c344fcd1eab22e3f3be5ad54cbb3f8f68;hp=6d8cdd28bfd350248c0ec029fd43c7cc4397bf65;hpb=50dd6f837443d6f5a8cfb2410f1f8d95e8367b6a;p=palacios.git diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 6d8cdd2..4a1b404 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -277,10 +277,14 @@ static int start_svm_guest(struct guest_info *info) { //PrintDebugVMCB((vmcb_t*)(info->vmm_data)); info->run_state = VM_RUNNING; - + rdtscll(info->yield_start_cycle); + + while (1) { ullong_t tmp_tsc; + // Conditionally yield the CPU if the timeslice has expired + v3_yield_cond(info); /* PrintDebug("SVM Entry to CS=%p rip=%p...\n", @@ -306,18 +310,24 @@ static int start_svm_guest(struct guest_info *info) { // reenable global interrupts after vm exit v3_stgi(); + + // Conditionally yield the CPU if the timeslice has expired + v3_yield_cond(info); + + v3_update_time(info, tmp_tsc - info->time_state.cached_host_tsc); num_exits++; if ((num_exits % 5000) == 0) { PrintDebug("SVM Exit number %d\n", num_exits); +#ifdef CONFIG_PROFILE_VMM if (info->enable_profiler) { v3_print_profile(info); } +#endif } - if (v3_handle_svm_exit(info) != 0) { vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); addr_t host_addr;