All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC 1/2] virtio_balloon: convert to virtio 1.0 endian-ness
Date: Wed, 3 Dec 2014 16:02:28 +0200	[thread overview]
Message-ID: <20141203140228.GA12370@redhat.com> (raw)
In-Reply-To: <20141202193930.2b8750f7.cornelia.huck@de.ibm.com>

On Tue, Dec 02, 2014 at 07:39:30PM +0100, Cornelia Huck wrote:
> On Tue, 2 Dec 2014 13:44:06 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > balloon device is not part of virtio 1.0 spec.  Still, it's easy enough
> > to make it handle endian-ness exactly as other virtio 1.0 devices: what
> > we gain from this, is that there's no need to special-case it in virtio
> > core.
> 
> Well, the balloon is weird in a number of ways, including its always
> little-endian config space.

Hmm yes, I forgot about that.

> But I'm not quite sure the spec covers this?

The spec does not cover balloon.  It merely includes a reference section
about legacy balloon device.  What to do when that device sets VERSION_1
is really up to us.

Patchset v8 simply makes balloon tell core it's legacy_only.
This is I guess fine as far as it goes.
I was still looking for the best way that involves minimal noise
in core. This looked like the best way: change 4 lines,
and drop all special casing in core, but given the config space
endian-ness mess, I'm not sure anymore.
I guess we'll just stick to what v8 does for now.

> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  include/uapi/linux/virtio_balloon.h | 5 +++--
> >  drivers/virtio/virtio_balloon.c     | 4 ++--
> >  2 files changed, 5 insertions(+), 4 deletions(-)
> > 
> 
> >  struct virtio_balloon_stat {
> > -	__u16 tag;
> > -	__u64 val;
> > +	__virtio16 tag;
> > +	__virtio64 val;
> >  } __attribute__((packed));
> 
> Would the respective fields in the spec need updating? While it is
> actually talking about legacy requirements, the fields are not
> specified as __virtio{16,64}.
> 
> Also, is changing the stat fields enough? I've not looked into balloon
> operation, but does the payload need some endianess conversion as well?

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC 1/2] virtio_balloon: convert to virtio 1.0 endian-ness
Date: Wed, 3 Dec 2014 16:02:28 +0200	[thread overview]
Message-ID: <20141203140228.GA12370@redhat.com> (raw)
In-Reply-To: <20141202193930.2b8750f7.cornelia.huck@de.ibm.com>

On Tue, Dec 02, 2014 at 07:39:30PM +0100, Cornelia Huck wrote:
> On Tue, 2 Dec 2014 13:44:06 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > balloon device is not part of virtio 1.0 spec.  Still, it's easy enough
> > to make it handle endian-ness exactly as other virtio 1.0 devices: what
> > we gain from this, is that there's no need to special-case it in virtio
> > core.
> 
> Well, the balloon is weird in a number of ways, including its always
> little-endian config space.

Hmm yes, I forgot about that.

> But I'm not quite sure the spec covers this?

The spec does not cover balloon.  It merely includes a reference section
about legacy balloon device.  What to do when that device sets VERSION_1
is really up to us.

Patchset v8 simply makes balloon tell core it's legacy_only.
This is I guess fine as far as it goes.
I was still looking for the best way that involves minimal noise
in core. This looked like the best way: change 4 lines,
and drop all special casing in core, but given the config space
endian-ness mess, I'm not sure anymore.
I guess we'll just stick to what v8 does for now.

> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  include/uapi/linux/virtio_balloon.h | 5 +++--
> >  drivers/virtio/virtio_balloon.c     | 4 ++--
> >  2 files changed, 5 insertions(+), 4 deletions(-)
> > 
> 
> >  struct virtio_balloon_stat {
> > -	__u16 tag;
> > -	__u64 val;
> > +	__virtio16 tag;
> > +	__virtio64 val;
> >  } __attribute__((packed));
> 
> Would the respective fields in the spec need updating? While it is
> actually talking about legacy requirements, the fields are not
> specified as __virtio{16,64}.
> 
> Also, is changing the stat fields enough? I've not looked into balloon
> operation, but does the payload need some endianess conversion as well?

  reply	other threads:[~2014-12-03 14:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 11:44 [PATCH RFC 1/2] virtio_balloon: convert to virtio 1.0 endian-ness Michael S. Tsirkin
2014-12-02 11:44 ` Michael S. Tsirkin
2014-12-02 11:44 ` [PATCH RFC 2/2] virtio_balloon: drop legacy_only Michael S. Tsirkin
2014-12-02 11:44   ` Michael S. Tsirkin
     [not found] ` <1417520617-2135-1-git-send-email-mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-02 18:39   ` [PATCH RFC 1/2] virtio_balloon: convert to virtio 1.0 endian-ness Cornelia Huck
2014-12-02 18:39     ` Cornelia Huck
2014-12-03 14:02     ` Michael S. Tsirkin [this message]
2014-12-03 14:02       ` Michael S. Tsirkin
2014-12-03 14:27       ` Cornelia Huck
2014-12-03 14:27         ` Cornelia Huck
2014-12-02 18:39 ` Cornelia Huck

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=20141203140228.GA12370@redhat.com \
    --to=mst@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.