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.
Acked-by: Eddie Dong
@@ -702,7 +702,9 @@ void pause_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state)
vcpu->prev_state = vcpu->state;
vcpu->state = new_state;
+ if (vcpu->prev_state == VCPU_RUNNING) {
sleep_thread(&vcpu->thread_obj);
+ }
if (pcpu_id != get_pcpu_id()) {
while (vcpu->running) {
asm_pause();
