mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-21 16:57:20 +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:
@@ -598,6 +598,11 @@ void offline_vcpu(struct acrn_vcpu *vcpu)
|
||||
vcpu->state = VCPU_OFFLINE;
|
||||
}
|
||||
|
||||
void kick_vcpu(const struct acrn_vcpu *vcpu)
|
||||
{
|
||||
kick_thread(&vcpu->thread_obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* @pre (&vcpu->stack[CONFIG_STACK_SIZE] & (CPU_STACK_ALIGN - 1UL)) == 0
|
||||
*/
|
||||
|
@@ -106,21 +106,8 @@ static bool is_guest_irq_enabled(struct acrn_vcpu *vcpu)
|
||||
|
||||
void vcpu_make_request(struct acrn_vcpu *vcpu, uint16_t eventid)
|
||||
{
|
||||
uint16_t pcpu_id = pcpuid_from_vcpu(vcpu);
|
||||
|
||||
bitmap_set_lock(eventid, &vcpu->arch.pending_req);
|
||||
/*
|
||||
* if current hostcpu is not the target vcpu's hostcpu, we need
|
||||
* to invoke IPI to wake up target vcpu
|
||||
*
|
||||
* TODO: Here we just compare with cpuid, since cpuid currently is
|
||||
* global under pCPU / vCPU 1:1 mapping. If later we enabled vcpu
|
||||
* scheduling, we need change here to determine it target vcpu is
|
||||
* VMX non-root or root mode
|
||||
*/
|
||||
if (get_pcpu_id() != pcpu_id) {
|
||||
send_single_ipi(pcpu_id, VECTOR_NOTIFY_VCPU);
|
||||
}
|
||||
kick_vcpu(vcpu);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user