All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-stable@nongnu.org, Robin Geuze <robing@transip.nl>
Subject: [Qemu-devel] [PULL v2 10/30] virtio: set low features early on load
Date: Tue, 5 Jul 2016 18:46:38 +0300	[thread overview]
Message-ID: <20160705184638-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1467733400-17206-1-git-send-email-mst@redhat.com>

virtio migrates the low 32 feature bits twice, the first copy is there
for compatibility but ever since
019a3edbb25f1571e876f8af1ce4c55412939e5d: ("virtio: make features 64bit
wide") it's ignored on load. This is wrong since virtio_net_load tests
self announcement and guest offloads before the second copy including
high feature bits is loaded.  This means that self announcement, control
vq and guest offloads are all broken after migration.

Fix it up by loading low feature bits: somewhat ugly since high and low
bits become out of sync temporarily, but seems unavoidable for
compatibility.  The right thing to do for new features is probably to
test the host features, anyway.

Fixes: 019a3edbb25f1571e876f8af1ce4c55412939e5d
    ("virtio: make features 64bit wide")
Cc: qemu-stable@nongnu.org
Reported-by: Robin Geuze <robing@transip.nl>
Tested-by: Robin Geuze <robing@transip.nl>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio/virtio.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 7ed06ea..18153d5 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1499,6 +1499,16 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
     }
     qemu_get_be32s(f, &features);
 
+    /*
+     * Temporarily set guest_features low bits - needed by
+     * virtio net load code testing for VIRTIO_NET_F_CTRL_GUEST_OFFLOADS
+     * VIRTIO_NET_F_GUEST_ANNOUNCE and VIRTIO_NET_F_CTRL_VQ.
+     *
+     * Note: devices should always test host features in future - don't create
+     * new dependencies like this.
+     */
+    vdev->guest_features = features;
+
     config_len = qemu_get_be32(f);
 
     /*
-- 
MST

  parent reply	other threads:[~2016-07-05 15:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1467733400-17206-1-git-send-email-mst@redhat.com>
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 01/30] xen: fix ram init regression Michael S. Tsirkin
2016-07-05 15:46   ` Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 02/30] hw/ppc: realize the PCI root bus as part of mac99 init Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 03/30] hw/pci: delay bus_master_enable_region initialization Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 04/30] q35: allow dynamic sysbus Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 05/30] hw/iommu: enable iommu with -device Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 06/30] machine: remove iommu property Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 07/30] piix: Set I440FXState member pci_info.w32 in one place Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 08/30] pc: Eliminate PcPciInfo Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 09/30] virtio: revert host notifiers to old semantics Michael S. Tsirkin
2016-07-05 15:46 ` Michael S. Tsirkin [this message]
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 11/30] Revert "virtio-net: unbreak self announcement and guest offloads after migration" Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 12/30] pci_register_bar: cleanup Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 13/30] log: Clean up misuse of Range for -dfilter Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 14/30] range: Eliminate direct Range member access Michael S. Tsirkin
2016-07-05 15:46 ` [Qemu-devel] [PULL v2 15/30] range: Replace internal representation of Range Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 16/30] log: Permit -dfilter 0..0xffffffffffffffff Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 17/30] tests: acpi: add CPU hotplug testcase Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 18/30] tests: add APIC.cphp and DSDT.cphp blobs Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 19/30] change pvscsi_init_msi() type to void Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 20/30] usb xhci: change msi/msix property type Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 21/30] intel-hda: change msi " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 22/30] mptsas: " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 23/30] megasas: change msi/msix " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 24/30] pci bridge dev: change msi " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 25/30] pci: Convert msi_init() to Error and fix callers to check it Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 26/30] megasas: remove unnecessary megasas_use_msi() Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 27/30] mptsas: remove unnecessary internal msi state flag Michael S. Tsirkin
2016-07-26  5:01   ` Amit Shah
2016-07-26  7:29     ` Cao jin
2016-07-26 11:18       ` Amit Shah
2016-07-26 13:10         ` Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 28/30] vmxnet3: " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 29/30] e1000e: " Michael S. Tsirkin
2016-07-05 15:47 ` [Qemu-devel] [PULL v2 30/30] vmw_pvscsi: " Michael S. Tsirkin

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=20160705184638-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=robing@transip.nl \
    /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.