qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	qemu-devel@nongnu.org (open list:All patches CC here)
Cc: Olaf Hering <olaf@aepfle.de>
Subject: [PATCH v4] piix: fix xenfv regression, add compat machine xenfv-qemu4
Date: Fri, 27 Mar 2020 16:18:40 +0100	[thread overview]
Message-ID: <20200327151841.13877-1-olaf@aepfle.de> (raw)
In-Reply-To: <20200113174521.3336-1-olaf@aepfle.de>

With qemu4 an incompatible change was added to pc_piix, which makes it
practical impossible to migrate domUs started with qemu2 or qemu3 to
newer qemu versions. Commit 7fccf2a06890e3bc3b30e29827ad3fb93fe88fea
added and enabled a new member "smbus_no_migration_support". In commit
4ab2f2a8aabfea95cc53c64e13b3f67960b27fdf the vmstate_acpi got new
elements, which are conditionally filled. As a result, an incoming
migration expected smbus related data unless smbus migration was
disabled for a given MachineClass. Since first commit forgot to handle
'xenfv', domUs started with qemu4 are incompatible with their qemu3
siblings.

Using other existing machine types, such as 'pc-i440fx-3.1', is not
possible because 'xenfv' creates the 'xen-platform' PCI device at
00:02.0, while all other variants to run a domU would create it at
00:04.0.

To cover both the existing and the broken case of 'xenfv' in a single
qemu binary, a new compatibility variant of 'xenfv-qemu4' must be added
which targets domUs started with qemu-4.0, qemu-4.1 and qemu-4.2. The
existing 'xenfv' restores compatibility of qemu5+ with qemu2/3.

Host admins who started domUs with qemu-4.x have to use a wrapper script
which appends '-machine xenfv-qemu4' to the device-model command line.
This is only required if there is no maintenance window which allows to
temporary shutdown the domU and restart it with a fixed device-model.

The wrapper script is as simple as this:
  #!/bin/sh
  exec /usr/bin/qemu-system-i386 "$@" -machine xenfv-qemu4

With xl this script will be enabled with device_model_override=, see
xl.cfg(5). To live migrate a domU, adjust the existing domU.cfg and pass
it to xl migrate or xl save/restore:
  xl migrate -C new-domU.cfg domU remote-host
  xl save domU CheckpointFile new-domU.cfg
  xl restore new-domU.cfg CheckpointFile

With libvirt this script will be enabled with the <emulator> element in
domU.xml. Use 'virsh edit' prior 'virsh migrate' to replace the existing
<emulator> element to point it to the wrapper script.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 hw/i386/pc_piix.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e6756216f9..c565f41791 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -948,8 +948,21 @@ DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
 
 
 #ifdef CONFIG_XEN
+static void xenfv_qemu_4_x_machine_options(MachineClass *m)
+{
+    pc_i440fx_4_2_machine_options(m);
+    m->desc = "Xen Fully-virtualized PC (qemu 4.x compat)";
+    m->max_cpus = HVM_MAX_VCPUS;
+    m->default_machine_opts = "accel=xen";
+    m->smbus_no_migration_support = false;
+}
+
+DEFINE_PC_MACHINE(xenfv_qemu4, "xenfv-qemu4", pc_xen_hvm_init,
+                  xenfv_qemu_4_x_machine_options);
+
 static void xenfv_machine_options(MachineClass *m)
 {
+    pc_i440fx_3_1_machine_options(m);
     m->desc = "Xen Fully-virtualized PC";
     m->max_cpus = HVM_MAX_VCPUS;
     m->default_machine_opts = "accel=xen";


  parent reply	other threads:[~2020-03-27 15:19 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13 17:45 [PATCH v1] hw/i386: disable smbus migration for xenpv Olaf Hering
2020-01-13 17:46 ` [PATCH v1] hw/i386: disable smbus migration for xenfv Olaf Hering
2020-01-15 13:51 ` [PATCH v1] hw/i386: disable smbus migration for xenpv Michael S. Tsirkin
2020-01-16 18:03 ` [PATCH v2] hw/i386: disable smbus migration for xenfv Olaf Hering
2020-01-16 18:26   ` Paolo Bonzini
2020-01-16 18:33     ` Olaf Hering
2020-01-16 18:50       ` Paolo Bonzini
2020-01-17  9:22     ` Olaf Hering
2020-01-17 10:27       ` Paolo Bonzini
2020-01-17 13:06         ` Olaf Hering
2020-01-20 11:18           ` Paul Durrant
2020-01-27  9:09             ` Olaf Hering
2020-02-18 17:27               ` Olaf Hering
2020-02-18 17:37                 ` Paolo Bonzini
2020-02-18 18:30                   ` Olaf Hering
2020-02-18 19:44                   ` Olaf Hering
2020-02-19  8:05                     ` Paolo Bonzini
2020-02-19  8:13                       ` Olaf Hering
2020-01-27  9:35             ` Paolo Bonzini
2020-01-27 13:26               ` Olaf Hering
2020-01-27 18:21                 ` Paolo Bonzini
2020-02-19 11:35     ` Olaf Hering
2020-02-19 14:14       ` Olaf Hering
2020-02-20 10:50         ` Paolo Bonzini
2020-03-25  6:47 ` [PATCH v3] piix: fix xenfv regression, add compat machine xenfv-qemu4 Olaf Hering
2020-03-25  7:11   ` no-reply
2020-03-25  7:25   ` no-reply
2020-03-25 15:39   ` Paolo Bonzini
2020-03-25 15:45     ` Olaf Hering
2020-03-25 17:06       ` Paolo Bonzini
2020-03-27 15:19         ` Olaf Hering
2020-03-27 15:18 ` Olaf Hering [this message]
2020-03-27 15:45   ` [PATCH v4] " no-reply
2020-03-27 15:59   ` Paolo Bonzini
2020-03-28  7:09     ` Olaf Hering
2020-03-28  8:56       ` Paolo Bonzini
2020-04-06 16:00       ` Paolo Bonzini
2020-04-06 16:11         ` Olaf Hering
2020-03-27 16:01   ` 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=20200327151841.13877-1-olaf@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=ehabkost@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).