From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7IB8-0001hD-E7 for qemu-devel@nongnu.org; Thu, 17 Nov 2016 03:36:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7IB5-0003Sw-BE for qemu-devel@nongnu.org; Thu, 17 Nov 2016 03:36:18 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c7IB5-0003Rv-18 for qemu-devel@nongnu.org; Thu, 17 Nov 2016 03:36:15 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAH8XkVi109251 for ; Thu, 17 Nov 2016 03:36:13 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 26s2hf6x5k-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 17 Nov 2016 03:36:12 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Nov 2016 08:36:10 -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 6D88A1B0805F for ; Thu, 17 Nov 2016 08:38:23 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAH8a7VE25165832 for ; Thu, 17 Nov 2016 08:36:07 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uAH8a6GU028230 for ; Thu, 17 Nov 2016 01:36:07 -0700 Date: Thu, 17 Nov 2016 09:36:05 +0100 From: Cornelia Huck In-Reply-To: <20161116180551.9611-2-pbonzini@redhat.com> References: <20161116180551.9611-1-pbonzini@redhat.com> <20161116180551.9611-2-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20161117093605.0ec80f80.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 1/3] virtio: introduce grab/release_ioeventfd to fix vhost List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, borntraeger@de.ibm.com, alex.williamson@redhat.com, felipe@nutanix.com, mst@redhat.com On Wed, 16 Nov 2016 19:05:49 +0100 Paolo Bonzini wrote: > Following the recent refactoring of virtio notifiers [1], more specifically > the patch ed08a2a0b ("virtio: use virtio_bus_set_host_notifier to > start/stop ioeventfd") 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. > > When vhost is stopped and started, however, there is 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 reintroduces (hopefully in a cleaner way) the concept > that was present with ioeventfd_disabled before the refactoring. > When ioeventfd_grabbed>0, ioeventfd_started tracks whether ioeventfd > should be enabled or not, but ioeventfd is actually not started at > all until vhost releases the host notifiers. > > [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 > > Reported-by: Felipe Franciosi > Reported-by: Christian Borntraeger > Reported-by: Alex Williamson > Fixes: ed08a2a0b ("virtio: use virtio_bus_set_host_notifier to start/stop ioeventfd") > Signed-off-by: Paolo Bonzini > Message-Id: <20161111192855.26350-1-pbonzini@redhat.com> > Signed-off-by: Paolo Bonzini > --- > v1->v2: more comments [Cornelia] > > hw/virtio/vhost.c | 14 +++++----- > hw/virtio/virtio-bus.c | 58 ++++++++++++++++++++++++++++++++++-------- > hw/virtio/virtio.c | 16 ++++++++++++ > include/hw/virtio/virtio-bus.h | 14 ++++++++++ > include/hw/virtio/virtio.h | 2 ++ > 5 files changed, 86 insertions(+), 18 deletions(-) Reviewed-by: Cornelia Huck