X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm_handler.c;h=75d21492f682c857b549f4a1427aa7dacd5be1de;hp=951cc8f1f872edb4d4f7da5d467ed1a1efc28328;hb=68521eca0f94f8c22aa60e762c83e24beec7233c;hpb=4290e5f20a4ea5e5f32cb8228ac4d7446dc1021b diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index 951cc8f..75d2149 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -34,11 +34,27 @@ #include #include +#ifdef CONFIG_VNET +#include +#endif + +#ifdef CONFIG_LINUX_VIRTIO_NET + extern int v3_virtionic_pktprocess(struct guest_info * info); +#endif #ifdef CONFIG_TELEMETRY #include #endif +#define VNET_PROFILE +/* for vnet profiling*/ +#ifdef VNET_PROFILE +static uint64_t vmm_time = 0; +static uint64_t vnet_time = 0; +static uint64_t guest_time = 0; +static uint64_t last_exit_time = 0; +static uint64_t num_exit = 0; +#endif int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_info1, addr_t exit_info2) { @@ -48,6 +64,14 @@ int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_i } #endif +#ifdef VNET_PROFILE + uint64_t exit_start_time, vnet_start_time; + uint64_t exit_end_time, vnet_end_time; + rdtscll(exit_start_time); + num_exit ++; + if (last_exit_time > 0) + guest_time += exit_start_time - last_exit_time; +#endif //PrintDebug("SVM Returned: Exit Code: %x\n",exit_code); @@ -208,9 +232,10 @@ int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_i info->rip += 3; if (v3_handle_hypercall(info) == -1) { + PrintError("Error handling Hypercall\n"); return -1; } - + break; case VMEXIT_INTR: // handled by interrupt dispatch earlier @@ -227,7 +252,7 @@ int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_i } break; case VMEXIT_PAUSE: - PrintDebug("Guest paused\n"); + // PrintDebug("Guest paused\n"); if (v3_handle_svm_pause(info) == -1) { return -1; } @@ -280,6 +305,37 @@ int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_i } // END OF SWITCH (EXIT_CODE) + +#ifdef CONFIG_VNET + +#ifdef VNET_PROFILE + rdtscll(vnet_start_time); +#endif + v3_vnet_pkt_process(info); +#ifdef VNET_PROFILE + rdtscll(vnet_end_time); + vnet_time += vnet_end_time - vnet_start_time; +#endif +#endif + +#ifdef CONFIG_LINUX_VIRTIO_NET + v3_virtionic_pktprocess(info); +#endif + +#ifdef VNET_PROFILE + rdtscll(exit_end_time); + vmm_time += exit_end_time - exit_start_time; + last_exit_time = exit_end_time; + if ((num_exit % 100000) == 0) { + PrintError("exit: %ld, vmm_time: %ld, guest_time: %ld, vnet_time: %ld\n", (long)num_exit, (long)vmm_time, (long)guest_time, (long)vnet_time); + vmm_time = 0; + vnet_time = 0; + guest_time = 0; + last_exit_time = 0; + } +#endif + + #ifdef CONFIG_TELEMETRY if (info->enable_telemetry) { v3_telemetry_end_exit(info, exit_code); @@ -290,6 +346,7 @@ int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_i if (exit_code == VMEXIT_INTR) { //PrintDebug("INTR ret IP = %x\n", guest_state->rip); } + return 0; }