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>
This commit is contained in:
Minggui Cao 2018-06-05 15:10:12 +08:00 committed by lijinxia
parent 66d283d0c4
commit 5de6bf3d34
1 changed files with 7 additions and 4 deletions

View File

@ -74,6 +74,13 @@ int acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
memcpy_s(&req_buf->req_queue[cur], sizeof(struct vhm_request),
req, sizeof(struct vhm_request));
/* pause vcpu, wait for VHM to handle the MMIO request.
* TODO: when pause_vcpu changed to switch vcpu out directlly, we
* should fix the race issue between req.valid = true and vcpu pause
*/
atomic_store(&vcpu->ioreq_pending, 1);
pause_vcpu(vcpu, VCPU_PAUSED);
/* Must clear the signal before we mark req valid
* Once we mark to valid, VHM may process req and signal us
* before we perform upcall.
@ -86,10 +93,6 @@ int acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
/* signal VHM */
fire_vhm_interrupt();
/* pause vcpu, wait for VHM to handle the MMIO request */
atomic_store(&vcpu->ioreq_pending, 1);
pause_vcpu(vcpu, VCPU_PAUSED);
return 0;
}