hv: io: do schedule in IO completion polling loop
Now, we support schedule inplace. And with cpu sharing, there might be multi vcpu running on same pcpu. Reschedule request will happen when switch the running vcpu. If the current vcpu is polling on the IO completion, it need to be scheduled back to the polling point. In the polling path, construct a loop for polling, and do schedule in the loop if needed. Tracked-On: #4178 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
d48da2af3a
commit
d624eb5e6c
|
@ -126,18 +126,15 @@ int32_t acrn_insert_request(struct acrn_vcpu *vcpu, const struct io_request *io_
|
|||
|
||||
/* Polling completion of the request in polling mode */
|
||||
if (is_polling) {
|
||||
/*
|
||||
* Now, we only have one case that will schedule out this vcpu
|
||||
* from IO completion polling status, it's pause_vcpu to VCPU_ZOMBIE.
|
||||
* In this case, we cannot come back to polling status again. Currently,
|
||||
* it's OK as we needn't handle IO completion in zombie status.
|
||||
*/
|
||||
while (!need_reschedule(pcpuid_from_vcpu(vcpu))) {
|
||||
while (true) {
|
||||
if (has_complete_ioreq(vcpu)) {
|
||||
/* we have completed ioreq pending */
|
||||
break;
|
||||
}
|
||||
asm_pause();
|
||||
if (need_reschedule(pcpuid_from_vcpu(vcpu))) {
|
||||
schedule();
|
||||
}
|
||||
}
|
||||
} else if (need_reschedule(pcpuid_from_vcpu(vcpu))) {
|
||||
schedule();
|
||||
|
|
Loading…
Reference in New Issue