From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] Print a user-friendly message on failed vmentry Date: Wed, 19 May 2010 16:52:03 -0500 Message-ID: <4BF45D83.5000808@codemonkey.ws> References: <1274303782-21497-1-git-send-email-m.gamal005@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mail-gw0-f46.google.com ([74.125.83.46]:35260 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900Ab0ESVwI (ORCPT ); Wed, 19 May 2010 17:52:08 -0400 Received: by gwaa20 with SMTP id a20so2158869gwa.19 for ; Wed, 19 May 2010 14:52:07 -0700 (PDT) In-Reply-To: <1274303782-21497-1-git-send-email-m.gamal005@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/19/2010 04:16 PM, Mohammed Gamal wrote: > This patch address bug report in https://bugs.launchpad.net/qemu/+bug/530077. > > Failed vmentries were handled with handle_unhandled() which prints a rather > unfriendly message to the user. This patch separates handling vmentry failures > from unknown exit reasons and prints a friendly message to the user. > > Signed-off-by: Mohammed Gamal > --- > qemu-kvm.c | 16 +++++++++++++++- > 1 files changed, 15 insertions(+), 1 deletions(-) > > diff --git a/qemu-kvm.c b/qemu-kvm.c > index 35a4c8a..deb4df8 100644 > --- a/qemu-kvm.c > +++ b/qemu-kvm.c > @@ -106,6 +106,20 @@ static int handle_unhandled(uint64_t reason) > return -EINVAL; > } > > +static int handle_failed_vmentry(uint64_t reason) > +{ > + fprintf(stderr, "kvm: vm entry failed with error 0x%" PRIx64 "\n\n", reason); > + fprintf(stderr, "If you're runnning a guest on an Intel machine, it can be\n"); > + fprintf(stderr, "most-likely due to the guest going into an invalid state\n"); > + fprintf(stderr, "for Intel VT. For example, the guest maybe running in big\n"); > + fprintf(stderr, "real mode which is not supported by Intel VT.\n\n"); > + fprintf(stderr, "You may want to try enabling real mode emulation in KVM.\n"); > + fprintf(stderr, "To Enable it, you may 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"); > + return -EINVAL; > +} > > Very nice. Regards, Anthony Liguori > static inline void set_gsi(kvm_context_t kvm, unsigned int gsi) > { > @@ -586,7 +600,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, >