If the guest is stopped, there is no need to run it.
This patch fixes this when running 'lkvm stop'.

   KVM_RUN failed: Bad address

Signed-off-by: Asias He <[email protected]>
---
 tools/kvm/kvm-cpu.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c
index bdefa09..12791dd 100644
--- a/tools/kvm/kvm-cpu.c
+++ b/tools/kvm/kvm-cpu.c
@@ -29,6 +29,9 @@ void kvm_cpu__run(struct kvm_cpu *vcpu)
 {
        int err;
 
+       if (!vcpu->is_running)
+               return;
+
        err = ioctl(vcpu->vcpu_fd, KVM_RUN, 0);
        if (err < 0 && (errno != EINTR && errno != EAGAIN))
                die_perror("KVM_RUN failed");
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to