Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core/vm): enabled the utilization of the vcpu active flag #170

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/core/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static void vm_vcpu_init(struct vm* vm, const struct vm_config* vm_config)
vcpu->id = vcpu_id;
vcpu->phys_id = cpu()->id;
vcpu->vm = vm;
vcpu->active = true;
cpu()->vcpu = vcpu;

vcpu_arch_init(vcpu, vm);
Expand Down Expand Up @@ -349,6 +350,9 @@ __attribute__((weak)) cpumap_t vm_translate_to_vcpu_mask(struct vm* vm, cpumap_t

void vcpu_run(struct vcpu* vcpu)
{
cpu()->vcpu->active = true;
vcpu_arch_run(vcpu);
if (vcpu->active == false) {
cpu_idle();
} else {
vcpu_arch_run(vcpu);
}
}