]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Do not run guest if it is stopped.
authorAsias He <asias.hejun@gmail.com>
Wed, 21 Dec 2011 13:47:11 +0000 (21:47 +0800)
committerPekka Enberg <penberg@kernel.org>
Wed, 21 Dec 2011 20:32:02 +0000 (22:32 +0200)
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 <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/kvm-cpu.c

index bdefa09ac72c56b86c912c39e079d1791e0d7bb9..12791dd83d3f6d4842bcb01113228648fdbbe019 100644 (file)
@@ -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");