hv: sched: move pcpu_id from acrn_vcpu to thread_object

With cpu sharing enabled, we will map acrn_vcpu to thread_object
in scheduling. From modulization perspective, we'd better hide the
pcpu_id in acrn_vcpu and move it to thread_object.

Tracked-On: #3813
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Signed-off-by: Yu Wang <yu1.wang@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shuo A Liu
2019-10-14 16:38:58 +08:00
committed by ACRN System Integration
parent f85106d1ed
commit 891e46453d
18 changed files with 85 additions and 53 deletions

View File

@@ -67,12 +67,14 @@ struct intr_excp_ctx *crash_ctx;
static void dump_guest_reg(struct acrn_vcpu *vcpu)
{
uint16_t pcpu_id = pcpuid_from_vcpu(vcpu);
pr_acrnlog("\n\n================================================");
pr_acrnlog("================================\n\n");
pr_acrnlog("Guest Registers:\r\n");
pr_acrnlog("= VM ID %d ==== vCPU ID %hu === pCPU ID %d ===="
"world %d =============\r\n",
vcpu->vm->vm_id, vcpu->vcpu_id, vcpu->pcpu_id,
vcpu->vm->vm_id, vcpu->vcpu_id, pcpu_id,
vcpu->arch.cur_context);
pr_acrnlog("= RIP=0x%016llx RSP=0x%016llx "
"RFLAGS=0x%016llx\r\n",

View File

@@ -888,7 +888,7 @@ int32_t profiling_vm_list_info(struct acrn_vm *vm, uint64_t addr)
vm_info_list.vm_list[vm_idx].cpu_map[i].vcpu_id
= vcpu->vcpu_id;
vm_info_list.vm_list[vm_idx].cpu_map[i].pcpu_id
= vcpu->pcpu_id;
= pcpuid_from_vcpu(vcpu);
vm_info_list.vm_list[vm_idx].cpu_map[i].apic_id = 0;
vm_info_list.vm_list[vm_idx].num_vcpus++;
}
@@ -1369,7 +1369,7 @@ void profiling_pre_vmexit_handler(struct acrn_vcpu *vcpu)
*/
void profiling_post_vmexit_handler(struct acrn_vcpu *vcpu)
{
per_cpu(profiling_info.s_state, vcpu->pcpu_id).total_vmexit_count++;
per_cpu(profiling_info.s_state, pcpuid_from_vcpu(vcpu)).total_vmexit_count++;
if ((get_cpu_var(profiling_info.s_state).pmu_state == PMU_RUNNING) ||
(get_cpu_var(profiling_info.soc_state) == SW_RUNNING)) {

View File

@@ -664,7 +664,7 @@ static int32_t shell_list_vcpu(__unused int32_t argc, __unused char **argv)
snprintf(temp_str, MAX_STR_SIZE,
" %-9d %-10d %-7hu %-12s %-16s\r\n",
vm->vm_id,
vcpu->pcpu_id,
pcpuid_from_vcpu(vcpu),
vcpu->vcpu_id,
is_vcpu_bsp(vcpu) ?
"PRIMARY" : "SECONDARY",
@@ -767,7 +767,7 @@ static int32_t shell_vcpu_dumpreg(int32_t argc, char **argv)
{
int32_t status = 0;
uint16_t vm_id;
uint16_t vcpu_id;
uint16_t vcpu_id, pcpu_id;
struct acrn_vm *vm;
struct acrn_vcpu *vcpu;
uint64_t mask = 0UL;
@@ -807,13 +807,14 @@ static int32_t shell_vcpu_dumpreg(int32_t argc, char **argv)
goto out;
}
pcpu_id = pcpuid_from_vcpu(vcpu);
dump.vcpu = vcpu;
dump.str = shell_log_buf;
dump.str_max = SHELL_LOG_BUF_SIZE;
if (vcpu->pcpu_id == get_pcpu_id()) {
if (pcpu_id == get_pcpu_id()) {
vcpu_dumpreg(&dump);
} else {
bitmap_set_nolock(vcpu->pcpu_id, &mask);
bitmap_set_nolock(pcpu_id, &mask);
smp_call_function(mask, vcpu_dumpreg, &dump);
}
shell_puts(shell_log_buf);