mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 14:07:42 +00:00
add flag to control vmexit sample in HV bootargs
for vmexit data sampling could affect HV performace profiling, so set it disabled by default. add a flag in HV bootargs to control vmexit data sampling. Tracked-On: #5232 Signed-off-by: Minggui Cao <minggui.cao@intel.com>
This commit is contained in:
parent
ea2650918b
commit
25fff0c21a
@ -14,6 +14,7 @@
|
||||
#include <sprintf.h>
|
||||
#include <trace.h>
|
||||
#include <logmsg.h>
|
||||
#include <shell.h>
|
||||
|
||||
void vcpu_thread(struct thread_object *obj)
|
||||
{
|
||||
@ -47,6 +48,7 @@ void vcpu_thread(struct thread_object *obj)
|
||||
profiling_vmenter_handler(vcpu);
|
||||
|
||||
#ifdef HV_DEBUG
|
||||
if (is_vmexit_sample_enabled()) {
|
||||
vmexit_end = rdtsc();
|
||||
if (vmexit_begin != 0UL) {
|
||||
uint64_t delta = vmexit_end - vmexit_begin;
|
||||
@ -74,6 +76,7 @@ void vcpu_thread(struct thread_object *obj)
|
||||
vcpu->vmexit_time[basic_exit_reason][1] = us;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL);
|
||||
ret = run_vcpu(vcpu);
|
||||
@ -87,9 +90,11 @@ void vcpu_thread(struct thread_object *obj)
|
||||
TRACE_2L(TRACE_VM_EXIT, basic_exit_reason, vcpu_get_rip(vcpu));
|
||||
|
||||
#ifdef HV_DEBUG
|
||||
if (is_vmexit_sample_enabled()) {
|
||||
vmexit_begin = rdtsc();
|
||||
get_cpu_var(vmexit_cnt)[basic_exit_reason][TOTAL_ARRAY_LEVEL - 1]++;
|
||||
vcpu->vmexit_cnt[basic_exit_reason][TOTAL_ARRAY_LEVEL - 1]++;
|
||||
}
|
||||
#endif
|
||||
vcpu->arch.nrexits++;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <uart16550.h>
|
||||
#include <dbg_cmd.h>
|
||||
#include <vm_config.h>
|
||||
#include <shell.h>
|
||||
|
||||
#define MAX_PORT 0x10000 /* port 0 - 64K */
|
||||
#define DEFAULT_UART_PORT 0x3F8
|
||||
@ -20,6 +21,7 @@ static const char * const cmd_list[] = {
|
||||
"uart=disabled", /* to disable uart */
|
||||
"uart=port@", /* like uart=port@0x3F8 */
|
||||
"uart=bdf@", /*like: uart=bdf@0:18.2, it is for ttyS2 */
|
||||
"vmexit=enable"
|
||||
};
|
||||
|
||||
enum IDX_CMD_DBG {
|
||||
@ -27,6 +29,7 @@ enum IDX_CMD_DBG {
|
||||
IDX_PORT_UART,
|
||||
IDX_PCI_UART,
|
||||
|
||||
IDX_SET_VMEXIT,
|
||||
IDX_MAX_CMD,
|
||||
};
|
||||
|
||||
@ -104,6 +107,9 @@ bool handle_dbg_cmd(const char *cmd, int32_t len)
|
||||
|
||||
} else if (i == IDX_PCI_UART) {
|
||||
uart16550_set_property(true, false, (uint64_t)(cmd+tmp));
|
||||
} else if (i == IDX_SET_VMEXIT) {
|
||||
|
||||
set_vmexit_sample_flag(true);
|
||||
} else {
|
||||
/* No other state currently, do nothing */
|
||||
}
|
||||
|
@ -1913,12 +1913,19 @@ static void clear_vmexit_info_buffer(void)
|
||||
|
||||
}
|
||||
|
||||
/* used to control sample vmexit data */
|
||||
static bool vmexit_sample_flag = false;
|
||||
|
||||
static int shell_show_vmexit_profile(__unused int argc, __unused char **argv)
|
||||
{
|
||||
if ((argc == 2) && (strcmp(argv[1], "clear") == 0)) {
|
||||
clear_vmexit_info_buffer();
|
||||
}
|
||||
|
||||
if (!vmexit_sample_flag) {
|
||||
printf("not enable to sample vmexit data!");
|
||||
}
|
||||
|
||||
get_vmexit_profile_per_pcpu(shell_log_buf, SHELL_LOG_BUF_SIZE);
|
||||
shell_puts(shell_log_buf);
|
||||
|
||||
@ -1933,3 +1940,13 @@ static int shell_show_vmexit_profile(__unused int argc, __unused char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void set_vmexit_sample_flag(bool to_enable)
|
||||
{
|
||||
vmexit_sample_flag = to_enable;
|
||||
}
|
||||
|
||||
bool is_vmexit_sample_enabled(void)
|
||||
{
|
||||
return vmexit_sample_flag;
|
||||
}
|
||||
|
@ -10,4 +10,7 @@
|
||||
void shell_init(void);
|
||||
void shell_kick(void);
|
||||
|
||||
void set_vmexit_sample_flag(bool to_enable);
|
||||
bool is_vmexit_sample_enabled(void);
|
||||
|
||||
#endif /* SHELL_H */
|
||||
|
Loading…
Reference in New Issue
Block a user