qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eric Blake" <eblake@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Corey Minyard" <minyard@acm.org>,
	"Li Zhijian" <lizhijian@fujitsu.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Hanna Reitz" <hreitz@redhat.com>, "John Snow" <jsnow@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Corey Minyard" <cminyard@mvista.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Kevin Wolf" <kwolf@redhat.com>,
	qemu-s390x@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	qemu-arm@nongnu.org, libvir-list@redhat.com,
	"Stefan Weil" <sw@weilnetz.de>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Juan Quintela" <quintela@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org
Subject: [PULL 03/39] migration/doc: How to migrate when hosts have different features
Date: Tue, 24 Oct 2023 15:12:29 +0200	[thread overview]
Message-ID: <20231024131305.87468-4-quintela@redhat.com> (raw)
In-Reply-To: <20231024131305.87468-1-quintela@redhat.com>

Sometimes devices have different features depending of things outside
of qemu.  For instance the kernel.  Document how to handle that cases.

Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231018112827.1325-4-quintela@redhat.com>
---
 docs/devel/migration.rst | 97 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst
index 6fe275b1ec..974505e4a7 100644
--- a/docs/devel/migration.rst
+++ b/docs/devel/migration.rst
@@ -1138,3 +1138,100 @@ machine types to have the right value::
     +    { "virtio-blk-device", "num-queues", "1"},
          ...
      };
+
+A device with diferent features on both sides
+---------------------------------------------
+
+Let's assume that we are using the same QEMU binary on both sides,
+just to make the things easier.  But we have a device that has
+different features on both sides of the migration.  That can be
+because the devices are different, because the kernel driver of both
+devices have different features, whatever.
+
+How can we get this to work with migration.  The way to do that is
+"theoretically" easy.  You have to get the features that the device
+has in the source of the migration.  The features that the device has
+on the target of the migration, you get the intersection of the
+features of both sides, and that is the way that you should launch
+QEMU.
+
+Notice that this is not completely related to QEMU.  The most
+important thing here is that this should be handled by the managing
+application that launches QEMU.  If QEMU is configured correctly, the
+migration will succeed.
+
+That said, actually doing it is complicated.  Almost all devices are
+bad at being able to be launched with only some features enabled.
+With one big exception: cpus.
+
+You can read the documentation for QEMU x86 cpu models here:
+
+https://qemu-project.gitlab.io/qemu/system/qemu-cpu-models.html
+
+See when they talk about migration they recommend that one chooses the
+newest cpu model that is supported for all cpus.
+
+Let's say that we have:
+
+Host A:
+
+Device X has the feature Y
+
+Host B:
+
+Device X has not the feature Y
+
+If we try to migrate without any care from host A to host B, it will
+fail because when migration tries to load the feature Y on
+destination, it will find that the hardware is not there.
+
+Doing this would be the equivalent of doing with cpus:
+
+Host A:
+
+$ qemu-system-x86_64 -cpu host
+
+Host B:
+
+$ qemu-system-x86_64 -cpu host
+
+When both hosts have different cpu features this is guaranteed to
+fail.  Especially if Host B has less features than host A.  If host A
+has less features than host B, sometimes it works.  Important word of
+last sentence is "sometimes".
+
+So, forgetting about cpu models and continuing with the -cpu host
+example, let's see that the differences of the cpus is that Host A and
+B have the following features:
+
+Features:   'pcid'  'stibp' 'taa-no'
+Host A:        X       X
+Host B:                        X
+
+And we want to migrate between them, the way configure both QEMU cpu
+will be:
+
+Host A:
+
+$ qemu-system-x86_64 -cpu host,pcid=off,stibp=off
+
+Host B:
+
+$ qemu-system-x86_64 -cpu host,taa-no=off
+
+And you would be able to migrate between them.  It is responsability
+of the management application or of the user to make sure that the
+configuration is correct.  QEMU doesn't know how to look at this kind
+of features in general.
+
+Notice that we don't recomend to use -cpu host for migration.  It is
+used in this example because it makes the example simpler.
+
+Other devices have worse control about individual features.  If they
+want to be able to migrate between hosts that show different features,
+the device needs a way to configure which ones it is going to use.
+
+In this section we have considered that we are using the same QEMU
+binary in both sides of the migration.  If we use different QEMU
+versions process, then we need to have into account all other
+differences and the examples become even more complicated.
-- 
2.41.0



  parent reply	other threads:[~2023-10-24 13:15 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 13:12 [PULL 00/39] Migration 20231024 patches Juan Quintela
2023-10-24 13:12 ` [PULL 01/39] migration/doc: Add contents Juan Quintela
2023-10-24 13:12 ` [PULL 02/39] migration/doc: Add documentation for backwards compatiblity Juan Quintela
2023-10-24 13:12 ` Juan Quintela [this message]
2023-10-24 13:12 ` [PULL 04/39] migration/doc: We broke backwards compatibility Juan Quintela
2023-10-24 13:12 ` [PULL 05/39] migration: Receiving a zero page non zero is an error Juan Quintela
2023-10-24 13:12 ` [PULL 06/39] migration: Rename ram_handle_compressed() to ram_handle_zero() Juan Quintela
2023-10-24 13:12 ` [PULL 07/39] migration: Give one error if trying to set MULTIFD and XBZRLE Juan Quintela
2023-10-24 13:12 ` [PULL 08/39] migration: Give one error if trying to set COMPRESSION " Juan Quintela
2023-10-24 13:12 ` [PULL 09/39] migration: Remove save_page_use_compression() Juan Quintela
2023-10-24 13:12 ` [PULL 10/39] migration: Make compress_data_with_multithreads return bool Juan Quintela
2023-10-24 13:12 ` [PULL 11/39] migration: Simplify compress_page_with_multithread() Juan Quintela
2023-10-24 13:12 ` [PULL 12/39] migration: Move busy++ to migrate_with_multithread Juan Quintela
2023-10-24 13:12 ` [PULL 13/39] migration: Create compress_update_rates() Juan Quintela
2023-10-24 13:12 ` [PULL 14/39] migration: Export send_queued_data() Juan Quintela
2023-10-24 13:12 ` [PULL 15/39] migration: Move ram_flush_compressed_data() to ram-compress.c Juan Quintela
2023-10-24 13:12 ` [PULL 16/39] migration: Merge flush_compressed_data() and compress_flush_data() Juan Quintela
2023-10-24 13:12 ` [PULL 17/39] migration: Rename ram_compressed_pages() to compress_ram_pages() Juan Quintela
2023-10-24 13:12 ` [PULL 18/39] hw/ipmi: Don't call vmstate_register() from instance_init() functions Juan Quintela
2023-10-24 13:12 ` [PULL 19/39] hw/s390x/s390-skeys: Don't call register_savevm_live() during instance_init() Juan Quintela
2023-10-26 15:35   ` Thomas Huth
2023-10-24 13:12 ` [PULL 20/39] hw/s390x/s390-stattrib: Simplify handling of the "migration-enabled" property Juan Quintela
2023-10-26 15:37   ` Thomas Huth
2023-10-24 13:12 ` [PULL 21/39] hw/s390x/s390-stattrib: Don't call register_savevm_live() during instance_init() Juan Quintela
2023-10-24 13:12 ` [PULL 22/39] migration/ram: Fix compilation with -Wshadow=local Juan Quintela
2023-10-24 13:12 ` [PULL 23/39] migration: rename vmstate_save_needed->vmstate_section_needed Juan Quintela
2023-10-24 13:12 ` [PULL 24/39] migration: set file error on subsection loading Juan Quintela
2023-10-24 13:12 ` [PULL 25/39] migration: Create vmstate_register_any() Juan Quintela
2023-10-24 13:12 ` [PULL 26/39] migration: Use vmstate_register_any() Juan Quintela
2023-10-24 13:12 ` [PULL 27/39] migration: Use vmstate_register_any() for isa-ide Juan Quintela
2023-10-24 13:12 ` [PULL 28/39] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp Juan Quintela
2023-10-24 13:12 ` [PULL 29/39] migration: Hack to maintain backwards compatibility for ppc Juan Quintela
2023-10-24 13:12 ` [PULL 30/39] migration: Check in savevm_state_handler_insert for dups Juan Quintela
2023-10-24 13:12 ` [PULL 31/39] migration: Improve example and documentation of vmstate_register() Juan Quintela
2023-10-24 13:12 ` [PULL 32/39] migration: Use vmstate_register_any() for audio Juan Quintela
2023-10-24 13:12 ` [PULL 33/39] migration: Use vmstate_register_any() for eeprom93xx Juan Quintela
2023-10-24 13:13 ` [PULL 34/39] migration: Use vmstate_register_any() for vmware_vga Juan Quintela
2023-10-24 13:13 ` [PULL 35/39] qemu-iotests: Filter warnings about block migration being deprecated Juan Quintela
2023-10-24 13:13 ` [PULL 36/39] migration: migrate 'inc' command option is deprecated Juan Quintela
2023-10-24 13:13 ` [PULL 37/39] migration: migrate 'blk' " Juan Quintela
2023-10-24 13:13 ` [PULL 38/39] migration: Deprecate block migration Juan Quintela
2023-10-24 13:13 ` [PULL 39/39] migration: Deprecate old compression method Juan Quintela
2023-10-26  0:50 ` [PULL 00/39] Migration 20231024 patches Stefan Hajnoczi
2023-10-26 15:25   ` Juan Quintela
2023-10-27  0:41     ` Stefan Hajnoczi

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=20231024131305.87468-4-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=harshpb@linux.ibm.com \
    --cc=hreitz@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=lizhijian@fujitsu.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=minyard@acm.org \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=sw@weilnetz.de \
    --cc=thuth@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).