From patchwork Mon Dec 11 07:21:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladi Prosek X-Patchwork-Id: 10104347 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9D60A602A7 for ; Mon, 11 Dec 2017 07:24:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7352B206E2 for ; Mon, 11 Dec 2017 07:24:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66C5628565; Mon, 11 Dec 2017 07:24:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1E729206E2 for ; Mon, 11 Dec 2017 07:24:31 +0000 (UTC) Received: from localhost ([::1]:51134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOIRy-0003mt-Gp for patchwork-qemu-devel@patchwork.kernel.org; Mon, 11 Dec 2017 02:24:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOIOx-0000Cs-Qj for qemu-devel@nongnu.org; Mon, 11 Dec 2017 02:21:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eOIOw-0003mV-Vk for qemu-devel@nongnu.org; Mon, 11 Dec 2017 02:21:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34320) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eOIOw-0003ls-Pa for qemu-devel@nongnu.org; Mon, 11 Dec 2017 02:21:22 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3D038553F; Mon, 11 Dec 2017 07:21:21 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3B2D5C6C5; Mon, 11 Dec 2017 07:21:20 +0000 (UTC) From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 11 Dec 2017 08:21:10 +0100 Message-Id: <20171211072110.9058-5-lprosek@redhat.com> In-Reply-To: <20171211072110.9058-1-lprosek@redhat.com> References: <20171211072110.9058-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 11 Dec 2017 07:21:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 4/4] ivshmem: Disable irqfd on device reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: geoff@hostfission.com, pbonzini@redhat.com, armbru@redhat.com, marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The effects of ivshmem_enable_irqfd() was not undone on device reset. This manifested as: ivshmem_add_kvm_msi_virq: Assertion `!s->msi_vectors[vector].pdev' failed. when irqfd was enabled before reset and then enabled again after reset, making ivshmem_enable_irqfd() run for the second time. To reproduce, run: ivshmem-server and QEMU with: -device ivshmem-doorbell,chardev=iv -chardev socket,path=/tmp/ivshmem_socket,id=iv then install the Windows driver, at the time of writing available at: https://github.com/virtio-win/kvm-guest-drivers-windows/tree/master/ivshmem and crash-reboot the guest by inducing a BSOD. Signed-off-by: Ladi Prosek Reviewed-by: Markus Armbruster --- hw/misc/ivshmem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index d1bb246d12..9c7e74ef12 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -758,10 +758,14 @@ static void ivshmem_msix_vector_use(IVShmemState *s) } } +static void ivshmem_disable_irqfd(IVShmemState *s); + static void ivshmem_reset(DeviceState *d) { IVShmemState *s = IVSHMEM_COMMON(d); + ivshmem_disable_irqfd(s); + s->intrstatus = 0; s->intrmask = 0; if (ivshmem_has_feature(s, IVSHMEM_MSI)) {