mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 14:07:42 +00:00
hv: do not sleep a non-RUNNING vcpu
It's meaningless to sleep a non-running vcpu. Add a state check before sleep the thread object of the vcpu. Tracked-On: #4178 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
d624eb5e6c
commit
72644ac2b2
@ -702,7 +702,9 @@ void pause_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state)
|
|||||||
vcpu->prev_state = vcpu->state;
|
vcpu->prev_state = vcpu->state;
|
||||||
vcpu->state = new_state;
|
vcpu->state = new_state;
|
||||||
|
|
||||||
sleep_thread(&vcpu->thread_obj);
|
if (vcpu->prev_state == VCPU_RUNNING) {
|
||||||
|
sleep_thread(&vcpu->thread_obj);
|
||||||
|
}
|
||||||
if (pcpu_id != get_pcpu_id()) {
|
if (pcpu_id != get_pcpu_id()) {
|
||||||
while (vcpu->running) {
|
while (vcpu->running) {
|
||||||
asm_pause();
|
asm_pause();
|
||||||
|
Loading…
Reference in New Issue
Block a user