qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] vhost-user simulation extension
@ 2019-09-02 12:12 Johannes Berg
  2019-09-02 12:12 ` [Qemu-devel] [RFC] docs: vhost-user: add in-band kick/call messages Johannes Berg
  2019-09-06 12:13 ` [Qemu-devel] [RFC] libvhost-user: implement VHOST_USER_PROTOCOL_F_KICK_CALL_MSGS Johannes Berg
  0 siblings, 2 replies; 38+ messages in thread
From: Johannes Berg @ 2019-09-02 12:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Stefan Hajnoczi

Hi all,

First of all, I'm not sure if QEMU actually maintains the master copy of
this document and it isn't like virtio? It *looks* like it does, given
that the updates are "do something" rather than "sync to some version",
but please let me know if I need to send this elsewhere.

Secondly, I'm not sure how amenable you are to changes that are likely
to not be of "production" use. There are many people using Linux for
simulation, but you don't necessarily have to make it easy for them :-)

Third, if this is accepted I'm not sure we'd currently implement it in
QEMU itself. We're currently working on user-mode-Linux because I haven't
found a really good way to control time in QEMU simulation (though other
people have, e.g. VMSimInt[1] has implemented this, AFAICT though only
in full simulation, not with KVM.) So again, this may or may not be a
show-stopper, let me know. The UML patch[2] to implement vhost-user has
been posted to the list but we expect to be making revisions to it before
it can be integrated.

With all that said, let me explain a bit more what this is about. In a
simulation system like VMSimInt or what we're working on, you have what
the VMSimInt paper[3] calls the "simulation calendar", where each of the
simulated components adds an entry and then gets told when (and for how
much simulated time) to run. This is necessary to ensure the simulation
will run the different components in the proper timeline, and if none of
the components has anything to do, time can just skip forward, similar to
the time-travel mode I implemented in UML[4].

Now, of course it's not very useful if you have multiple VMs that can be
on the same simulation time, if they cannot exchange data. VMSimInt has
its own network hooks in the code changes[5], but I'm also interested in
simulating devices (using the same simulation calendar), not just networks.

The obvious way of integrating devices seemed to be virtio/vhost-user, and
that's why we already implemented vhost-user in UML. Now, a bit later, I
realized that due to the asynchronous nature of kick/call on vrings, the
simulation calendar update cannot be guaranteed properly without some extra
synchronisation.

I haven't implemented it yet, but I'm convinced that the proposed addition
to the vhost-user spec would let us implement this properly, as we could
have the vring update message (VHOST_USER_VQ_KICK) put an entry on the
simulation calendar for actually processing the message before sending an
ACK reply back, and the same for VHOST_USER_VQ_CALL in the other direction.
The actual processing of the message on the vring would then happen when
the simulation calendar told that component to run, i.e. when the event
on the calendar actually gets scheduled.

There are obviously other ways of implementing this, for instance I could
use vhost-user polling mode, and then not really implement polling but
have an out-of-band message (e.g. through the communcation channel that's
also used for the simulation time/calendar [6]) to indiciate kick/call.
However, this is uglier in the code, extending the protocol in this way
would just require me to configure the drivers/devices to negotiate these
extensions and hook the interrupt handling on both sides to the simulation
calendar, the latter of which is necessary anyway.

Hopefully I've managed to explain what I'm trying to do here, questions or
suggestions are always welcome :-)

johannes

[1] http://www.ikr.uni-stuttgart.de/INDSimLib/
[2] https://patchwork.ozlabs.org/patch/1140033/
[3] http://www.ikr.uni-stuttgart.de/Content/Publications/Archive/We_SIMUTools_2014_40209.pdf
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=065038706f77a56754e8f0c2556dab7e22dfe577
[5] I've extracted them from their sources as a diff against QEMU v1.6.0:
    https://p.sipsolutions.net/af9a68ded948c07e.txt
[6] which I'm currently planning to implement using a separate virtio device
    with an appropriate driver that hooks into low-level UML things



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2019-09-12 20:38 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 12:12 [Qemu-devel] [RFC] vhost-user simulation extension Johannes Berg
2019-09-02 12:12 ` [Qemu-devel] [RFC] docs: vhost-user: add in-band kick/call messages Johannes Berg
2019-09-05 20:28   ` Johannes Berg
2019-09-09 16:00     ` Stefan Hajnoczi
2019-09-09 17:34       ` Johannes Berg
2019-09-10 15:03         ` Stefan Hajnoczi
2019-09-10 15:14           ` Johannes Berg
2019-09-10 15:33             ` Michael S. Tsirkin
2019-09-10 15:34               ` Johannes Berg
2019-09-11  6:56                 ` Stefan Hajnoczi
2019-09-11  7:35             ` Stefan Hajnoczi
2019-09-11  8:26               ` Johannes Berg
2019-09-11 15:17                 ` Stefan Hajnoczi
2019-09-11 15:31   ` Stefan Hajnoczi
2019-09-11 15:36     ` Johannes Berg
2019-09-11 15:38       ` Johannes Berg
2019-09-12 12:22       ` Stefan Hajnoczi
2019-09-12 20:37         ` Johannes Berg
2019-09-06 12:13 ` [Qemu-devel] [RFC] libvhost-user: implement VHOST_USER_PROTOCOL_F_KICK_CALL_MSGS Johannes Berg
2019-09-06 14:22   ` Michael S. Tsirkin
2019-09-06 14:48     ` Johannes Berg
2019-09-06 15:12       ` Michael S. Tsirkin
2019-09-06 15:32         ` Johannes Berg
2019-09-08 13:13           ` Michael S. Tsirkin
2019-09-09 11:35             ` Johannes Berg
2019-09-09 12:41               ` Michael S. Tsirkin
2019-09-09 13:05                 ` Johannes Berg
2019-09-09 13:48                   ` Michael S. Tsirkin
2019-09-09 13:50                     ` Johannes Berg
2019-09-09 14:59                       ` Michael S. Tsirkin
2019-09-09 15:26                         ` Johannes Berg
2019-09-09 15:34                           ` Johannes Berg
2019-09-09 15:45                             ` Michael S. Tsirkin
2019-09-09 15:47                               ` Johannes Berg
2019-09-10 15:52                       ` Johannes Berg
2019-09-11  9:16                         ` Michael S. Tsirkin
2019-09-11  9:20                           ` Johannes Berg
2019-09-11  9:54                             ` Michael S. Tsirkin

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).