qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Marc Hartmayer <mhartmay@linux.ibm.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH 2/2] libvhost-user: handle endianness as mandated by the spec
Date: Mon, 3 Aug 2020 11:26:26 +0200	[thread overview]
Message-ID: <20200803112626.67f55526.cohuck@redhat.com> (raw)
In-Reply-To: <20200730140731.32912-3-mhartmay@linux.ibm.com>

On Thu, 30 Jul 2020 16:07:31 +0200
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> Since virtio existed even before it got standardized, the virtio
> standard defines the following types of virtio devices:
> 
>  + legacy device (pre-virtio 1.0)
>  + non-legacy or VIRTIO 1.0 device
>  + transitional device (which can act both as legacy and non-legacy)
> 
> Virtio 1.0 defines the fields of the virtqueues as little endian,
> while legacy uses guest's native endian [1]. Currently libvhost-user
> does not handle virtio endianness at all, i.e. it works only if the
> native endianness matches with whatever is actually needed. That means
> things break spectacularly on big-endian targets. Let us handle virtio
> endianness for non-legacy as required by the virtio specification
> [1]. 

Maybe add

"and fence legacy virtio, as there is no safe way to figure out the
needed endianness conversions for all cases."

> The fencing of legacy virtio devices is done in
> `vu_set_features_exec`.

Not that I disagree with fencing legacy virtio, but looking at some
vhost-user* drivers, I'm not sure everything will work as desired for
those (I might be missing something, though.)

- vhost-user-blk lists VERSION_1 in the supported features, but
  vhost-user-scsi doesn't... is there some inheritance going on that
  I'm missing?
- vhost-user-gpu-pci inherits from virtio-gpu-pci, so I guess it's fine
- vhost-user-input should also always have been virtio-1

So, has anybody been using vhost-user-scsi and can confirm that it
still works, or at least can be made to work?

> 
> [1] https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-210003
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  contrib/libvhost-user/libvhost-user.c | 77 +++++++++++++++------------
>  1 file changed, 43 insertions(+), 34 deletions(-)

The code change per se LGTM.



  parent reply	other threads:[~2020-08-03  9:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 14:07 [PATCH 0/2] Enable virtio-fs on s390x Marc Hartmayer
2020-07-30 14:07 ` [PATCH 1/2] virtio: add vhost-user-fs-ccw device Marc Hartmayer
2020-07-30 15:19   ` Cornelia Huck
2020-07-30 14:07 ` [PATCH 2/2] libvhost-user: handle endianness as mandated by the spec Marc Hartmayer
2020-08-02  5:13   ` Michael S. Tsirkin
2020-08-03 14:17     ` Marc Hartmayer
2020-08-03  9:26   ` Cornelia Huck [this message]
2020-08-21  8:50     ` Marc Hartmayer
2020-08-02  5:13 ` [PATCH 0/2] Enable virtio-fs on s390x Michael S. Tsirkin
2020-08-04 11:29   ` Dr. David Alan Gilbert
2020-08-27 12:19 ` Michael S. Tsirkin
2020-08-27 12:26   ` 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=20200803112626.67f55526.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mhartmay@linux.ibm.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 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).