Skip to content

Commit 5de6bf3

Browse files
mgcaolijinxia
authored andcommitted
fix a bug: UOS could hung after running some time.
soft-lock or CPUs stalls can happen during UOS running; after debugging, find CPUs for UOS is in idle thread, and will not be scheduled back. root cause: PIO/MMIO from UOS will trigger SOS/DM to handle them. Usually, it should make sure UOS-vcpu pause first then resume, but for SOS/UOS in parallel,in former code, the UOS-vcpu resume could be called first by SOS before pause. Signed-off-by: Minggui Cao <minggui.cao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 66d283d commit 5de6bf3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

hypervisor/common/io_request.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ int acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
7474
memcpy_s(&req_buf->req_queue[cur], sizeof(struct vhm_request),
7575
req, sizeof(struct vhm_request));
7676

77+
/* pause vcpu, wait for VHM to handle the MMIO request.
78+
* TODO: when pause_vcpu changed to switch vcpu out directlly, we
79+
* should fix the race issue between req.valid = true and vcpu pause
80+
*/
81+
atomic_store(&vcpu->ioreq_pending, 1);
82+
pause_vcpu(vcpu, VCPU_PAUSED);
83+
7784
/* Must clear the signal before we mark req valid
7885
* Once we mark to valid, VHM may process req and signal us
7986
* before we perform upcall.
@@ -86,10 +93,6 @@ int acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
8693
/* signal VHM */
8794
fire_vhm_interrupt();
8895

89-
/* pause vcpu, wait for VHM to handle the MMIO request */
90-
atomic_store(&vcpu->ioreq_pending, 1);
91-
pause_vcpu(vcpu, VCPU_PAUSED);
92-
9396
return 0;
9497
}
9598

0 commit comments

Comments
 (0)