qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	Qinghua Cheng <qcheng@redhat.com>,
	qemu devel list <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: virtio-vsock requires 'disable-legacy=on' in QEMU 5.1
Date: Thu, 13 Aug 2020 12:37:37 +0200	[thread overview]
Message-ID: <20200813123737.25ba11d2.cohuck@redhat.com> (raw)
In-Reply-To: <20200813102430.vjnc56anqjaxn4tw@steredhat.lan>

On Thu, 13 Aug 2020 12:24:30 +0200
Stefano Garzarella <sgarzare@redhat.com> wrote:

> On Thu, Aug 13, 2020 at 11:28:20AM +0200, Cornelia Huck wrote:
> > On Thu, 13 Aug 2020 11:16:56 +0200
> > Stefano Garzarella <sgarzare@redhat.com> wrote:
> >   
> > > Hi,
> > > 
> > > Qinghua discovered that virtio-vsock-pci requires 'disable-legacy=on' in
> > > QEMU 5.1:
> > >     $ ./qemu-system-x86_64 ... -device vhost-vsock-pci,guest-cid=5
> > >     qemu-system-x86_64: -device vhost-vsock-pci,guest-cid=5:
> > >     device is modern-only, use disable-legacy=on
> > > 
> > > Bisecting I found that this behaviour starts from this commit:
> > > 9b3a35ec82 ("virtio: verify that legacy support is not accidentally on")  
> > 
> > Oh, I had heard that from others already, was still trying to figure
> > out what to do.
> >   
> > > 
> > > IIUC virtio-vsock is modern-only, so I tried this patch and it works:
> > > 
> > > diff --git a/hw/virtio/vhost-user-vsock-pci.c b/hw/virtio/vhost-user-vsock-pci.c
> > > index f4cf95873d..6e4cc874cd 100644
> > > --- a/hw/virtio/vhost-user-vsock-pci.c
> > > +++ b/hw/virtio/vhost-user-vsock-pci.c
> > > @@ -40,6 +40,7 @@ static void vhost_user_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
> > >      VHostUserVSockPCI *dev = VHOST_USER_VSOCK_PCI(vpci_dev);
> > >      DeviceState *vdev = DEVICE(&dev->vdev);
> > > 
> > > +    virtio_pci_force_virtio_1(vpci_dev);
> > >      qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
> > >  }
> > > 
> > > diff --git a/hw/virtio/vhost-vsock-pci.c b/hw/virtio/vhost-vsock-pci.c
> > > index a815278e69..f641b974e9 100644
> > > --- a/hw/virtio/vhost-vsock-pci.c
> > > +++ b/hw/virtio/vhost-vsock-pci.c
> > > @@ -44,6 +44,7 @@ static void vhost_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
> > >      VHostVSockPCI *dev = VHOST_VSOCK_PCI(vpci_dev);
> > >      DeviceState *vdev = DEVICE(&dev->vdev);
> > > 
> > > +    virtio_pci_force_virtio_1(vpci_dev);
> > >      qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
> > >  }
> > > 
> > > 
> > > Do you think this is the right approach or is there a better way to
> > > solve this issue?  
> > 
> > We basically have three possible ways to deal with this:
> > 
> > - Force it to modern (i.e., what you have been doing; would need the
> >   equivalent changes in ccw as well.)  
> 
> Oo, thanks for pointing out ccw!
> I don't know ccw well, in this case should we set dev->max_rev to 1 or 2
> to force to modern?

No, ->max_rev is the wrong side of the limit :) You want

    ccw_dev->force_revision_1 = true;

in _instance_init() (see e.g. virtio-ccw-gpu.c).

> 
> >   Pro: looks like the cleanest approach.
> >   Con: not sure if we would need backwards compatibility support,
> >   which looks hairy.  
> 
> Not sure too.

Yes, I'm not sure at all how to handle user-specified values for
legacy/modern.

> 
> > - Add vsock to the list of devices with legacy support.
> >   Pro: Existing setups continue to work.
> >   Con: If vsock is really virtio-1-only, we still carry around
> >   possibly broken legacy support.  
> 
> I'm not sure it is virtio-1-only, but virtio-vsock was introduced in
> 2016, so I supposed it is modern-only.

Yes, I would guess so as well.

> 
> How can I verify that? Maybe forcing legacy mode and run some tests.

Probably yes. The likeliest area with issues is probably endianness, so
maybe with something big endian in the mix?

> 
> > - Do nothing, have users force legacy off. Bad idea, as ccw has no way
> >   to do that on the command line.
> > 
> > The first option is probably best.
> >  
> 
> Yeah, I agree with you!

Yes, it's really a pity we only noticed this after the release; this
was supposed to stop new devices with legacy support creeping in, not
to break existing command lines :(



  reply	other threads:[~2020-08-13 10:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13  9:16 virtio-vsock requires 'disable-legacy=on' in QEMU 5.1 Stefano Garzarella
2020-08-13  9:28 ` Cornelia Huck
2020-08-13 10:24   ` Stefano Garzarella
2020-08-13 10:37     ` Cornelia Huck [this message]
2020-08-13 12:04       ` Stefano Garzarella
2020-08-17 10:27         ` Cornelia Huck
2020-08-17 13:11           ` Stefano Garzarella
2020-08-17 14:37             ` Cornelia Huck
2020-08-18 12:44             ` Cornelia Huck
2020-08-18 14:01               ` Stefano Garzarella
2020-08-18 14:31                 ` Cornelia Huck
2020-08-18 15:28                   ` Stefano Garzarella
2020-08-18 15:49                     ` Cornelia Huck
2020-08-19  9:48       ` Auger Eric
2020-08-13 15:36 ` no-reply

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=20200813123737.25ba11d2.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=qcheng@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --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).