mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 16:57:20 +00:00
hv: sched: use get_running_vcpu to replace per_cpu vcpu with cpu sharing
With cpu sharing enabled, per_cpu vcpu cannot work properly as we might has multiple vcpus running on one pcpu. Add a schedule API sched_get_current to get current thread_object on specific pcpu, also add a vcpu API get_running_vcpu to get corresponding vcpu of the 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:
committed by
ACRN System Integration
parent
891e46453d
commit
7e66c0d4fa
@@ -193,6 +193,18 @@ void vcpu_reset_eoi_exit_bitmaps(struct acrn_vcpu *vcpu)
|
||||
vcpu_make_request(vcpu, ACRN_REQUEST_EOI_EXIT_BITMAP_UPDATE);
|
||||
}
|
||||
|
||||
struct acrn_vcpu *get_running_vcpu(uint16_t pcpu_id)
|
||||
{
|
||||
struct thread_object *curr = sched_get_current(pcpu_id);
|
||||
struct acrn_vcpu *vcpu = NULL;
|
||||
|
||||
if ((curr != NULL) && (!is_idle_thread(curr))) {
|
||||
vcpu = list_entry(curr, struct acrn_vcpu, thread_obj);
|
||||
}
|
||||
|
||||
return vcpu;
|
||||
}
|
||||
|
||||
struct acrn_vcpu *get_ever_run_vcpu(uint16_t pcpu_id)
|
||||
{
|
||||
return per_cpu(ever_run_vcpu, pcpu_id);
|
||||
@@ -400,8 +412,6 @@ int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
|
||||
* needs revise.
|
||||
*/
|
||||
|
||||
per_cpu(vcpu, pcpu_id) = vcpu;
|
||||
|
||||
pr_info("Create VM%d-VCPU%d, Role: %s",
|
||||
vcpu->vm->vm_id, vcpu->vcpu_id,
|
||||
is_vcpu_bsp(vcpu) ? "PRIMARY" : "SECONDARY");
|
||||
|
Reference in New Issue
Block a user