hv: fix interrupt lost when do acrn_handle_pending_request twice

One cycle of vmexit/vmentry might lost interrupts.
This is the scenario,
  1) vmexit, vmexit_handlers
  2) softirq & disable interrupt
  3) acrn_handle_pending_request
  4) schedule if needed, then back to 1) and loop again.
  5) vmentry

The step 3) might be executed twice. The problem is at the second
execution of acrn_handle_pending_request, we might overwrite
VMX_ENTRY_INT_INFO_FIELD of current vmcs, which cause guest lost
interrupts.

The fix is moving 4) prior to 3), then we will handle the pending
requests and vmentry directly.

Tracked-On: #3374
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Shuo A Liu 2019-06-24 15:28:10 +08:00 committed by wenlingz
parent 9a7043e83f
commit ea849177a5

View File

@ -35,6 +35,12 @@ void vcpu_thread(struct sched_object *obj)
do_softirq(); do_softirq();
} }
/* Don't open interrupt window between here and vmentry */
if (need_reschedule(vcpu->pcpu_id)) {
schedule();
continue;
}
/* Check and process pending requests(including interrupt) */ /* Check and process pending requests(including interrupt) */
ret = acrn_handle_pending_request(vcpu); ret = acrn_handle_pending_request(vcpu);
if (ret < 0) { if (ret < 0) {
@ -43,11 +49,6 @@ void vcpu_thread(struct sched_object *obj)
continue; continue;
} }
if (need_reschedule(vcpu->pcpu_id)) {
schedule();
continue;
}
profiling_vmenter_handler(vcpu); profiling_vmenter_handler(vcpu);
TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL); TRACE_2L(TRACE_VM_ENTER, 0UL, 0UL);