|
From: | Anthony Liguori |
Subject: | [Qemu-devel] Re: virtio-serial semantics for binary data and guest agents |
Date: | Tue, 22 Feb 2011 17:09:58 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Lightning/1.0b1 Thunderbird/3.0.10 |
This seems like a huge oversight in the design of virtio-serial. Are we missing something here?
Regards, Anthony Liguori On 02/22/2011 04:40 PM, Michael Roth wrote:
Hi everyone,As some of you are aware we've been working for a few months now towards creating a qemu-specific guest agent to implement bi-directional RPCs between the host and the guest to support certain operations like copy/paste, guest-initiated shutdown, and basic file transfer.Currently the protocol uses the xmlrpc-c library to marshall functions and arguments into a data format we can transport over virtio-serial/isa-serial via an HTTP-like protocol. Recently some concerns have been raised over pulling an external dependency such as xmlrpc-c into qemu, and we've been looking at some alternatives.Some clear, well-defined approaches such as ASN.1/BER show much promise, but we currently lack a way to implement them cleanly due to the following drawbacks with virtio-serial which prevent us from being able to implement connection/session-oriented protocols:If something in the guest is attempting to read/write from the virtio-serial device, and nothing is connected to virtio-serial's host character device (say, a socket)1. writes will block until something connect()s, at which point the write will succeed2. reads will always return 0 until something connect()s, at which point the reads will block until there's dataThis makes it difficult (impossible?) to implement the notion of connect/disconnect or open/close over virtio-serial without layering another protocol on top using hackish things like length-encoded payloads or sentinel values to determine the end of one RPC/request/response/session and the start of the next.For instance, if the host side disconnects, then reconnects before we read(), we may never get the read()=0, and our FD remains valid. Whereas with a tcp/unix socket our FD is no longer valid, and the read()=0 is an event we can check for at any point after the other end does a close/disconnect.Or if the host side disconnects/closes before/while we write(), we block. If they reconnect, our write() succeeds, and they potentially end up with garbage meant for the previous process. With a tcp/unix socket, the write() will return an EPIPE indicating the FD is no longer valid.Since virtio-serial is meant to be a general-purpose transport for raw binary data as well as a pv serial console, I wonder if a virtio-serial mode with semantics closer to tcp/unix sockets is necessary? Any thoughts?Thanks, Mike
[Prev in Thread] | Current Thread | [Next in Thread] |