public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 2/6] kvm: handle internal error
Date: Tue, 23 Mar 2010 13:37:11 -0300	[thread overview]
Message-ID: <20100323163812.479128327@redhat.com> (raw)
In-Reply-To: 20100323163709.033115262@redhat.com

[-- Attachment #1: kvm_handle_internal_error --]
[-- Type: text/plain, Size: 1638 bytes --]

Port qemu-kvm's KVM_EXIT_INTERNAL_ERROR handling to upstream.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-uq/kvm-all.c
===================================================================
--- qemu-uq.orig/kvm-all.c
+++ qemu-uq/kvm-all.c
@@ -721,6 +721,32 @@ static int kvm_handle_io(uint16_t port, 
     return 1;
 }
 
+#ifdef KVM_CAP_INTERNAL_ERROR_DATA
+static void kvm_handle_internal_error(CPUState *env, struct kvm_run *run)
+{
+
+    if (kvm_check_extension(kvm_state, KVM_CAP_INTERNAL_ERROR_DATA)) {
+        int i;
+
+        fprintf(stderr, "KVM internal error. 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]);
+        }
+    }
+    cpu_dump_state(env, stderr, fprintf, 0);
+    if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
+        fprintf(stderr, "emulation failure\n");
+    }
+    /* FIXME: Should trigger a qmp message to let management know
+     * something went wrong.
+     */
+    vm_stop(0);
+}
+#endif
+
 void kvm_flush_coalesced_mmio_buffer(void)
 {
 #ifdef KVM_CAP_COALESCED_MMIO
@@ -836,6 +862,11 @@ int kvm_cpu_exec(CPUState *env)
         case KVM_EXIT_EXCEPTION:
             dprintf("kvm_exit_exception\n");
             break;
+#ifdef KVM_CAP_INTERNAL_ERROR_DATA
+        case KVM_EXIT_INTERNAL_ERROR:
+            kvm_handle_internal_error(env, run);
+            break;
+#endif
         case KVM_EXIT_DEBUG:
             dprintf("kvm_exit_debug\n");
 #ifdef KVM_CAP_SET_GUEST_DEBUG



  parent reply	other threads:[~2010-03-23 16:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 16:37 [patch 0/6] misc uq/master updates (v2) Marcelo Tosatti
2010-03-23 16:37 ` [patch 1/6] target-i386: print EFER in cpu_dump_state Marcelo Tosatti
2010-03-23 16:37 ` Marcelo Tosatti [this message]
2010-03-23 16:37 ` [patch 3/6] kvm: allow qemu to set EPT identity mapping address Marcelo Tosatti
2010-03-23 16:37 ` [patch 4/6] kvm_init_vcpu requires global lock held Marcelo Tosatti
2010-03-23 16:37 ` [patch 5/6] kvm: init mp_state Marcelo Tosatti
2010-03-23 16:37 ` [patch 6/6] kvm: remove explicit kvm_arch_reset_vcpu from kvm_init_vcpu Marcelo Tosatti
2010-06-23 12:29   ` Avi Kivity
2010-06-23 12:33     ` Avi Kivity
2010-06-23 13:19       ` Jan Kiszka
2010-06-23 13:26         ` Avi Kivity
2010-06-23 13:29           ` Jan Kiszka
2010-06-23 13:34             ` Avi Kivity
2010-03-24 10:00 ` [patch 0/6] misc uq/master updates (v2) Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100323163812.479128327@redhat.com \
    --to=mtosatti@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox