Received: from eggs.gnu.org ([2001:4830:134:3::10]:49862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIdZ4-0006Kv-Gd for qemu-devel@nongnu.org; Thu, 30 Jun 2016 11:07:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIdZ0-0002J8-2b for qemu-devel@nongnu.org; Thu, 30 Jun 2016 11:07:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37294 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIdYz-0002Ii-Tn for qemu-devel@nongnu.org; Thu, 30 Jun 2016 11:07:34 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5UF5hDV066010 for ; Thu, 30 Jun 2016 11:07:33 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 23v09r1qq2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 30 Jun 2016 11:07:33 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Jun 2016 16:07:31 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id CADF617D8042 for ; Thu, 30 Jun 2016 16:08:49 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5UF7T0f18219460 for ; Thu, 30 Jun 2016 15:07:29 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u5UF7SgI006353 for ; Thu, 30 Jun 2016 11:07:29 -0400 Date: Thu, 30 Jun 2016 17:07:26 +0200 From: Cornelia Huck In-Reply-To: References: <1467287567-2632-1-git-send-email-cornelia.huck@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Message-Id: <20160630170726.39257e86.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH v2] virtio: Fix setting up host notifiers for vhost List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TWFyYy1BbmRyw6k=?= Lureau Cc: QEMU , "Michael S. Tsirkin" , Fam Zheng , Stefan Hajnoczi , Jason Wang , pl@kamp.de, Paolo Bonzini On Thu, 30 Jun 2016 16:12:31 +0200 Marc-Andr=C3=A9 Lureau wrote: > Hi >=20 > On Thu, Jun 30, 2016 at 1:52 PM, Cornelia Huck = wrote: > > When setting up host notifiers, virtio_bus_set_host_notifier() > > simply switches the handler. This will only work, however, if > > the ioeventfd has already been setup; this is true for dataplane, > > but not for vhost, and will completely break things if the > > ioeventfd is disabled for the device. > > > > Fix this by starting the ioeventfd on assign if that has not > > happened before, and only switch the handler if the ioeventfd > > has really been started. > > > > While we're at it, also fixup the unsetting path of > > set_host_notifier_internal(). > > > > Fixes: 6798e245a3 ("virtio-bus: common ioeventfd infrastructure") > > Reported-by: Jason Wang > > Reported-by: Marc-Andr=C3=A9 Lureau > > Signed-off-by: Cornelia Huck >=20 > That's indeed enough to fix vhost-user-test, however, vhost-user is still= broken >=20 > Start tests/vhost-user-bridge and then qemu -enable-kvm -m 1024 > -object memory-backend-file,id=3Dmem,size=3D1024M,mem-path=3D/tmp,share= =3Don > -numa node,memdev=3Dmem -mem-prealloc -chardev > socket,id=3Dchar0,path=3D/tmp/vubr.sock -netdev > type=3Dvhost-user,id=3Dmynet1,chardev=3Dchar0,vhostforce -device > virtio-net-pci,netdev=3Dmynet1 >=20 > Before your series, you can see data coming after init completed, now > it stops at: >=20 > vhost-user-bridge: tests/vhost-user-bridge.c:1014: > vubr_set_vring_kick_exec: Assertion `(u64_arg & > VHOST_USER_VRING_NOFD_MASK) =3D=3D 0' failed. Grgh, the whole semantics of host notifiers are a mess. Before, the host notifier callbacks would (on assign) deregister the old eventfd and then register a new notifier - regardless whether the device had disabled ioeventfd. Now, we try to keep a preexisting eventfd registered, but don't try to force eventfds on a device that disabled ioeventfd - and that is what breaks vhost-user, apparently. I think the best way to deal with this is to have the now common host notifier setter revert to the old semantics for now. This re-introduces the 'no ioeventfd for a while' hole (which does not seem to show up in the wild) but fixes vhost in its various incarnations. We have time to come up with a better solution then (while still keeping the benefits of the unified host notifier handling). I'll cook up a patch.