Skip to content

Commit 12955fa

Browse files
fyin1wenlingz
authored andcommitted
hv_main: Remove the continue in vcpu_thread
To avoid acrn_handle_pending_request called twice within one vmexit, we remove the error-prone "continue" in vcpu_thread. And make vcpu shecheduled out if fatal error happens with vcpu. Tracked-On: #3387 Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent f0e1c5e commit 12955fa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

hypervisor/common/hv_main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ void vcpu_thread(struct sched_object *obj)
3434
/* Don't open interrupt window between here and vmentry */
3535
if (need_reschedule(vcpu->pcpu_id)) {
3636
schedule();
37-
continue;
3837
}
3938

4039
/* Check and process pending requests(including interrupt) */
4140
ret = acrn_handle_pending_request(vcpu);
4241
if (ret < 0) {
4342
pr_fatal("vcpu handling pending request fail");
4443
pause_vcpu(vcpu, VCPU_ZOMBIE);
45-
continue;
44+
/* Fatal error happened (triple fault). Stop the vcpu running. */
45+
schedule();
4646
}
4747

4848
profiling_vmenter_handler(vcpu);
@@ -52,7 +52,8 @@ void vcpu_thread(struct sched_object *obj)
5252
if (ret != 0) {
5353
pr_fatal("vcpu resume failed");
5454
pause_vcpu(vcpu, VCPU_ZOMBIE);
55-
continue;
55+
/* Fatal error happened (resume vcpu failed). Stop the vcpu running. */
56+
schedule();
5657
}
5758
basic_exit_reason = vcpu->arch.exit_reason & 0xFFFFU;
5859
TRACE_2L(TRACE_VM_EXIT, basic_exit_reason, vcpu_get_rip(vcpu));

0 commit comments

Comments
 (0)