Print a user-friendly message on failed vmentry
PATCH RESEND 1/1 Print a user-friendly message on failed vmentry
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.
--- qemu-kvm.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)
qemu-kvm.c +26 -1
@@ -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,
Signature · 1 line
1.7.0.4
Quoted 25 lines · Mohammed Gamal
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.qemu-kvm.c +15
-0+#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" );
qemu-kvm.c static int handle_unhandled(uint64_t reason) · line 133
Quoted 10 lines
qemu-kvm.c +10
-0+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 ; +}
It's almost guaranteed to fail, isn't it? Is there any guest which fails with emulated_invalid_guest_state=0 but works with e_i_g_s=1?
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 47 lines · Avi Kivity
Quoted 46 lines · Mohammed Gamal
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.qemu-kvm.c +5
-0+#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 reason0x21
+ 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, "# modprobekvm_intelemulate_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");
+ }
Quoted 9 lines
qemu-kvm.c static int handle_unhandled(uint64_t reason) · line 133
Quoted 5 lines
qemu-kvm.c +3
-0+ + return -EINVAL; +}It's almost guaranteed to fail, isn't it? Is there any guest which fails with emulated_invalid_guest_state=0 but works with e_i_g_s=1?
You're right! Perhaps I should remove the e_i_g_s bit from the message. What do you think?
Quoted 4 lines
--
error compilingcommittee.c: too many arguments to function
Quoted 59 lines · Mohammed Gamal
Quoted 47 lines · Avi Kivity
Quoted 45 lines · Mohammed Gamal
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.qemu-kvm.c +5
-0+#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);
(quoted diff) +2
-0+ + /* Perhaps we will need to check if this machine is intel since exitreason
0x21qemu-kvm.c +3
-0+has a different interpretation on SVM */ +if (reason ==VMX_INVALID_GUEST_STATE ) { + fprintf(stderr, "If you're runnning a guest on an Intel machinewithout\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");qemu-kvm.c +3
-0+fprintf (stderr,"# rmmod kvm_intel\n" ); +fprintf (stderr,"# rmmod kvm\n" ); + fprintf(stderr, "# modprobe kvm_intelemulate_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");
+ }Quoted 10 lines
qemu-kvm.c static int handle_unhandled(uint64_t reason) · line 133
Quoted 6 lines
qemu-kvm.c +3
-0+ +return -EINVAL ; +}It's almost guaranteed to fail, isn't it? Is there any guest which fails with emulated_invalid_guest_state=0 but works with e_i_g_s=1?
Quoted 3 lines
You're right! Perhaps I should remove the
e_i_g_sbit from the message. What do you think?
Sure. Better than the current message.
Signature · 1 line
error compiling committee.c: too many arguments to function