diff --git a/hypervisor/common/hv_main.c b/hypervisor/common/hv_main.c index 4047f61c1..d3b1b05f0 100644 --- a/hypervisor/common/hv_main.c +++ b/hypervisor/common/hv_main.c @@ -19,9 +19,6 @@ static void run_vcpu_pre_work(struct acrn_vcpu *vcpu) void vcpu_thread(struct acrn_vcpu *vcpu) { -#ifdef HV_DEBUG - uint64_t vmexit_begin = 0UL, vmexit_end = 0UL; -#endif uint32_t basic_exit_reason = 0U; uint64_t tsc_aux_hyp_cpu = (uint64_t) vcpu->pcpu_id; int32_t ret = 0; @@ -61,13 +58,6 @@ void vcpu_thread(struct acrn_vcpu *vcpu) continue; } -#ifdef HV_DEBUG - vmexit_end = rdtsc(); - if (vmexit_begin != 0UL) { - per_cpu(vmexit_time, vcpu->pcpu_id)[basic_exit_reason] - += (vmexit_end - vmexit_begin); - } -#endif TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL); profiling_vmenter_handler(vcpu); @@ -85,10 +75,6 @@ void vcpu_thread(struct acrn_vcpu *vcpu) continue; } -#ifdef HV_DEBUG - vmexit_begin = rdtsc(); -#endif - vcpu->arch.nrexits++; /* Save guest TSC_AUX */ cpu_msr_read(MSR_IA32_TSC_AUX, &vcpu->msr_tsc_aux_guest); @@ -106,68 +92,8 @@ void vcpu_thread(struct acrn_vcpu *vcpu) continue; } -#ifdef HV_DEBUG - per_cpu(vmexit_cnt, vcpu->pcpu_id)[basic_exit_reason]++; -#endif - TRACE_2L(TRACE_VM_EXIT, basic_exit_reason, vcpu_get_rip(vcpu)); profiling_vmexit_handler(vcpu, basic_exit_reason); } while (1); } - -#ifdef HV_DEBUG -void get_vmexit_profile(char *str_arg, size_t str_max) -{ - char *str = str_arg; - uint16_t cpu, i; - size_t len, size = str_max; - - len = snprintf(str, size, "\r\nNow(us) = %16lld\r\n", ticks_to_us(rdtsc())); - if (len >= size) { - goto overflow; - } - size -= len; - str += len; - - len = snprintf(str, size, "\r\nREASON"); - if (len >= size) { - goto overflow; - } - size -= len; - str += len; - - for (cpu = 0U; cpu < phys_cpu_num; cpu++) { - len = snprintf(str, size, "\t CPU%hu\t US", cpu); - if (len >= size) { - goto overflow; - } - size -= len; - str += len; - } - - for (i = 0U; i < 64U; i++) { - len = snprintf(str, size, "\r\n0x%x", i); - if (len >= size) { - goto overflow; - } - size -= len; - str += len; - for (cpu = 0U; cpu < phys_cpu_num; cpu++) { - len = snprintf(str, size, "\t%10lld\t%10lld", per_cpu(vmexit_cnt, cpu)[i], - ticks_to_us(per_cpu(vmexit_time, cpu)[i])); - if (len >= size) { - goto overflow; - } - - size -= len; - str += len; - } - } - snprintf(str, size, "\r\n"); - return; - -overflow: - printf("buffer size could not be enough! please check!\n"); -} -#endif /* HV_DEBUG */ diff --git a/hypervisor/debug/shell.c b/hypervisor/debug/shell.c index fb18d39dd..088b4424a 100644 --- a/hypervisor/debug/shell.c +++ b/hypervisor/debug/shell.c @@ -29,7 +29,6 @@ static int shell_show_cpu_int(__unused int argc, __unused char **argv); static int shell_show_ptdev_info(__unused int argc, __unused char **argv); static int shell_show_vioapic_info(int argc, char **argv); static int shell_show_ioapic_info(__unused int argc, __unused char **argv); -static int shell_show_vmexit_profile(__unused int argc, __unused char **argv); static int shell_dump_logbuf(int argc, char **argv); static int shell_loglevel(int argc, char **argv); static int shell_cpuid(int argc, char **argv); @@ -96,12 +95,6 @@ static struct shell_cmd shell_cmds[] = { .help_str = SHELL_CMD_IOAPIC_HELP, .fcn = shell_show_ioapic_info, }, - { - .str = SHELL_CMD_VMEXIT, - .cmd_param = SHELL_CMD_VMEXIT_PARAM, - .help_str = SHELL_CMD_VMEXIT_HELP, - .fcn = shell_show_vmexit_profile, - }, { .str = SHELL_CMD_LOGDUMP, .cmd_param = SHELL_CMD_LOGDUMP_PARAM, @@ -807,14 +800,6 @@ static int shell_show_ioapic_info(__unused int argc, __unused char **argv) return err; } -static int shell_show_vmexit_profile(__unused int argc, __unused char **argv) -{ - get_vmexit_profile(shell_log_buf, SHELL_LOG_BUF_SIZE); - shell_puts(shell_log_buf); - - return 0; -} - static int shell_dump_logbuf(int argc, char **argv) { uint16_t pcpu_id; diff --git a/hypervisor/debug/shell_priv.h b/hypervisor/debug/shell_priv.h index c5dd0e1ca..c7d87cfd3 100644 --- a/hypervisor/debug/shell_priv.h +++ b/hypervisor/debug/shell_priv.h @@ -78,10 +78,6 @@ struct shell { #define SHELL_CMD_VIOAPIC_PARAM "" #define SHELL_CMD_VIOAPIC_HELP "show vioapic info" -#define SHELL_CMD_VMEXIT "vmexit" -#define SHELL_CMD_VMEXIT_PARAM NULL -#define SHELL_CMD_VMEXIT_HELP "show vmexit profiling" - #define SHELL_CMD_LOGDUMP "logdump" #define SHELL_CMD_LOGDUMP_PARAM "" #define SHELL_CMD_LOGDUMP_HELP "log buffer dump" diff --git a/hypervisor/include/arch/x86/per_cpu.h b/hypervisor/include/arch/x86/per_cpu.h index 1c0e1cf7d..45a7eaa6f 100644 --- a/hypervisor/include/arch/x86/per_cpu.h +++ b/hypervisor/include/arch/x86/per_cpu.h @@ -27,8 +27,6 @@ struct per_cpu_region { char logbuf[LOG_MESSAGE_MAX_SIZE]; bool is_early_logbuf; char early_logbuf[CONFIG_LOG_BUF_SIZE]; - uint64_t vmexit_cnt[64]; - uint64_t vmexit_time[64]; uint32_t npk_log_ref; #endif uint64_t irq_count[NR_IRQS];