From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 1/2] vhost: helpers to enable/disable vring endianness
Date: Thu, 21 Jan 2016 10:55:39 +0100 [thread overview]
Message-ID: <20160121105539.63093cb6.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20160113170941.23705.93915.stgit@bahia.huguette.org>
On Wed, 13 Jan 2016 18:09:41 +0100
Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:
> The default use case for vhost is when the host and the vring have the
> same endianness (default native endianness). But there are cases where
> they differ and vhost should byteswap when accessing the vring:
> - the host is big endian and the vring comes from a virtio 1.0 device
> which is always little endian
> - the architecture is bi-endian and the vring comes from a legacy virtio
> device with a different endianness than the endianness of the host (aka
> legacy cross-endian)
>
> These cases are handled by the vq->is_le and the optional vq->user_be,
> with the following logic:
> - if none of the fields is enabled, vhost access the vring without byteswap
> - if the vring is virtio 1.0 and the host is big endian, vq->is_le is
> enabled to enforce little endian access to the vring
> - if the vring is legacy cross-endian, userspace enables vq->user_be
> to inform vhost about the vring endianness. This endianness is then
> enforced for vring accesses through vq->is_le again
>
> The logic is unclear in the current code.
>
> This patch introduces helpers with explicit enable and disable semantics,
> for better clarity.
>
> No behaviour change.
>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
> drivers/vhost/vhost.c | 28 +++++++++++++++++++---------
> 1 file changed, 19 insertions(+), 9 deletions(-)
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
WARNING: multiple messages have this Message-ID (diff)
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 1/2] vhost: helpers to enable/disable vring endianness
Date: Thu, 21 Jan 2016 10:55:39 +0100 [thread overview]
Message-ID: <20160121105539.63093cb6.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20160113170941.23705.93915.stgit@bahia.huguette.org>
On Wed, 13 Jan 2016 18:09:41 +0100
Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:
> The default use case for vhost is when the host and the vring have the
> same endianness (default native endianness). But there are cases where
> they differ and vhost should byteswap when accessing the vring:
> - the host is big endian and the vring comes from a virtio 1.0 device
> which is always little endian
> - the architecture is bi-endian and the vring comes from a legacy virtio
> device with a different endianness than the endianness of the host (aka
> legacy cross-endian)
>
> These cases are handled by the vq->is_le and the optional vq->user_be,
> with the following logic:
> - if none of the fields is enabled, vhost access the vring without byteswap
> - if the vring is virtio 1.0 and the host is big endian, vq->is_le is
> enabled to enforce little endian access to the vring
> - if the vring is legacy cross-endian, userspace enables vq->user_be
> to inform vhost about the vring endianness. This endianness is then
> enforced for vring accesses through vq->is_le again
>
> The logic is unclear in the current code.
>
> This patch introduces helpers with explicit enable and disable semantics,
> for better clarity.
>
> No behaviour change.
>
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
> drivers/vhost/vhost.c | 28 +++++++++++++++++++---------
> 1 file changed, 19 insertions(+), 9 deletions(-)
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
next prev parent reply other threads:[~2016-01-21 9:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 17:09 [PATCH 0/2] vhost: cross-endian code cleanup Greg Kurz
2016-01-13 17:09 ` [PATCH 1/2] vhost: helpers to enable/disable vring endianness Greg Kurz
2016-01-21 9:55 ` Cornelia Huck [this message]
2016-01-21 9:55 ` Cornelia Huck
2016-02-10 11:21 ` Michael S. Tsirkin
2016-02-10 12:11 ` Greg Kurz
2016-02-10 13:12 ` Cornelia Huck
2016-02-10 13:12 ` Cornelia Huck
2016-02-10 15:08 ` Michael S. Tsirkin
2016-02-10 15:27 ` Greg Kurz
2016-02-10 15:27 ` Greg Kurz
2016-01-13 17:09 ` [PATCH 2/2] vhost: disentangle vring endianness stuff from the core code Greg Kurz
2016-01-21 9:56 ` Cornelia Huck
2016-01-21 9:56 ` Cornelia Huck
2016-02-10 11:48 ` Michael S. Tsirkin
2016-02-10 13:08 ` Greg Kurz
2016-02-10 13:23 ` Cornelia Huck
2016-02-10 13:23 ` Cornelia Huck
2016-02-10 13:40 ` Greg Kurz
2016-02-10 13:40 ` Greg Kurz
2016-02-10 11:48 ` Michael S. Tsirkin
2016-01-27 10:25 ` [PATCH 0/2] vhost: cross-endian code cleanup Greg Kurz
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=20160121105539.63093cb6.cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=gkurz@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@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.