From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1GhI-0006sI-9V for qemu-devel@nongnu.org; Sun, 29 Jun 2014 11:07:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1GhC-00038V-4Y for qemu-devel@nongnu.org; Sun, 29 Jun 2014 11:07:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1GhB-00038R-RC for qemu-devel@nongnu.org; Sun, 29 Jun 2014 11:07:10 -0400 Date: Sun, 29 Jun 2014 18:07:25 +0300 From: "Michael S. Tsirkin" Message-ID: <20140629150725.GA29448@redhat.com> References: <20140624151955.17522.62537.stgit@bahia.local> <20140624175126.17522.85549.stgit@bahia.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140624175126.17522.85549.stgit@bahia.local> Subject: Re: [Qemu-devel] [PATCH v9 22/22] vhost-net: disable when cross-endian List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , Juan Quintela , Rusty Russell , qemu-devel@nongnu.org, Alexander Graf , aneesh.kumar@linux.vnet.ibm.com, Anthony Liguori , Amit Shah , Paolo Bonzini , Andreas =?iso-8859-1?Q?F=E4rber?= On Tue, Jun 24, 2014 at 07:55:03PM +0200, Greg Kurz wrote: > As of today, vhost assumes guest and host have the same endianness. > This is definitely not compatible with modern PPC64 and ARM that > can change endianness at runtime. Let's disable vhost-net and print > an error message when we detect such a case: > > qemu-system-ppc64: vhost-net does not support cross-endian > qemu-system-ppc64: unable to start vhost net: 38: falling back on userspace virtio > > This way users can continue to run VMs without changing their setup and > have a chance to know that performance will impacted. s/will/will be/ > > Suggested-by: Michael S. Tsirkin > Signed-off-by: Greg Kurz > --- > hw/net/vhost_net.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > index 7ac7c21..f87c798 100644 > --- a/hw/net/vhost_net.c > +++ b/hw/net/vhost_net.c > @@ -275,6 +275,19 @@ static void vhost_net_stop_one(struct vhost_net *net, > vhost_dev_disable_notifiers(&net->dev, dev); > } > > +static bool vhost_net_device_endian_ok(VirtIODevice *vdev) > +{ > +#ifdef TARGET_IS_BIENDIAN > +#ifdef HOST_WORDS_BIGENDIAN > + return virtio_is_big_endian(vdev); > +#else > + return !virtio_is_big_endian(vdev); > +#endif > +#else > + return true; > +#endif > +} > + > int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, > int total_queues) > { > @@ -283,6 +296,12 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, > VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); > int r, i = 0; > > + if (!vhost_net_device_endian_ok(dev)) { > + error_report("vhost-net does not support cross-endian"); > + r = -ENOSYS; > + goto err; > + } > + > if (!k->set_guest_notifiers) { > error_report("binding does not support guest notifiers"); > r = -ENOSYS;