From patchwork Tue May 25 15:29:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 102226 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 o4PFTiwD013569 for ; Tue, 25 May 2010 15:29:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758821Ab0EYP3h (ORCPT ); Tue, 25 May 2010 11:29:37 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:56182 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754168Ab0EYP3h (ORCPT ); Tue, 25 May 2010 11:29:37 -0400 Received: by wwe15 with SMTP id 15so1473047wwe.19 for ; Tue, 25 May 2010 08:29:35 -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=9Qt9jLhm+4cLut4oxRXyGL1OYjlrlsg5s6Y52svoWgg=; b=lI57tEmkqsfnFkcPsU585NCurr3fp1cSwr5PgSvVvzxWb71xaZw0jQ0gVl/YUE5weK yEbuKgjyttHZWQ0qUM6BK8WbhJoUGVQdaZAY46lFhVfWrTVoPpG/I+XFGSSK9nKCtlvh uwiodF0ESJSS1oLjezaUWdiOnFTl4HTaArB/A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=qrSu8oHKekRPEXnHSh9GhI5Jhry8hB5lwYi/QzIKyKXWfeosD8cbV0qieAUW5eqEfG hTWz/4+L6ggnn/uZvpFC68hvuaJddO5znOZZyLZU39EtWADFsne49uIOptycbV0iSW+U ioQJx46NL4C6W7KZI/rCHOAquXRw7leJzlj1Q= Received: by 10.216.168.135 with SMTP id k7mr4679028wel.129.1274801375449; Tue, 25 May 2010 08:29:35 -0700 (PDT) Received: from localhost ([41.239.68.72]) by mx.google.com with ESMTPS id v59sm1687183wec.15.2010.05.25.08.29.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 May 2010 08:29:34 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, anthony@codemonkey.ws, ryanh@us.ibm.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH v2] Print a user-friendly message on failed vmentry Date: Tue, 25 May 2010 18:29:22 +0300 Message-Id: <1274801362-5721-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]); Tue, 25 May 2010 15:29:44 +0000 (UTC) diff --git a/qemu-kvm.c b/qemu-kvm.c index 35a4c8a..24c15b4 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 0x80000021 + +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,