X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx_handler.c;h=c758abf3776b6960bfed095d16f9b13b26d23ae8;hp=3fa4f98bf506902376d2af60dcf412941e304384;hb=68521eca0f94f8c22aa60e762c83e24beec7233c;hpb=5bf6d0c260240e314876a2fca8e3fd56bd6a1029 diff --git a/palacios/src/palacios/vmx_handler.c b/palacios/src/palacios/vmx_handler.c index 3fa4f98..c758abf 100644 --- a/palacios/src/palacios/vmx_handler.c +++ b/palacios/src/palacios/vmx_handler.c @@ -32,11 +32,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 /* At this point the GPRs are already copied into the guest_info state */ @@ -57,6 +73,15 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf } #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 + switch (exit_info->exit_reason) { case VMEXIT_INFO_EXCEPTION_OR_NMI: { pf_error_t error_code = *(pf_error_t *)&(exit_info->int_err); @@ -133,24 +158,24 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf if (io_qual->dir == 0) { if (io_qual->string) { - if (v3_handle_vmx_io_outs(info) == -1) { + if (v3_handle_vmx_io_outs(info, exit_info) == -1) { PrintError("Error in outs IO handler\n"); return -1; } } else { - if (v3_handle_vmx_io_out(info) == -1) { + if (v3_handle_vmx_io_out(info, exit_info) == -1) { PrintError("Error in out IO handler\n"); return -1; } } } else { if (io_qual->string) { - if(v3_handle_vmx_io_ins(info) == -1) { + if(v3_handle_vmx_io_ins(info, exit_info) == -1) { PrintError("Error in ins IO handler\n"); return -1; } } else { - if (v3_handle_vmx_io_in(info) == -1) { + if (v3_handle_vmx_io_in(info, exit_info) == -1) { PrintError("Error in in IO handler\n"); return -1; } @@ -222,12 +247,44 @@ int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_inf return -1; } + +#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_info->exit_reason); } #endif + return 0; }