kvm : Fold pv_unhalt flag into GET_MP_STATE ioctl to aid migration

From: Raghavendra K T <raghavendra...@linux.vnet.ibm.com>

During migration, any vcpu that got kicked but did not become runnable
(still in halted state) should be runnable after migration.

Signed-off-by: Raghavendra K T <raghavendra...@linux.vnet.ibm.com>
Acked-by: Gleb Natapov <g...@redhat.com>
Acked-by: Ingo Molnar <mi...@kernel.org>
---
 arch/x86/kvm/x86.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index dae4575..1e73dab 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6284,7 +6284,12 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu 
*vcpu,
                                    struct kvm_mp_state *mp_state)
 {
        kvm_apic_accept_events(vcpu);
-       mp_state->mp_state = vcpu->arch.mp_state;
+       if (vcpu->arch.mp_state == KVM_MP_STATE_HALTED &&
+                                       vcpu->arch.pv.pv_unhalted)
+               mp_state->mp_state = KVM_MP_STATE_RUNNABLE;
+       else
+               mp_state->mp_state = vcpu->arch.mp_state;
+
        return 0;
 }
 

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to