mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 22:42:53 +00:00
hv: hv_main: clean up HV_DEBUG usage
- Remove the usage of HV_DEBUG in hv_main.c The usage of HV_DEBUG in hv_main.c is for the shell command 'vmexit'. Since vmexit info has been captured by acrntrace, there is no need to keep this duplicated feature in shell command. Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
parent
1018a31cbb
commit
9c025190a9
@ -19,9 +19,6 @@ static void run_vcpu_pre_work(struct acrn_vcpu *vcpu)
|
|||||||
|
|
||||||
void vcpu_thread(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;
|
uint32_t basic_exit_reason = 0U;
|
||||||
uint64_t tsc_aux_hyp_cpu = (uint64_t) vcpu->pcpu_id;
|
uint64_t tsc_aux_hyp_cpu = (uint64_t) vcpu->pcpu_id;
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
@ -61,13 +58,6 @@ void vcpu_thread(struct acrn_vcpu *vcpu)
|
|||||||
continue;
|
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);
|
TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL);
|
||||||
|
|
||||||
profiling_vmenter_handler(vcpu);
|
profiling_vmenter_handler(vcpu);
|
||||||
@ -85,10 +75,6 @@ void vcpu_thread(struct acrn_vcpu *vcpu)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HV_DEBUG
|
|
||||||
vmexit_begin = rdtsc();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vcpu->arch.nrexits++;
|
vcpu->arch.nrexits++;
|
||||||
/* Save guest TSC_AUX */
|
/* Save guest TSC_AUX */
|
||||||
cpu_msr_read(MSR_IA32_TSC_AUX, &vcpu->msr_tsc_aux_guest);
|
cpu_msr_read(MSR_IA32_TSC_AUX, &vcpu->msr_tsc_aux_guest);
|
||||||
@ -106,68 +92,8 @@ void vcpu_thread(struct acrn_vcpu *vcpu)
|
|||||||
continue;
|
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));
|
TRACE_2L(TRACE_VM_EXIT, basic_exit_reason, vcpu_get_rip(vcpu));
|
||||||
|
|
||||||
profiling_vmexit_handler(vcpu, basic_exit_reason);
|
profiling_vmexit_handler(vcpu, basic_exit_reason);
|
||||||
} while (1);
|
} 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 */
|
|
||||||
|
@ -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_ptdev_info(__unused int argc, __unused char **argv);
|
||||||
static int shell_show_vioapic_info(int argc, 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_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_dump_logbuf(int argc, char **argv);
|
||||||
static int shell_loglevel(int argc, char **argv);
|
static int shell_loglevel(int argc, char **argv);
|
||||||
static int shell_cpuid(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,
|
.help_str = SHELL_CMD_IOAPIC_HELP,
|
||||||
.fcn = shell_show_ioapic_info,
|
.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,
|
.str = SHELL_CMD_LOGDUMP,
|
||||||
.cmd_param = SHELL_CMD_LOGDUMP_PARAM,
|
.cmd_param = SHELL_CMD_LOGDUMP_PARAM,
|
||||||
@ -807,14 +800,6 @@ static int shell_show_ioapic_info(__unused int argc, __unused char **argv)
|
|||||||
return err;
|
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)
|
static int shell_dump_logbuf(int argc, char **argv)
|
||||||
{
|
{
|
||||||
uint16_t pcpu_id;
|
uint16_t pcpu_id;
|
||||||
|
@ -78,10 +78,6 @@ struct shell {
|
|||||||
#define SHELL_CMD_VIOAPIC_PARAM "<vm id>"
|
#define SHELL_CMD_VIOAPIC_PARAM "<vm id>"
|
||||||
#define SHELL_CMD_VIOAPIC_HELP "show vioapic info"
|
#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 "logdump"
|
||||||
#define SHELL_CMD_LOGDUMP_PARAM "<pcpu id>"
|
#define SHELL_CMD_LOGDUMP_PARAM "<pcpu id>"
|
||||||
#define SHELL_CMD_LOGDUMP_HELP "log buffer dump"
|
#define SHELL_CMD_LOGDUMP_HELP "log buffer dump"
|
||||||
|
@ -27,8 +27,6 @@ struct per_cpu_region {
|
|||||||
char logbuf[LOG_MESSAGE_MAX_SIZE];
|
char logbuf[LOG_MESSAGE_MAX_SIZE];
|
||||||
bool is_early_logbuf;
|
bool is_early_logbuf;
|
||||||
char early_logbuf[CONFIG_LOG_BUF_SIZE];
|
char early_logbuf[CONFIG_LOG_BUF_SIZE];
|
||||||
uint64_t vmexit_cnt[64];
|
|
||||||
uint64_t vmexit_time[64];
|
|
||||||
uint32_t npk_log_ref;
|
uint32_t npk_log_ref;
|
||||||
#endif
|
#endif
|
||||||
uint64_t irq_count[NR_IRQS];
|
uint64_t irq_count[NR_IRQS];
|
||||||
|
Loading…
Reference in New Issue
Block a user