Skip to content

Commit d624eb5

Browse files
Shuo A Liuwenlingz
authored andcommitted
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>
1 parent d48da2a commit d624eb5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

hypervisor/dm/io_req.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,15 @@ int32_t acrn_insert_request(struct acrn_vcpu *vcpu, const struct io_request *io_
126126

127127
/* Polling completion of the request in polling mode */
128128
if (is_polling) {
129-
/*
130-
* Now, we only have one case that will schedule out this vcpu
131-
* from IO completion polling status, it's pause_vcpu to VCPU_ZOMBIE.
132-
* In this case, we cannot come back to polling status again. Currently,
133-
* it's OK as we needn't handle IO completion in zombie status.
134-
*/
135-
while (!need_reschedule(pcpuid_from_vcpu(vcpu))) {
129+
while (true) {
136130
if (has_complete_ioreq(vcpu)) {
137131
/* we have completed ioreq pending */
138132
break;
139133
}
140134
asm_pause();
135+
if (need_reschedule(pcpuid_from_vcpu(vcpu))) {
136+
schedule();
137+
}
141138
}
142139
} else if (need_reschedule(pcpuid_from_vcpu(vcpu))) {
143140
schedule();

0 commit comments

Comments
 (0)