mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv: sched: add kick_thread to support notification
kick means to notify one thread_object. If the target thread object is running, send a IPI to notify it; if the target thread object is runnable, make reschedule on it. Also add kick_vcpu API in vcpu layer to notify vcpu. 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:
@@ -222,6 +222,24 @@ void wake_thread(struct thread_object *obj)
|
||||
release_schedule_lock(pcpu_id, rflag);
|
||||
}
|
||||
|
||||
void kick_thread(const struct thread_object *obj)
|
||||
{
|
||||
uint16_t pcpu_id = obj->pcpu_id;
|
||||
uint64_t rflag;
|
||||
|
||||
obtain_schedule_lock(pcpu_id, &rflag);
|
||||
if (is_running(obj)) {
|
||||
if (get_pcpu_id() != pcpu_id) {
|
||||
send_single_ipi(pcpu_id, VECTOR_NOTIFY_VCPU);
|
||||
}
|
||||
} else if (is_runnable(obj)) {
|
||||
make_reschedule_request(pcpu_id, DEL_MODE_IPI);
|
||||
} else {
|
||||
/* do nothing */
|
||||
}
|
||||
release_schedule_lock(pcpu_id, rflag);
|
||||
}
|
||||
|
||||
void run_thread(struct thread_object *obj)
|
||||
{
|
||||
uint64_t rflag;
|
||||
|
Reference in New Issue
Block a user