From patchwork Mon Feb 7 11:19:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 82187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 988ACB711B for ; Tue, 8 Feb 2011 09:36:46 +1100 (EST) Received: from localhost ([127.0.0.1]:44277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmPQT-00048t-Bq for incoming@patchwork.ozlabs.org; Mon, 07 Feb 2011 06:38:37 -0500 Received: from [140.186.70.92] (port=45744 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmP81-0006oS-4C for qemu-devel@nongnu.org; Mon, 07 Feb 2011 06:19:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmP7y-0007xI-9t for qemu-devel@nongnu.org; Mon, 07 Feb 2011 06:19:33 -0500 Received: from goliath.siemens.de ([192.35.17.28]:23597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmP7x-0007vY-NM for qemu-devel@nongnu.org; Mon, 07 Feb 2011 06:19:30 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id p17BJSS1003816; Mon, 7 Feb 2011 12:19:28 +0100 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p17BJQKR027537; Mon, 7 Feb 2011 12:19:28 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Date: Mon, 7 Feb 2011 12:19:21 +0100 Message-Id: <28160534f6dc10c60db0349167c0fb720fb93d20.1297077507.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.28 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 10/15] kvm: x86: Catch and report failing IRQ and NMI injections X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We do not need to abort, but the user should be notified that weird things go on. Signed-off-by: Jan Kiszka --- target-i386/kvm.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 8668cb3..0aa0a41 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -1442,11 +1442,17 @@ int kvm_arch_get_registers(CPUState *env) void kvm_arch_pre_run(CPUState *env, struct kvm_run *run) { + int ret; + /* Inject NMI */ if (env->interrupt_request & CPU_INTERRUPT_NMI) { env->interrupt_request &= ~CPU_INTERRUPT_NMI; DPRINTF("injected NMI\n"); - kvm_vcpu_ioctl(env, KVM_NMI); + ret = kvm_vcpu_ioctl(env, KVM_NMI); + if (ret < 0) { + fprintf(stderr, "KVM: injection failed, NMI lost (%s)\n", + strerror(-ret)); + } } if (!kvm_irqchip_in_kernel()) { @@ -1467,9 +1473,13 @@ void kvm_arch_pre_run(CPUState *env, struct kvm_run *run) struct kvm_interrupt intr; intr.irq = irq; - /* FIXME: errors */ DPRINTF("injected interrupt %d\n", irq); - kvm_vcpu_ioctl(env, KVM_INTERRUPT, &intr); + ret = kvm_vcpu_ioctl(env, KVM_INTERRUPT, &intr); + if (ret < 0) { + fprintf(stderr, + "KVM: injection failed, interrupt lost (%s)\n", + strerror(-ret)); + } } }