Re: [Qemu-devel] [PATCH v3 2/2] docs: update ivshmem device spec

2014-09-09 Thread Eric Blake
On 09/01/2014 03:52 AM, David Marchand wrote:

 What about upgrading QEMU and ivshmem-server while you have existing
 guests?  You cannot restart ivshmem-server, and the new QEMU would have
 to talk to the old ivshmem-server.

 Version negotiation also helps avoid confusion if someone combines
 ivshmem-server and QEMU from different origins (e.g. built from source
 and distro packaged).

Don't underestimate the likelihood of this happening.  Any long-running
process (which an ivshmem-server will be) continues running at the old
version, even when a package upgrade installs a new qemu binary; the new
binary should still be able to manage connections to the already-running
server.

Even neater would be a solution where an existing ivshmem-server could
re-exec an updated ivshmem-server binary that resulted from a distro
upgrade, hand over all state required for the new server to take over
from the point managed by the old server, so that you aren't stuck
running the old binary forever.  But that's a lot trickier to write, so
it is not necessary for a first implementation; and if you do that, then
you have the reverse situation to worry about (the new server must still
accept communication from existing old qemu binaries).

Note that the goal here is to support upgrades; it is probably okay if
downgrading from a new binary back to an old doesn't work correctly
(because the new software was using a feature not present in the old).


 It's a safeguard to prevent hard-to-diagnose failures when the system is
 misconfigured.

 
 Hum, so you want the code to be defensive against mis-use, why not.
 
 I wanted to keep modifications on ivshmem as little as possible in a
 first phase (all the more so as there are potential ivshmem users out
 there that I think will be impacted by a protocol change).

Existing ivshmem users MUST be aware that they are using something that
is not yet polished, and be prepared to make the upgrade to the polished
version.  It's best to minimize the hassle by making them upgrade
exactly once to a fully-robust version, rather than to have them upgrade
to a slightly-more robust version only to find out we didn't plan ahead
well enough to make further extensions in a back-compatible manner.

 
 Sending the version as the first vm_id with an associated fd to -1
 before sending the real client id should work with existing QEMU client
 code (hw/misc/ivshmem.c).
 
 Do you have a better idea ?
 Is there a best practice in QEMU for version negotiation that could
 work with ivshmem protocol ?

QMP starts off with a mandatory qmp_capabilities handshake, although
we haven't yet had to define any capabilities where cross-versioned
communication differs as a result.  Migration is somewhat of an example,
except that it is one-directional (we don't have a feedback path), so it
is somewhat best effort.  The qcow2 v3 file format is an example of
declaring features, rather than version numbers, and making decisions
about whether a feature is compatible (older clients can safely ignore
the bit, without corrupting the image but possibly having worse
performance) vs. incompatible (older clients must reject the image,
because not handling the feature correctly would corrupt the image).
The best handshakes are bi-directional - both sides advertise their
version (or better, their features), and a well-defined algorithm for
settling on the common subset of advertised features then ensures that
the two sides know how to talk to each other, or give a reason for
either side to disconnect early because of a missing feature.

 
 I have a v4 ready with this (and all the pending comments), I will send
 it later unless a better idea is exposed.
 
 
 Thanks.
 

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v3 2/2] docs: update ivshmem device spec

2014-09-01 Thread David Marchand

On 08/28/2014 11:49 AM, Stefan Hajnoczi wrote:

On Tue, Aug 26, 2014 at 01:04:30PM +0200, Paolo Bonzini wrote:

Il 26/08/2014 08:47, David Marchand ha scritto:


Using a version message supposes we want to keep ivshmem-server and QEMU
separated (for example, in two distribution packages) while we can avoid
this, so why would we do so ?

If we want the ivshmem-server to come with QEMU, then both are supposed
to be aligned on your system.


What about upgrading QEMU and ivshmem-server while you have existing
guests?  You cannot restart ivshmem-server, and the new QEMU would have
to talk to the old ivshmem-server.


Version negotiation also helps avoid confusion if someone combines
ivshmem-server and QEMU from different origins (e.g. built from source
and distro packaged).

It's a safeguard to prevent hard-to-diagnose failures when the system is
misconfigured.



Hum, so you want the code to be defensive against mis-use, why not.

I wanted to keep modifications on ivshmem as little as possible in a 
first phase (all the more so as there are potential ivshmem users out 
there that I think will be impacted by a protocol change).


Sending the version as the first vm_id with an associated fd to -1 
before sending the real client id should work with existing QEMU client 
code (hw/misc/ivshmem.c).


Do you have a better idea ?
Is there a best practice in QEMU for version negotiation that could 
work with ivshmem protocol ?


I have a v4 ready with this (and all the pending comments), I will send 
it later unless a better idea is exposed.



Thanks.

--
David Marchand
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH v3 2/2] docs: update ivshmem device spec

2014-08-28 Thread Stefan Hajnoczi
On Tue, Aug 26, 2014 at 01:04:30PM +0200, Paolo Bonzini wrote:
 Il 26/08/2014 08:47, David Marchand ha scritto:
  
  Using a version message supposes we want to keep ivshmem-server and QEMU
  separated (for example, in two distribution packages) while we can avoid
  this, so why would we do so ?
  
  If we want the ivshmem-server to come with QEMU, then both are supposed
  to be aligned on your system.
 
 What about upgrading QEMU and ivshmem-server while you have existing
 guests?  You cannot restart ivshmem-server, and the new QEMU would have
 to talk to the old ivshmem-server.

Version negotiation also helps avoid confusion if someone combines
ivshmem-server and QEMU from different origins (e.g. built from source
and distro packaged).

It's a safeguard to prevent hard-to-diagnose failures when the system is
misconfigured.

Stefan


pgpFp_zSoZiZ7.pgp
Description: PGP signature


Re: [Qemu-devel] [PATCH v3 2/2] docs: update ivshmem device spec

2014-08-26 Thread David Marchand

Hello Stefan,

On 08/08/2014 05:02 PM, Stefan Hajnoczi wrote:

On Fri, Aug 08, 2014 at 10:55:18AM +0200, David Marchand wrote:

+For each client (QEMU processes) that connects to the server:
+- the server assigns an ID for this client and sends this ID to him as the 
first
+  message,
+- the server sends a fd to the shared memory object to this client,
+- the server creates a new set of host eventfds associated to the new client 
and
+  sends this set to all already connected clients,
+- finally, the server sends all the eventfds sets for all clients to the new
+  client.


The protocol is not extensible and no version number is exchanged.  For
the most part this should be okay because clients must run on the same
machine as the server.  It is assumed clients and server are compatible
with each other.

I wonder if we'll get into trouble later if the protocol needs to be
extended or some operation needs to happen, like upgrading QEMU or the
ivshmem-server.  At the very least someone building from source but
using system QEMU or ivshmem-server could get confusing failures if the
protocol doesn't match.

How about sending a version message as the first thing during a
connection?


I am not too sure about this.

This would break current base version.

Using a version message supposes we want to keep ivshmem-server and QEMU 
separated (for example, in two distribution packages) while we can avoid 
this, so why would we do so ?


If we want the ivshmem-server to come with QEMU, then both are supposed 
to be aligned on your system.
If you want to test local modifications, then it means you know what you 
are doing and you will call the right ivshmem-server binary with the 
right QEMU binary.



Thanks.


--
David Marchand
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH v3 2/2] docs: update ivshmem device spec

2014-08-26 Thread Paolo Bonzini
Il 26/08/2014 08:47, David Marchand ha scritto:
 
 Using a version message supposes we want to keep ivshmem-server and QEMU
 separated (for example, in two distribution packages) while we can avoid
 this, so why would we do so ?
 
 If we want the ivshmem-server to come with QEMU, then both are supposed
 to be aligned on your system.

What about upgrading QEMU and ivshmem-server while you have existing
guests?  You cannot restart ivshmem-server, and the new QEMU would have
to talk to the old ivshmem-server.

Paolo

 If you want to test local modifications, then it means you know what you
 are doing and you will call the right ivshmem-server binary with the
 right QEMU binary.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH v3 2/2] docs: update ivshmem device spec

2014-08-08 Thread Stefan Hajnoczi
On Fri, Aug 08, 2014 at 10:55:18AM +0200, David Marchand wrote:
 +For each client (QEMU processes) that connects to the server:
 +- the server assigns an ID for this client and sends this ID to him as the 
 first
 +  message,
 +- the server sends a fd to the shared memory object to this client,
 +- the server creates a new set of host eventfds associated to the new client 
 and
 +  sends this set to all already connected clients,
 +- finally, the server sends all the eventfds sets for all clients to the new
 +  client.

The protocol is not extensible and no version number is exchanged.  For
the most part this should be okay because clients must run on the same
machine as the server.  It is assumed clients and server are compatible
with each other.

I wonder if we'll get into trouble later if the protocol needs to be
extended or some operation needs to happen, like upgrading QEMU or the
ivshmem-server.  At the very least someone building from source but
using system QEMU or ivshmem-server could get confusing failures if the
protocol doesn't match.

How about sending a version message as the first thing during a
connection?

Stefan


pgpQCEccZfgg9.pgp
Description: PGP signature