Skip to content

Commit 9c02519

Browse files
shiqingglijinxia
authored andcommitted
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>
1 parent 1018a31 commit 9c02519

File tree

4 files changed

+0
-95
lines changed

4 files changed

+0
-95
lines changed

hypervisor/common/hv_main.c

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ static void run_vcpu_pre_work(struct acrn_vcpu *vcpu)
1919

2020
void vcpu_thread(struct acrn_vcpu *vcpu)
2121
{
22-
#ifdef HV_DEBUG
23-
uint64_t vmexit_begin = 0UL, vmexit_end = 0UL;
24-
#endif
2522
uint32_t basic_exit_reason = 0U;
2623
uint64_t tsc_aux_hyp_cpu = (uint64_t) vcpu->pcpu_id;
2724
int32_t ret = 0;
@@ -61,13 +58,6 @@ void vcpu_thread(struct acrn_vcpu *vcpu)
6158
continue;
6259
}
6360

64-
#ifdef HV_DEBUG
65-
vmexit_end = rdtsc();
66-
if (vmexit_begin != 0UL) {
67-
per_cpu(vmexit_time, vcpu->pcpu_id)[basic_exit_reason]
68-
+= (vmexit_end - vmexit_begin);
69-
}
70-
#endif
7161
TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL);
7262

7363
profiling_vmenter_handler(vcpu);
@@ -85,10 +75,6 @@ void vcpu_thread(struct acrn_vcpu *vcpu)
8575
continue;
8676
}
8777

88-
#ifdef HV_DEBUG
89-
vmexit_begin = rdtsc();
90-
#endif
91-
9278
vcpu->arch.nrexits++;
9379
/* Save guest TSC_AUX */
9480
cpu_msr_read(MSR_IA32_TSC_AUX, &vcpu->msr_tsc_aux_guest);
@@ -106,68 +92,8 @@ void vcpu_thread(struct acrn_vcpu *vcpu)
10692
continue;
10793
}
10894

109-
#ifdef HV_DEBUG
110-
per_cpu(vmexit_cnt, vcpu->pcpu_id)[basic_exit_reason]++;
111-
#endif
112-
11395
TRACE_2L(TRACE_VM_EXIT, basic_exit_reason, vcpu_get_rip(vcpu));
11496

11597
profiling_vmexit_handler(vcpu, basic_exit_reason);
11698
} while (1);
11799
}
118-
119-
#ifdef HV_DEBUG
120-
void get_vmexit_profile(char *str_arg, size_t str_max)
121-
{
122-
char *str = str_arg;
123-
uint16_t cpu, i;
124-
size_t len, size = str_max;
125-
126-
len = snprintf(str, size, "\r\nNow(us) = %16lld\r\n", ticks_to_us(rdtsc()));
127-
if (len >= size) {
128-
goto overflow;
129-
}
130-
size -= len;
131-
str += len;
132-
133-
len = snprintf(str, size, "\r\nREASON");
134-
if (len >= size) {
135-
goto overflow;
136-
}
137-
size -= len;
138-
str += len;
139-
140-
for (cpu = 0U; cpu < phys_cpu_num; cpu++) {
141-
len = snprintf(str, size, "\t CPU%hu\t US", cpu);
142-
if (len >= size) {
143-
goto overflow;
144-
}
145-
size -= len;
146-
str += len;
147-
}
148-
149-
for (i = 0U; i < 64U; i++) {
150-
len = snprintf(str, size, "\r\n0x%x", i);
151-
if (len >= size) {
152-
goto overflow;
153-
}
154-
size -= len;
155-
str += len;
156-
for (cpu = 0U; cpu < phys_cpu_num; cpu++) {
157-
len = snprintf(str, size, "\t%10lld\t%10lld", per_cpu(vmexit_cnt, cpu)[i],
158-
ticks_to_us(per_cpu(vmexit_time, cpu)[i]));
159-
if (len >= size) {
160-
goto overflow;
161-
}
162-
163-
size -= len;
164-
str += len;
165-
}
166-
}
167-
snprintf(str, size, "\r\n");
168-
return;
169-
170-
overflow:
171-
printf("buffer size could not be enough! please check!\n");
172-
}
173-
#endif /* HV_DEBUG */

hypervisor/debug/shell.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ static int shell_show_cpu_int(__unused int argc, __unused char **argv);
2929
static int shell_show_ptdev_info(__unused int argc, __unused char **argv);
3030
static int shell_show_vioapic_info(int argc, char **argv);
3131
static int shell_show_ioapic_info(__unused int argc, __unused char **argv);
32-
static int shell_show_vmexit_profile(__unused int argc, __unused char **argv);
3332
static int shell_dump_logbuf(int argc, char **argv);
3433
static int shell_loglevel(int argc, char **argv);
3534
static int shell_cpuid(int argc, char **argv);
@@ -96,12 +95,6 @@ static struct shell_cmd shell_cmds[] = {
9695
.help_str = SHELL_CMD_IOAPIC_HELP,
9796
.fcn = shell_show_ioapic_info,
9897
},
99-
{
100-
.str = SHELL_CMD_VMEXIT,
101-
.cmd_param = SHELL_CMD_VMEXIT_PARAM,
102-
.help_str = SHELL_CMD_VMEXIT_HELP,
103-
.fcn = shell_show_vmexit_profile,
104-
},
10598
{
10699
.str = SHELL_CMD_LOGDUMP,
107100
.cmd_param = SHELL_CMD_LOGDUMP_PARAM,
@@ -807,14 +800,6 @@ static int shell_show_ioapic_info(__unused int argc, __unused char **argv)
807800
return err;
808801
}
809802

810-
static int shell_show_vmexit_profile(__unused int argc, __unused char **argv)
811-
{
812-
get_vmexit_profile(shell_log_buf, SHELL_LOG_BUF_SIZE);
813-
shell_puts(shell_log_buf);
814-
815-
return 0;
816-
}
817-
818803
static int shell_dump_logbuf(int argc, char **argv)
819804
{
820805
uint16_t pcpu_id;

hypervisor/debug/shell_priv.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ struct shell {
7878
#define SHELL_CMD_VIOAPIC_PARAM "<vm id>"
7979
#define SHELL_CMD_VIOAPIC_HELP "show vioapic info"
8080

81-
#define SHELL_CMD_VMEXIT "vmexit"
82-
#define SHELL_CMD_VMEXIT_PARAM NULL
83-
#define SHELL_CMD_VMEXIT_HELP "show vmexit profiling"
84-
8581
#define SHELL_CMD_LOGDUMP "logdump"
8682
#define SHELL_CMD_LOGDUMP_PARAM "<pcpu id>"
8783
#define SHELL_CMD_LOGDUMP_HELP "log buffer dump"

hypervisor/include/arch/x86/per_cpu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ struct per_cpu_region {
2727
char logbuf[LOG_MESSAGE_MAX_SIZE];
2828
bool is_early_logbuf;
2929
char early_logbuf[CONFIG_LOG_BUF_SIZE];
30-
uint64_t vmexit_cnt[64];
31-
uint64_t vmexit_time[64];
3230
uint32_t npk_log_ref;
3331
#endif
3432
uint64_t irq_count[NR_IRQS];

0 commit comments

Comments
 (0)