hv: debug: show vcpu thread status in vcpu_list debug command
Due to vcpu and its thread are two different perspective modules, each of them has its own status. Dump both states for better understanding of system status. Tracked-On: #4329 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
db708fc3e8
commit
3edde2608c
|
@ -637,12 +637,12 @@ static int32_t shell_list_vcpu(__unused int32_t argc, __unused char **argv)
|
|||
char temp_str[MAX_STR_SIZE];
|
||||
struct acrn_vm *vm;
|
||||
struct acrn_vcpu *vcpu;
|
||||
char state[32];
|
||||
char vcpu_state_str[32], thread_state_str[32];
|
||||
uint16_t i;
|
||||
uint16_t idx;
|
||||
|
||||
shell_puts("\r\nVM ID PCPU ID VCPU ID VCPU ROLE VCPU STATE"
|
||||
"\r\n===== ======= ======= ========= ==========\r\n");
|
||||
shell_puts("\r\nVM ID PCPU ID VCPU ID VCPU ROLE VCPU STATE THREAD STATE"
|
||||
"\r\n===== ======= ======= ========= ========== ==========\r\n");
|
||||
|
||||
for (idx = 0U; idx < CONFIG_MAX_VM_NUM; idx++) {
|
||||
vm = get_vm_from_vmid(idx);
|
||||
|
@ -652,31 +652,47 @@ static int32_t shell_list_vcpu(__unused int32_t argc, __unused char **argv)
|
|||
foreach_vcpu(i, vm, vcpu) {
|
||||
switch (vcpu->state) {
|
||||
case VCPU_INIT:
|
||||
(void)strncpy_s(state, 32U, "Init", 32U);
|
||||
(void)strncpy_s(vcpu_state_str, 32U, "Init", 32U);
|
||||
break;
|
||||
case VCPU_PAUSED:
|
||||
(void)strncpy_s(state, 32U, "Paused", 32U);
|
||||
(void)strncpy_s(vcpu_state_str, 32U, "Paused", 32U);
|
||||
break;
|
||||
case VCPU_RUNNING:
|
||||
(void)strncpy_s(state, 32U, "Running", 32U);
|
||||
(void)strncpy_s(vcpu_state_str, 32U, "Running", 32U);
|
||||
break;
|
||||
case VCPU_ZOMBIE:
|
||||
(void)strncpy_s(state, 32U, "Zombie", 32U);
|
||||
(void)strncpy_s(vcpu_state_str, 32U, "Zombie", 32U);
|
||||
break;
|
||||
default:
|
||||
(void)strncpy_s(state, 32U, "Unknown", 32U);
|
||||
(void)strncpy_s(vcpu_state_str, 32U, "Unknown", 32U);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (vcpu->thread_obj.status) {
|
||||
case THREAD_STS_RUNNING:
|
||||
(void)strncpy_s(thread_state_str, 32U, "RUNNING", 32U);
|
||||
break;
|
||||
case THREAD_STS_RUNNABLE:
|
||||
(void)strncpy_s(thread_state_str, 32U, "RUNNABLE", 32U);
|
||||
break;
|
||||
case THREAD_STS_BLOCKED:
|
||||
(void)strncpy_s(thread_state_str, 32U, "BLOCKED", 32U);
|
||||
break;
|
||||
default:
|
||||
(void)strncpy_s(thread_state_str, 32U, "UNKNOWN", 32U);
|
||||
break;
|
||||
}
|
||||
/* Create output string consisting of VM name
|
||||
* and VM id
|
||||
*/
|
||||
snprintf(temp_str, MAX_STR_SIZE,
|
||||
" %-9d %-10d %-7hu %-12s %-16s\r\n",
|
||||
" %-9d %-10d %-7hu %-12s %-16s %-16s\r\n",
|
||||
vm->vm_id,
|
||||
pcpuid_from_vcpu(vcpu),
|
||||
vcpu->vcpu_id,
|
||||
is_vcpu_bsp(vcpu) ?
|
||||
"PRIMARY" : "SECONDARY",
|
||||
state);
|
||||
vcpu_state_str, thread_state_str);
|
||||
/* Output information for this task */
|
||||
shell_puts(temp_str);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue