From patchwork Sun May 23 22:02:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 101782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4NM2aeq002485 for ; Sun, 23 May 2010 22:02:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755317Ab0EWWCe (ORCPT ); Sun, 23 May 2010 18:02:34 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:59351 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754368Ab0EWWCe (ORCPT ); Sun, 23 May 2010 18:02:34 -0400 Received: by wyb29 with SMTP id 29so1106408wyb.19 for ; Sun, 23 May 2010 15:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=Z9tsG0fNczKqa3MxUb0uoupuZwnSs/rLT7lCowXSgrg=; b=R5eipyAcXzbD1zRkF14PnczH6h9Citur8hytSzae2rWBdNEulP+htBwhF+kelf7Bif DwHYWIv03UVz7s6OdWB4rozJvlEEuh5Xhi/YXs0VXIboExAT1zgLKt/h8TE+SqbKUvyC JjBtbGnY3GdnBwcDi4wxISUMGmbp19h90kRcc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=ghtJkkId3wCB4cxullDK+6Ab/VUVZE17BLsUavvdWf7MLAjVjF3TvPKyO/pUoKwtiE gyG3KDDUYq5aG/RyNMJlfSgR85uGnc3tPeWm28u4cMs+RfH4zGVKAA3/blebqfXsa0mK CjabAQsB8RiUINy0FRcIozRBEIBgMf+8qj1cI= Received: by 10.227.146.200 with SMTP id i8mr4460695wbv.169.1274652152609; Sun, 23 May 2010 15:02:32 -0700 (PDT) Received: from localhost ([41.239.65.235]) by mx.google.com with ESMTPS id h22sm26577725wbh.3.2010.05.23.15.02.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 23 May 2010 15:02:31 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: kvm@vger.kernel.org, mtosatti@redhat.com, anthony@codemonkey.ws, ryanh@us.ibm.com, Mohammed Gamal Subject: [PATCH] Print a user-friendly message on failed vmentry Date: Mon, 24 May 2010 01:02:12 +0300 Message-Id: <1274652132-8314-1-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 23 May 2010 22:02:37 +0000 (UTC) diff --git a/qemu-kvm.c b/qemu-kvm.c index 35a4c8a..3ef0565 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -106,6 +106,31 @@ static int handle_unhandled(uint64_t reason) return -EINVAL; } +#define VMX_INVALID_GUEST_STATE 0x21 + +static int handle_failed_vmentry(uint64_t reason) +{ + fprintf(stderr, "kvm: vm entry failed with error 0x%" PRIx64 "\n\n", reason); + + /* Perhaps we will need to check if this machine is intel since exit reason 0x21 + has a different interpretation on SVM */ + if (reason == VMX_INVALID_GUEST_STATE) { + fprintf(stderr, "If you're runnning a guest on an Intel machine without\n"); + fprintf(stderr, "unrestricted mode support, the failure can be most likely\n"); + fprintf(stderr, "due to the guest entering an invalid state for Intel VT.\n"); + fprintf(stderr, "For example, the guest maybe running in big real mode\n"); + fprintf(stderr, "which is not supported on less recent Intel processors.\n\n"); + fprintf(stderr, "You may want to try enabling KVM real mode emulation. To\n"); + fprintf(stderr, "enable it, you can run the following commands as root:\n"); + fprintf(stderr, "# rmmod kvm_intel\n"); + fprintf(stderr, "# rmmod kvm\n"); + fprintf(stderr, "# modprobe kvm_intel emulate_invalid_guest_state=1\n\n"); + fprintf(stderr, "WARNING: Real mode emulation is still work-in-progress\n"); + fprintf(stderr, "and thus it is not always guaranteed to work.\n\n"); + } + + return -EINVAL; +} static inline void set_gsi(kvm_context_t kvm, unsigned int gsi) { @@ -586,7 +611,7 @@ int kvm_run(CPUState *env) r = handle_unhandled(run->hw.hardware_exit_reason); break; case KVM_EXIT_FAIL_ENTRY: - r = handle_unhandled(run->fail_entry.hardware_entry_failure_reason); + r = handle_failed_vmentry(run->fail_entry.hardware_entry_failure_reason); break; case KVM_EXIT_EXCEPTION: fprintf(stderr, "exception %d (%x)\n", run->ex.exception,