From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxVRz-00067G-Ql for qemu-devel@nongnu.org; Fri, 21 Oct 2016 04:45:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxVRu-0001lz-1W for qemu-devel@nongnu.org; Fri, 21 Oct 2016 04:45:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54827 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxVRt-0001lk-Qu for qemu-devel@nongnu.org; Fri, 21 Oct 2016 04:45:09 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9L8hw17125497 for ; Fri, 21 Oct 2016 04:45:09 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 267dsu4xdq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 21 Oct 2016 04:45:08 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Oct 2016 09:45:06 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id B1A9C219004D for ; Fri, 21 Oct 2016 09:44:20 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9L8j47K6553992 for ; Fri, 21 Oct 2016 08:45:04 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9L8j3iu017713 for ; Fri, 21 Oct 2016 02:45:04 -0600 Date: Fri, 21 Oct 2016 10:45:02 +0200 From: Cornelia Huck In-Reply-To: References: <1476100421-28772-1-git-send-email-pbonzini@redhat.com> <20161019141759.67a37694.cornelia.huck@de.ibm.com> <20161019173820.31820483.cornelia.huck@de.ibm.com> <10a6fad6-3c94-80c5-48a1-adb3e0038192@redhat.com> <20161020110355.7af28405.cornelia.huck@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20161021104502.1d6c5454.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 00/12] virtio: cleanup ioeventfd start/stop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel On Thu, 20 Oct 2016 18:53:31 +0200 Paolo Bonzini wrote: > No, it's because virtio-mmio can be created without a device > underneath. virtio_bus_start_ioeventfd in that case is wrong, but > virtio_bus_stop_ioeventfd should be a no-op. The fix is trivial: I tend to forget this virtio-mmio speciality... > > diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c > index 0479704..bf61f66 100644 > --- a/hw/virtio/virtio-bus.c > +++ b/hw/virtio/virtio-bus.c > @@ -172,12 +172,15 @@ int virtio_bus_start_ioeventfd(VirtioBusState *bus) > > void virtio_bus_stop_ioeventfd(VirtioBusState *bus) > { > - VirtIODevice *vdev = virtio_bus_get_device(bus); > - VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); > + VirtIODevice *vdev; > + VirtioDeviceClass *vdc; > > if (!bus->ioeventfd_started) { > return; > } > + > + vdev = virtio_bus_get_device(bus); > + vdc = VIRTIO_DEVICE_GET_CLASS(vdev); > vdc->stop_ioeventfd(vdev); > bus->ioeventfd_started = false; > } Looks sane, and make check passes with this applied.