From patchwork Tue Mar 23 16:37:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 87693 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 o2NGgOtd008347 for ; Tue, 23 Mar 2010 16:42:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755285Ab0CWQmN (ORCPT ); Tue, 23 Mar 2010 12:42:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45664 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752287Ab0CWQmL (ORCPT ); Tue, 23 Mar 2010 12:42:11 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2NGgBeX018909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Mar 2010 12:42:11 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2NGgBtx016576; Tue, 23 Mar 2010 12:42:11 -0400 Received: from amt.cnet (vpn-10-84.rdu.redhat.com [10.11.10.84]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o2NGg8Cr031017; Tue, 23 Mar 2010 12:42:09 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 840B0652088; Tue, 23 Mar 2010 13:40:03 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o2NGe203019162; Tue, 23 Mar 2010 13:40:02 -0300 Message-Id: <20100323163812.479128327@redhat.com> User-Agent: quilt/0.47-1 Date: Tue, 23 Mar 2010 13:37:11 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: Marcelo Tosatti Subject: [patch 2/6] kvm: handle internal error References: <20100323163709.033115262@redhat.com> Content-Disposition: inline; filename=kvm_handle_internal_error X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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]); Tue, 23 Mar 2010 16:42:24 +0000 (UTC) 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