From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: QEMU <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Jason Wang <jasowang@redhat.com>,
pl@kamp.de, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] virtio: Fix setting up host notifiers for vhost
Date: Thu, 30 Jun 2016 17:07:26 +0200 [thread overview]
Message-ID: <20160630170726.39257e86.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <CAJ+F1CLhOy7zrFP2v3RyYzL7W+ZOOe=VgP=bUEf6XoHhxod6PQ@mail.gmail.com>
On Thu, 30 Jun 2016 16:12:31 +0200
Marc-André Lureau <marcandre.lureau@gmail.com> wrote:
> Hi
>
> On Thu, Jun 30, 2016 at 1:52 PM, Cornelia Huck <cornelia.huck@de.ibm.com> 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 <jasowang@redhat.com>
> > Reported-by: Marc-André Lureau <marcandre.lureau@gmail.com>
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>
> That's indeed enough to fix vhost-user-test, however, vhost-user is still broken
>
> Start tests/vhost-user-bridge and then qemu -enable-kvm -m 1024
> -object memory-backend-file,id=mem,size=1024M,mem-path=/tmp,share=on
> -numa node,memdev=mem -mem-prealloc -chardev
> socket,id=char0,path=/tmp/vubr.sock -netdev
> type=vhost-user,id=mynet1,chardev=char0,vhostforce -device
> virtio-net-pci,netdev=mynet1
>
> Before your series, you can see data coming after init completed, now
> it stops at:
>
> vhost-user-bridge: tests/vhost-user-bridge.c:1014:
> vubr_set_vring_kick_exec: Assertion `(u64_arg &
> VHOST_USER_VRING_NOFD_MASK) == 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.
prev parent reply other threads:[~2016-06-30 15:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-30 11:52 [Qemu-devel] [PATCH v2] virtio: Fix setting up host notifiers for vhost Cornelia Huck
2016-06-30 12:04 ` Peter Lieven
2016-06-30 14:12 ` Marc-André Lureau
2016-06-30 15:07 ` Cornelia Huck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160630170726.39257e86.cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=famz@redhat.com \
--cc=jasowang@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).