From patchwork Mon May 31 19:40:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 103318 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 o4VJebvt016178 for ; Mon, 31 May 2010 19:40:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755795Ab0EaTkf (ORCPT ); Mon, 31 May 2010 15:40:35 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:47405 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754576Ab0EaTkf (ORCPT ); Mon, 31 May 2010 15:40:35 -0400 Received: by wwb28 with SMTP id 28so1490631wwb.19 for ; Mon, 31 May 2010 12:40:29 -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=WV3FPU/q6jzU5WMSse0m/Hv1++9Z3gOkQztefhL/2dE=; b=FCy8gAeEQk+I+IY7vYurkHMYN73XmaISdaGFvVmtaq4fNj9IVRgTM5waq+m2Xyemzk 0V2/srrD5j1aYgM++L5/vjKF+Rhz/NNdV7EpFaqZ07OLu+yOAPbrEzgaT34zqDMjVh3G M/mKoLRzRuf2inyb52oE2fR/2EUckd51C7SHc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=kv85FlpWY3XkTB9x8QGIwybaLpLQhx3gEGUccKAZjx3nggGtqBKTuNshreDLMnVeoe dYlOnyNOvJ25r74QlWlbIGoiP3/uBg0uYH63Z2ska/31ZgbagT5sqGYGYAKuxKWM7kKY hlPQblwruMXBTZk0aaN1MUOKD25CpoGC9meu4= Received: by 10.227.155.204 with SMTP id t12mr4659621wbw.29.1275334829100; Mon, 31 May 2010 12:40:29 -0700 (PDT) Received: from localhost ([41.237.144.24]) by mx.google.com with ESMTPS id u36sm43396000wbv.12.2010.05.31.12.40.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 31 May 2010 12:40:27 -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][RESEND] Print a user-friendly message on failed vmentry Date: Mon, 31 May 2010 22:40:18 +0300 Message-Id: <1275334818-6064-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]); Mon, 31 May 2010 19:40:37 +0000 (UTC) diff --git a/qemu-kvm.c b/qemu-kvm.c index 9534b31..b8a9278 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,