[PATCH virtio-spec] balloon: trannsitional device support

From
Michael S. Tsirkin <>
Date
2015-04-01T15:06:00+00:00
ID
Thread
[PATCH virtio-spec] balloon: trannsitional device support
On Wed, Apr 01, 2015 at 04:44:41PM +0200, Cornelia Huck wrote:
> On Wed, 1 Apr 2015 14:59:46 +0200
> "Michael S. Tsirkin" <> wrote:
>
>
> Virtio 1.0 doesn't include a modern balloon device.  At some point we'll likely
>
> define an incompatible interface with a different ID and different
>
> semantics.  But for now, it's not a big effort to support a transitional
>
> balloon device: this has the advantage of supporting existing drivers,
>
> transparently, as well as transports that don't allow mixing virtio 0 and
>
> virtio 1 devices. And balloon is an easy device to test, so it's also useful
>
> for people to test virtio core handling of transitional devices.
> >
>
> The only interface issue is with the stats buffer, which has misaligned
>
> fields. We could leave it as is, but this sets a bad precedent that
>
> others might copy by mistake.
> >
>
> As we need to change stats code to do byteswaps for virtio 1.0, it seems easy
>
> to fix by prepending a 6 byte reserved field.  I also had to change config
>
> structure field types from __le32 to __u32 to match other devices. This means
>
> we need a couple of __force tags for legacy path but that seems minor.
> >
>
> Signed-off-by: Michael S. Tsirkin <>
> > ---
>
>  content.tex | 73 +++++++++++++++++++++++++++++++++++++++++++++++

--------------

>
>  1 file changed, 56 insertions(+), 17 deletions(-)
> >
>
> > @@ -4329,13 +4328,33 @@ guest memory statistics to the host.
> >
> >  \subsection{Feature bits}\label{sec:Device Types / Memory Balloon Device / Feature bits}
> >  \begin{description}
> > -\item[VIRTIO_BALLOON_F_MUST_TELL_HOST (0)] Host MUST be told before
> > -
pages from the balloon are used.
> > +\item[VIRTIO_BALLOON_F_MUST_TELL_HOST (0)] Host has to be told before
> > +
pages from the balloon are used by guest.
>
> Why this change? The device only needs to tolerate the guest using
> pages if that bit has not been negotiated?
>
> (...)

Merely because we shouldn't have MUST keywords outside
normative statements.
Maybe I should make this a separate patch, and queue for 1.0.

> > @@ -4347,24 +4366,29 @@ struct virtio_balloon_config {
> >  };
> >  \end{lstlisting}
> >
> > -Note that these fields are always little endian, despite convention
> > -that legacy device fields are guest endian.
> > +\subparagraph{Legacy Interface: Device configuration layout}\label{sec:Device Types / Memory Balloon Device / Device
> > +configuration layout / Legacy Interface: Device configuration layout}
> > +When using the legacy interface, transitional devices and drivers
> > +MUST format the fields in struct virtio_balloon_config
> > +according to the little-endian format.
>
> I'd like to keep it obvious that this is different from other legacy
> devices, so let's append "...unlike the usual convention for legacy
> devices"? Or do this in a footnote?

How about a slightly more specific "despite the usual
convention that legacy device fields are guest endian"?

>
> I think you also need to add the new normative sections to
> conformance.tex.

thanks, I forgot. Will add them.