qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Gonglei <arei.gonglei@huawei.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hw: report invalid disable-legacy|modern usage for virtio-1-only devs
Date: Fri, 15 Feb 2019 10:34:55 +0000	[thread overview]
Message-ID: <20190215103455.GB14454@redhat.com> (raw)
In-Reply-To: <20190128174857.GT4136@habkost.net>

On Mon, Jan 28, 2019 at 03:48:57PM -0200, Eduardo Habkost wrote:
> On Fri, Jan 18, 2019 at 01:38:26PM +0000, Daniel P. Berrangé wrote:
> > A number of virtio devices (gpu, crypto, mouse, keyboard, tablet) only
> > support the virtio-1 (aka modern) mode. Currently if the user launches
> > QEMU, setting those devices to enable legacy mode, QEMU will silently
> > create them in modern mode, ignoring the user's (mistaken) request.
> > 
> > This patch introduces proper data validation so that an attempt to
> > configure a virtio-1-only devices in legacy mode gets reported as an
> > error to the user.
> > 
> > Checking this required introduction of a new field to explicitly track
> > what operating model is to be used for a device, separately from the
> > disable_modern and disable_legacy fields that record the user's
> > requested configuration.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> 
> This breaks the virtio-1-only devices on pc-*-2.6:
> 
>   $ ./x86_64-softmmu/qemu-system-x86_64 -device virtio-vga -machine pc-i440fx-2.6
>   qemu-system-x86_64: -device virtio-vga: Unable to set disable-legacy=off on a virtio-1.0 only device
> 
> Probably the simplest way to fix that is to append the following to
> hw_compat_2_6:
> 
>   { virtio-vga,        disable-modern, off },
>   { virtio-gpu-pci,    disable-modern, off },
>   { virtio-input-pci,  disable-modern, off },
>   { virtio-crypto-pci, disable-modern, off }

That's no sufficient, as it needs to also set disable-legacy=on

Once we add all these extra properties, it becomes pointless to
try to use the generic settings against virtio-pci in hw_compat_2_6.
So I've just turn it into a whitelist, only listing the devices
which actually support both modern+legacy modes. This makes it
obvious which devices are being affected & avoids silent surprises
like this bug you found in my patch.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

      parent reply	other threads:[~2019-02-15 10:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 13:38 [Qemu-devel] [PATCH] hw: report invalid disable-legacy|modern usage for virtio-1-only devs Daniel P. Berrangé
2019-01-28 17:48 ` Eduardo Habkost
2019-02-01 22:19   ` Michael S. Tsirkin
2019-02-04 10:05     ` Daniel P. Berrangé
2019-02-15 10:34   ` Daniel P. Berrangé [this message]

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=20190215103455.GB14454@redhat.com \
    --to=berrange@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=ehabkost@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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 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).