mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
profiling: code cleanup
This is to align the types used in hypervisor core and profiling. That cleans up unnecessary type conversions. It also fixes inconsistent tab/space in data structures. Tracked-On: #2257 Signed-off-by: Min Lim <min.yeol.lim@intel.com>
This commit is contained in:
parent
70a626bdac
commit
465d7f2cc4
@ -616,7 +616,7 @@ static void profiling_pmi_handler(uint32_t irq, __unused void *data)
|
||||
((uint64_t)get_cpu_var(profiling_info.vm_info).external_vector
|
||||
== VECTOR_PMI)) {
|
||||
psample->csample.os_id
|
||||
=(uint32_t) get_cpu_var(profiling_info.vm_info).guest_vm_id;
|
||||
= get_cpu_var(profiling_info.vm_info).guest_vm_id;
|
||||
(void)memset(psample->csample.task, 0U, 16);
|
||||
psample->csample.cpu_id = get_cpu_id();
|
||||
psample->csample.process_id = 0U;
|
||||
@ -631,7 +631,7 @@ static void profiling_pmi_handler(uint32_t irq, __unused void *data)
|
||||
get_cpu_var(profiling_info.vm_info).external_vector = -1;
|
||||
/* Attribute PMI to hypervisor context */
|
||||
} else {
|
||||
psample->csample.os_id = 0xFFFFFFFFU;
|
||||
psample->csample.os_id = 0xFFFFU;
|
||||
(void)memcpy_s(psample->csample.task, 16, "VMM\0", 4);
|
||||
psample->csample.cpu_id = get_cpu_id();
|
||||
psample->csample.process_id = 0U;
|
||||
@ -863,12 +863,12 @@ int32_t profiling_vm_list_info(struct acrn_vm *vm, uint64_t addr)
|
||||
vm_info_list.vm_list[vm_idx].vm_id_num = -1;
|
||||
(void)memcpy_s((void *)vm_info_list.vm_list[vm_idx].vm_name, 4U, "VMM\0", 4U);
|
||||
for (i = 0U; i < phys_cpu_num; i++) {
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].vcpu_id = (int32_t)i;
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].pcpu_id = (int32_t)i;
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].vcpu_id = i;
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].pcpu_id = i;
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].apic_id
|
||||
= (int32_t)per_cpu(lapic_id, i);
|
||||
= per_cpu(lapic_id, i);
|
||||
}
|
||||
vm_info_list.vm_list[vm_idx].num_vcpus = (int32_t)i;
|
||||
vm_info_list.vm_list[vm_idx].num_vcpus = i;
|
||||
vm_info_list.num_vms = 1;
|
||||
|
||||
for (j = 0U; j < CONFIG_MAX_VM_NUM; j++) {
|
||||
@ -879,7 +879,7 @@ int32_t profiling_vm_list_info(struct acrn_vm *vm, uint64_t addr)
|
||||
vm_info_list.num_vms++;
|
||||
vm_idx++;
|
||||
|
||||
vm_info_list.vm_list[vm_idx].vm_id_num = (int32_t)tmp_vm->vm_id;
|
||||
vm_info_list.vm_list[vm_idx].vm_id_num = tmp_vm->vm_id;
|
||||
(void)memcpy_s((void *)vm_info_list.vm_list[vm_idx].guid,
|
||||
16U, tmp_vm->GUID, 16U);
|
||||
snprintf(vm_info_list.vm_list[vm_idx].vm_name, 16U, "vm_%d",
|
||||
@ -888,9 +888,9 @@ int32_t profiling_vm_list_info(struct acrn_vm *vm, uint64_t addr)
|
||||
i = 0U;
|
||||
foreach_vcpu(i, tmp_vm, vcpu) {
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].vcpu_id
|
||||
= (int32_t)vcpu->vcpu_id;
|
||||
= vcpu->vcpu_id;
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].pcpu_id
|
||||
= (int32_t)vcpu->pcpu_id;
|
||||
= vcpu->pcpu_id;
|
||||
vm_info_list.vm_list[vm_idx].cpu_map[i].apic_id = 0;
|
||||
vm_info_list.vm_list[vm_idx].num_vcpus++;
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ void profiling_post_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
((socwatch_collection_switch &
|
||||
(1UL << (uint64_t)SOCWATCH_VM_SWITCH_TRACING)) > 0UL)) {
|
||||
get_cpu_var(profiling_info.vm_switch_trace).os_id
|
||||
= (int32_t)vcpu->vm->vm_id;
|
||||
= vcpu->vm->vm_id;
|
||||
get_cpu_var(profiling_info.vm_switch_trace).vm_enter_tsc
|
||||
= get_cpu_var(profiling_info.vm_info).vmenter_tsc;
|
||||
get_cpu_var(profiling_info.vm_switch_trace).vm_exit_tsc
|
||||
|
@ -9,9 +9,6 @@
|
||||
|
||||
#ifdef PROFILING_ON
|
||||
|
||||
#define MAX_NR_VCPUS 8
|
||||
#define MAX_NR_VMS 6
|
||||
|
||||
#define MAX_MSR_LIST_NUM 15U
|
||||
#define MAX_GROUP_NUM 1U
|
||||
|
||||
@ -22,6 +19,7 @@
|
||||
#define SOCWATCH_MSR_OP 100U
|
||||
|
||||
#define MAGIC_NUMBER 0x99999988U
|
||||
|
||||
enum MSR_CMD_STATUS {
|
||||
MSR_OP_READY = 0,
|
||||
MSR_OP_REQUESTED,
|
||||
@ -101,22 +99,22 @@ struct profiling_control {
|
||||
};
|
||||
|
||||
struct profiling_vcpu_pcpu_map {
|
||||
int32_t vcpu_id;
|
||||
int32_t pcpu_id;
|
||||
int32_t apic_id;
|
||||
int16_t vcpu_id;
|
||||
int16_t pcpu_id;
|
||||
uint32_t apic_id;
|
||||
};
|
||||
|
||||
struct profiling_vm_info {
|
||||
int32_t vm_id_num;
|
||||
uint16_t vm_id_num;
|
||||
uint8_t guid[16];
|
||||
char vm_name[16];
|
||||
int32_t num_vcpus;
|
||||
struct profiling_vcpu_pcpu_map cpu_map[MAX_NR_VCPUS];
|
||||
uint16_t num_vcpus;
|
||||
struct profiling_vcpu_pcpu_map cpu_map[CONFIG_MAX_VCPUS_PER_VM];
|
||||
};
|
||||
|
||||
struct profiling_vm_info_list {
|
||||
int32_t num_vms;
|
||||
struct profiling_vm_info vm_list[MAX_NR_VMS];
|
||||
uint16_t num_vms;
|
||||
struct profiling_vm_info vm_list[CONFIG_MAX_VM_NUM];
|
||||
};
|
||||
|
||||
struct sw_msr_op_info {
|
||||
@ -173,7 +171,7 @@ struct guest_vm_info {
|
||||
uint64_t guest_rip;
|
||||
uint64_t guest_rflags;
|
||||
uint64_t guest_cs;
|
||||
int32_t guest_vm_id;
|
||||
uint16_t guest_vm_id;
|
||||
int32_t external_vector;
|
||||
};
|
||||
struct sep_state {
|
||||
@ -230,7 +228,9 @@ struct data_header {
|
||||
#define DATA_HEADER_SIZE ((uint64_t)sizeof(struct data_header))
|
||||
struct core_pmu_sample {
|
||||
/* context where PMI is triggered */
|
||||
uint32_t os_id;
|
||||
uint16_t os_id;
|
||||
/* reserved */
|
||||
uint16_t reserved;
|
||||
/* the task id */
|
||||
uint32_t task_id;
|
||||
/* instruction pointer */
|
||||
@ -275,7 +275,8 @@ struct vm_switch_trace {
|
||||
uint64_t vm_enter_tsc;
|
||||
uint64_t vm_exit_tsc;
|
||||
uint64_t vm_exit_reason;
|
||||
int32_t os_id;
|
||||
uint16_t os_id;
|
||||
uint16_t reserved;
|
||||
}__aligned(SEP_BUF_ENTRY_SIZE);
|
||||
|
||||
#define VM_SWITCH_TRACE_SIZE ((uint64_t)sizeof(struct vm_switch_trace))
|
||||
|
Loading…
Reference in New Issue
Block a user