Received: from eggs.gnu.org ([2001:4830:134:3::10]:49567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4qbY-0001b1-Kb for qemu-devel@nongnu.org; Thu, 10 Nov 2016 09:45:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4qbV-0000Dn-Em for qemu-devel@nongnu.org; Thu, 10 Nov 2016 09:45:28 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33455) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c4qbV-0000D2-7U for qemu-devel@nongnu.org; Thu, 10 Nov 2016 09:45:25 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAAEivVr063641 for ; Thu, 10 Nov 2016 09:45:24 -0500 Received: from e06smtp06.uk.ibm.com (e06smtp06.uk.ibm.com [195.75.94.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 26mpt8mjxq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 10 Nov 2016 09:45:23 -0500 Received: from localhost by e06smtp06.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Nov 2016 14:45:19 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id C47C61B08023 for ; Thu, 10 Nov 2016 14:47:29 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAAEjGn011665702 for ; Thu, 10 Nov 2016 14:45:16 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 uAAEjG62007383 for ; Thu, 10 Nov 2016 07:45:16 -0700 References: <1478695476-19272-1-git-send-email-felipe@nutanix.com> From: Christian Borntraeger Date: Thu, 10 Nov 2016 15:45:14 +0100 MIME-Version: 1.0 In-Reply-To: <1478695476-19272-1-git-send-email-felipe@nutanix.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Message-Id: <2fa5b181-6246-3db1-beb2-e8fdbc15980c@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH v2] vhost: Update 'ioeventfd_started' with host notifiers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Felipe Franciosi , Paolo Bonzini , Stefan Hajnoczi , "Michael S. Tsirkin" Cc: "qemu-devel@nongnu.org" On 11/09/2016 01:44 PM, Felipe Franciosi wrote: > Following the recent refactor of virtio notfiers [1], more specifically > the patch that uses virtio_bus_set_host_notifier [2] by default, core > virtio code requires 'ioeventfd_started' to be set to true/false when > the host notifiers are configured. Because not all vhost devices were > update (eg. vhost-scsi) to use the new interface, this value is always > set to false. > > When booting a guest with a vhost-scsi backend controller, SeaBIOS will > initially configure the device which sets all notifiers. The guest will > continue to boot fine until the kernel virtio-scsi driver reinitialises > the device causing a stop followed by another start. Since > ioeventfd_started was never set to true, the 'stop' operation triggered > by virtio_bus_set_host_notifier() will not result in a call to > virtio_pci_ioeventfd_assign(assign=false). This leaves the memory > regions with stale notifiers and results on the next start triggering > the following assertion: > > kvm_mem_ioeventfd_add: error adding ioeventfd: File exists > Aborted > > This patch updates ioeventfd_started whenever the notifiers are set or > cleared, fixing this issue. > > Signed-off-by: Felipe Franciosi This also fixes vhost-net after reboot on s390/kvm for me Tested-by: Christian Borntraeger > > [1] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07748.html > [2] http://lists.nongnu.org/archive/html/qemu-devel/2016-10/msg07760.html > --- > v1->v2: > - Update ioeventfd_started in vhost_dev_enable/disable_notifiers() > instead of vhost_scsi_start/stop(). > - Reword the commit message accordingly. > --- > hw/virtio/vhost.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 131f164..1290963 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -1205,6 +1205,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) > goto fail_vq; > } > } > + VIRTIO_BUS(qbus)->ioeventfd_started = true; > > return 0; > fail_vq: > @@ -1239,6 +1240,7 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) > } > assert (r >= 0); > } > + VIRTIO_BUS(qbus)->ioeventfd_started = false; > virtio_device_start_ioeventfd(vdev); > } >