From nobody Mon Feb 9 09:16:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554109979377988.8256297349873; Mon, 1 Apr 2019 02:12:59 -0700 (PDT) Received: from localhost ([127.0.0.1]:33715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAszw-0000pv-8s for importer@patchew.org; Mon, 01 Apr 2019 05:12:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsvi-0005Lv-Lw for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAsvh-0004EU-NM for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58222) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hAsvh-0004Dx-GL for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58292307E061; Mon, 1 Apr 2019 09:08:32 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-116.ams2.redhat.com [10.36.116.116]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B2D360260; Mon, 1 Apr 2019 09:08:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id EEDE31132B6C; Mon, 1 Apr 2019 11:08:27 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 1 Apr 2019 11:08:25 +0200 Message-Id: <20190401090827.20793-4-armbru@redhat.com> In-Reply-To: <20190401090827.20793-1-armbru@redhat.com> References: <20190401090827.20793-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 01 Apr 2019 09:08:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/5] migration: Support adding migration blockers earlier X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, quintela@redhat.com, dgilbert@redhat.com, peterx@redhat.com, anthony.perard@citrix.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Igor Mammedov --- 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(MigrationSt= ate *s) =20 bool migration_is_idle(void) { - MigrationState *s =3D migrate_get_current(); + MigrationState *s =3D current_migration; + + if (!s) { + return true; + } =20 switch (s->state) { case MIGRATION_STATUS_NONE: --=20 2.17.2