From: Asias He Subject: [PATCH 2/2] kvm tools: Do not run guest if it is stopped. Date: Wed, 21 Dec 2011 21:47:11 +0800 Message-ID: <1324475231-7307-2-git-send-email-asias.hejun@gmail.com> References: <1324475231-7307-1-git-send-email-asias.hejun@gmail.com> Cc: Sasha Levin , Cyrill Gorcunov , Ingo Molnar , kvm@vger.kernel.org, Asias He To: Pekka Enberg Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:39135 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584Ab1LUNtE (ORCPT ); Wed, 21 Dec 2011 08:49:04 -0500 Received: by mail-iy0-f174.google.com with SMTP id h11so11921030iae.19 for ; Wed, 21 Dec 2011 05:49:04 -0800 (PST) In-Reply-To: <1324475231-7307-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 --- 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