Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1175855 > unrolled thread

Re: [PULL] virtio/vhost: cross endian support

Started byGreg Kurz <gkurz@linux.vnet.ibm.com>
First post2015-07-02 11:20 +0200
Last post2015-07-07 19:00 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PULL] virtio/vhost: cross endian support Greg Kurz <gkurz@linux.vnet.ibm.com> - 2015-07-02 11:20 +0200
    Re: [PULL] virtio/vhost: cross endian support "Michael S. Tsirkin" <mst@redhat.com> - 2015-07-02 11:40 +0200
      Re: [PULL] virtio/vhost: cross endian support Thomas Huth <thuth@redhat.com> - 2015-07-07 18:40 +0200
        Re: [PULL] virtio/vhost: cross endian support "Michael S. Tsirkin" <mst@redhat.com> - 2015-07-07 19:00 +0200

#1175855 — Re: [PULL] virtio/vhost: cross endian support

FromGreg Kurz <gkurz@linux.vnet.ibm.com>
Date2015-07-02 11:20 +0200
SubjectRe: [PULL] virtio/vhost: cross endian support
Message-ID<pHIP1-Na-21@gated-at.bofh.it>
On Thu, 2 Jul 2015 08:01:28 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Wed, Jul 01, 2015 at 12:02:50PM -0700, Linus Torvalds wrote:
> > On Wed, Jul 1, 2015 at 2:31 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > > virtio/vhost: cross endian support
> > 
> > Ugh. Does this really have to be dynamic?
> > 
> > Can't virtio do the sane thing, and just use a _fixed_ endianness?
> > 
> > Doing a unconditional byte swap is faster and simpler than the crazy
> > conditionals. That's true regardless of endianness, but gets to be
> > even more so if the fixed endianness is little-endian, since BE is
> > not-so-slowly fading from the world.
> > 
> >                Linus
> 
> Yea, well - support for legacy BE guests on the new LE hosts is
> exactly the motivation for this.
> 
> I dislike it too, but there are two redeeming properties that
> made me merge this:
> 
> 1.  It's a trivial amount of code: since we wrap host/guest accesses
>     anyway, almost all of it is well hidden from drivers.
> 
> 2.  Sane platforms would never set flags like VHOST_CROSS_ENDIAN_LEGACY -
>     and when it's clear, there's zero overhead (as some point it was
>     tested by compiling with and without the patches, got the same
>     stripped binary).
> 
> Maybe we could create a Kconfig symbol to enforce point (2): prevent
> people from enabling it e.g. on x86. I will look into this - but it can
> be done by a patch on top, so I think this can be merged as is.
> 

This cross-endian *oddity* is targeting PowerPC book3s_64 processors... I
am not aware of any other users. Maybe create a symbol that would
be only selected by PPC_BOOK3S_64 ?


> Or do you know of someone using kernel with all config options enabled
> undiscriminately?
> 
> Thanks,
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1175869

From"Michael S. Tsirkin" <mst@redhat.com>
Date2015-07-02 11:40 +0200
Message-ID<pHJ8m-U3-5@gated-at.bofh.it>
In reply to#1175855
On Thu, Jul 02, 2015 at 11:12:56AM +0200, Greg Kurz wrote:
> On Thu, 2 Jul 2015 08:01:28 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Wed, Jul 01, 2015 at 12:02:50PM -0700, Linus Torvalds wrote:
> > > On Wed, Jul 1, 2015 at 2:31 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > > > virtio/vhost: cross endian support
> > > 
> > > Ugh. Does this really have to be dynamic?
> > > 
> > > Can't virtio do the sane thing, and just use a _fixed_ endianness?
> > > 
> > > Doing a unconditional byte swap is faster and simpler than the crazy
> > > conditionals. That's true regardless of endianness, but gets to be
> > > even more so if the fixed endianness is little-endian, since BE is
> > > not-so-slowly fading from the world.
> > > 
> > >                Linus
> > 
> > Yea, well - support for legacy BE guests on the new LE hosts is
> > exactly the motivation for this.
> > 
> > I dislike it too, but there are two redeeming properties that
> > made me merge this:
> > 
> > 1.  It's a trivial amount of code: since we wrap host/guest accesses
> >     anyway, almost all of it is well hidden from drivers.
> > 
> > 2.  Sane platforms would never set flags like VHOST_CROSS_ENDIAN_LEGACY -
> >     and when it's clear, there's zero overhead (as some point it was
> >     tested by compiling with and without the patches, got the same
> >     stripped binary).
> > 
> > Maybe we could create a Kconfig symbol to enforce point (2): prevent
> > people from enabling it e.g. on x86. I will look into this - but it can
> > be done by a patch on top, so I think this can be merged as is.
> > 
> 
> This cross-endian *oddity* is targeting PowerPC book3s_64 processors... I
> am not aware of any other users. Maybe create a symbol that would
> be only selected by PPC_BOOK3S_64 ?

I think some ARM systems are trying to support cross-endian
configurations as well.

Besides that, yes, this is more or less what I had in mind.

> 
> > Or do you know of someone using kernel with all config options enabled
> > undiscriminately?
> > 
> > Thanks,
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1178730

FromThomas Huth <thuth@redhat.com>
Date2015-07-07 18:40 +0200
Message-ID<pJE4A-7Yw-83@gated-at.bofh.it>
In reply to#1175869
On Thu, 2 Jul 2015 11:32:52 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Thu, Jul 02, 2015 at 11:12:56AM +0200, Greg Kurz wrote:
> > On Thu, 2 Jul 2015 08:01:28 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
...
> > > Yea, well - support for legacy BE guests on the new LE hosts is
> > > exactly the motivation for this.
> > > 
> > > I dislike it too, but there are two redeeming properties that
> > > made me merge this:
> > > 
> > > 1.  It's a trivial amount of code: since we wrap host/guest accesses
> > >     anyway, almost all of it is well hidden from drivers.
> > > 
> > > 2.  Sane platforms would never set flags like VHOST_CROSS_ENDIAN_LEGACY -
> > >     and when it's clear, there's zero overhead (as some point it was
> > >     tested by compiling with and without the patches, got the same
> > >     stripped binary).
> > > 
> > > Maybe we could create a Kconfig symbol to enforce point (2): prevent
> > > people from enabling it e.g. on x86. I will look into this - but it can
> > > be done by a patch on top, so I think this can be merged as is.
> > > 
> > 
> > This cross-endian *oddity* is targeting PowerPC book3s_64 processors... I
> > am not aware of any other users. Maybe create a symbol that would
> > be only selected by PPC_BOOK3S_64 ?
> 
> I think some ARM systems are trying to support cross-endian
> configurations as well.
> 
> Besides that, yes, this is more or less what I had in mind.

Would something simple like this already do the job:

diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -35,6 +35,7 @@ config VHOST
 
 config VHOST_CROSS_ENDIAN_LEGACY
 	bool "Cross-endian support for vhost"
+	depends on KVM_BOOK3S_64 || KVM_ARM_HOST
 	default n
 	---help---
 	  This option allows vhost to support guests with a different byte

?

If that looks acceptable, I can submit a proper patch if you like.

 Thomas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1178739

From"Michael S. Tsirkin" <mst@redhat.com>
Date2015-07-07 19:00 +0200
Message-ID<pJEnU-85A-5@gated-at.bofh.it>
In reply to#1178730
On Tue, Jul 07, 2015 at 06:36:53PM +0200, Thomas Huth wrote:
> On Thu, 2 Jul 2015 11:32:52 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > On Thu, Jul 02, 2015 at 11:12:56AM +0200, Greg Kurz wrote:
> > > On Thu, 2 Jul 2015 08:01:28 +0200
> > > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> ...
> > > > Yea, well - support for legacy BE guests on the new LE hosts is
> > > > exactly the motivation for this.
> > > > 
> > > > I dislike it too, but there are two redeeming properties that
> > > > made me merge this:
> > > > 
> > > > 1.  It's a trivial amount of code: since we wrap host/guest accesses
> > > >     anyway, almost all of it is well hidden from drivers.
> > > > 
> > > > 2.  Sane platforms would never set flags like VHOST_CROSS_ENDIAN_LEGACY -
> > > >     and when it's clear, there's zero overhead (as some point it was
> > > >     tested by compiling with and without the patches, got the same
> > > >     stripped binary).
> > > > 
> > > > Maybe we could create a Kconfig symbol to enforce point (2): prevent
> > > > people from enabling it e.g. on x86. I will look into this - but it can
> > > > be done by a patch on top, so I think this can be merged as is.
> > > > 
> > > 
> > > This cross-endian *oddity* is targeting PowerPC book3s_64 processors... I
> > > am not aware of any other users. Maybe create a symbol that would
> > > be only selected by PPC_BOOK3S_64 ?
> > 
> > I think some ARM systems are trying to support cross-endian
> > configurations as well.
> > 
> > Besides that, yes, this is more or less what I had in mind.
> 
> Would something simple like this already do the job:
> 
> diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
> --- a/drivers/vhost/Kconfig
> +++ b/drivers/vhost/Kconfig
> @@ -35,6 +35,7 @@ config VHOST
>  
>  config VHOST_CROSS_ENDIAN_LEGACY
>  	bool "Cross-endian support for vhost"
> +	depends on KVM_BOOK3S_64 || KVM_ARM_HOST
>  	default n
>  	---help---
>  	  This option allows vhost to support guests with a different byte
> 
> ?

Do all ARM hosts support this dynamic endian-ness?

> If that looks acceptable, I can submit a proper patch if you like.
> 
>  Thomas

I think I prefer some kind of symbol defined by these arches,
so I don't get to maintain an arch list in vhost.

-- 
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web