aboutsummaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-01-21 21:48:07 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-01-23 02:27:20 -0200
commitbb44e0d12df70bd4a653341db4446daf6a9326be (patch)
tree0ff333c9db7b4cf5038c5a60466e56ef5ba2ea4f /kvm-all.c
parent73aaec4a39b3cf11082303a6cf6bcde8796c09c6 (diff)
kvm: Improve reporting of fatal errors
Report KVM_EXIT_UNKNOWN, KVM_EXIT_FAIL_ENTRY, and KVM_EXIT_EXCEPTION with more details to stderr. The latter two are so far x86-only, so move them into the arch-specific handler. Integrate the Intel real mode warning on KVM_EXIT_FAIL_ENTRY that qemu-kvm carries, but actually restrict it to Intel CPUs. Moreover, always dump the CPU state in case we fail. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/kvm-all.c b/kvm-all.c
index eaf927248f..10e11944b3 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -817,22 +817,22 @@ static int kvm_handle_io(uint16_t port, void *data, int direction, int size,
#ifdef KVM_CAP_INTERNAL_ERROR_DATA
static int kvm_handle_internal_error(CPUState *env, struct kvm_run *run)
{
-
+ fprintf(stderr, "KVM internal error.");
if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) {
int i;
- fprintf(stderr, "KVM internal error. Suberror: %d\n",
- run->internal.suberror);
-
+ fprintf(stderr, " Suberror: %d\n", run->internal.suberror);
for (i = 0; i < run->internal.ndata; ++i) {
fprintf(stderr, "extra data[%d]: %"PRIx64"\n",
i, (uint64_t)run->internal.data[i]);
}
+ } else {
+ fprintf(stderr, "\n");
}
- cpu_dump_state(env, stderr, fprintf, 0);
if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
fprintf(stderr, "emulation failure\n");
if (!kvm_arch_stop_on_emulation_error(env)) {
+ cpu_dump_state(env, stderr, fprintf, 0);
return 0;
}
}
@@ -966,15 +966,8 @@ int kvm_cpu_exec(CPUState *env)
ret = 1;
break;
case KVM_EXIT_UNKNOWN:
- DPRINTF("kvm_exit_unknown\n");
- ret = -1;
- break;
- case KVM_EXIT_FAIL_ENTRY:
- DPRINTF("kvm_exit_fail_entry\n");
- ret = -1;
- break;
- case KVM_EXIT_EXCEPTION:
- DPRINTF("kvm_exit_exception\n");
+ fprintf(stderr, "KVM: unknown exit, hardware reason %" PRIx64 "\n",
+ (uint64_t)run->hw.hardware_exit_reason);
ret = -1;
break;
#ifdef KVM_CAP_INTERNAL_ERROR_DATA
@@ -1001,6 +994,7 @@ int kvm_cpu_exec(CPUState *env)
} while (ret > 0);
if (ret < 0) {
+ cpu_dump_state(env, stderr, fprintf, 0);
vm_stop(0);
env->exit_request = 1;
}