qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: anthony.perard@citrix.com, peterx@redhat.com,
	quintela@redhat.com, dgilbert@redhat.com, kwolf@redhat.com,
	imammedo@redhat.com
Subject: [Qemu-devel] [PATCH v2 3/5] migration: Support adding migration blockers earlier
Date: Mon,  1 Apr 2019 11:08:25 +0200	[thread overview]
Message-ID: <20190401090827.20793-4-armbru@redhat.com> (raw)
In-Reply-To: <20190401090827.20793-1-armbru@redhat.com>

migrate_add_blocker() asserts we have a current_migration object, in
migrate_get_current().  We do only after migration_object_init().

This contributes to the following dependency cycle:

* configure_blockdev() must run before machine_set_property()
  so machine properties can refer to block backends

* machine_set_property() before configure_accelerator()
  so machine properties like kvm-irqchip get applied

* configure_accelerator() before migration_object_init()
  so that Xen's accelerator compat properties get applied.

* migration_object_init() before configure_blockdev()
  so configure_blockdev() can add migration blockers

The cycle was closed when recent commit cda4aa9a5a0 "Create block
backends before setting machine properties" added the first
dependency, and satisfied it by violating the last one.  Broke block
backends that add migration blockers, as demonstrated by qemu-iotests
055.

To fix it, break the last dependency: make migrate_add_blocker()
usable before migration_object_init().

The previous commit already removed the use of migrate_get_current()
from migrate_add_blocker() itself.  Didn't quite do the trick, as
there's another one hiding in migration_is_idle().

The use there isn't actually necessary: when no migration object has
been created yet, migration is surely idle.  Make migration_is_idle()
return true then.

Fixes: cda4aa9a5a08777cf13e164c0543bd4888b8adce
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 migration/migration.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/migration/migration.c b/migration/migration.c
index f6076e5295..609e0df5d0 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1646,7 +1646,11 @@ bool migration_in_postcopy_after_devices(MigrationState *s)
 
 bool migration_is_idle(void)
 {
-    MigrationState *s = migrate_get_current();
+    MigrationState *s = current_migration;
+
+    if (!s) {
+        return true;
+    }
 
     switch (s->state) {
     case MIGRATION_STATUS_NONE:
-- 
2.17.2

  parent reply	other threads:[~2019-04-01  9:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01  9:08 [Qemu-devel] [PATCH v2 0/5] Compat props bug fixes Markus Armbruster
2019-04-01  9:08 ` [Qemu-devel] [PATCH v2 1/5] Revert "vl: Fix to create migration object before block backends again" Markus Armbruster
2019-04-02 10:50   ` Igor Mammedov
2019-04-02 11:37     ` Markus Armbruster
2019-04-01  9:08 ` [Qemu-devel] [PATCH v2 2/5] Revert "migration: move only_migratable to MigrationState" Markus Armbruster
2019-04-01  9:27   ` Dr. David Alan Gilbert
2019-04-01  9:51     ` Daniel P. Berrangé
2019-04-01 11:31       ` Markus Armbruster
2019-04-01 11:43         ` Daniel P. Berrangé
2019-04-01 13:35           ` Dr. David Alan Gilbert
2019-04-02 10:52   ` Igor Mammedov
2019-04-02 11:49     ` Markus Armbruster
2019-04-02 12:03       ` Dr. David Alan Gilbert
2019-04-01  9:08 ` Markus Armbruster [this message]
2019-04-02 10:53   ` [Qemu-devel] [PATCH v2 3/5] migration: Support adding migration blockers earlier Igor Mammedov
2019-04-01  9:08 ` [Qemu-devel] [PATCH v2 4/5] vl: Document dependencies hiding in global and compat props Markus Armbruster
2019-04-02 10:53   ` Igor Mammedov
2019-04-02 12:14   ` Dr. David Alan Gilbert
2019-04-02 13:11     ` Markus Armbruster
2019-04-01  9:08 ` [Qemu-devel] [PATCH v2 5/5] accel: Unbreak accelerator fallback Markus Armbruster

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=20190401090827.20793-4-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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).