mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +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
@@ -13,6 +13,12 @@
|
||||
#include <schedule.h>
|
||||
#include <sprintf.h>
|
||||
|
||||
bool is_idle_thread(const struct thread_object *obj)
|
||||
{
|
||||
uint16_t pcpu_id = obj->pcpu_id;
|
||||
return (obj == &per_cpu(idle, pcpu_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre obj != NULL
|
||||
*/
|
||||
@@ -67,6 +73,12 @@ static struct thread_object *get_next_sched_obj(const struct sched_control *ctl)
|
||||
return ctl->thread_obj == NULL ? &get_cpu_var(idle) : ctl->thread_obj;
|
||||
}
|
||||
|
||||
struct thread_object *sched_get_current(uint16_t pcpu_id)
|
||||
{
|
||||
struct sched_control *ctl = &per_cpu(sched_ctl, pcpu_id);
|
||||
return ctl->curr_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre delmode == DEL_MODE_IPI || delmode == DEL_MODE_INIT
|
||||
*/
|
||||
|
Reference in New Issue
Block a user