From nobody Fri May 17 06:43:17 2024 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 15541098460281004.0805021296276; Mon, 1 Apr 2019 02:10:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:33036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsxl-0006cf-V2 for importer@patchew.org; Mon, 01 Apr 2019 05:10:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsvi-0005MW-SY for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAsvh-0004Ea-Ol for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hAsvh-0004Dw-H0 for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 508413087BA4; 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 7756360852; Mon, 1 Apr 2019 09:08:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E76101132BB6; Mon, 1 Apr 2019 11:08:27 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 1 Apr 2019 11:08:23 +0200 Message-Id: <20190401090827.20793-2-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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); 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 1/5] Revert "vl: Fix to create migration object before block backends again" 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" This reverts commit e60483f2f8498ae08ae79ca4c6fb03a3317f5e1e. Recent commit cda4aa9a5a0 moved block backend creation before machine property evaluation. This broke block backends registering migration blockers. Commit e60483f2f84 fixed it by moving migration object creation before block backend creation. This broke migration with Xen. Turns out we need to configure the accelerator before we create the migration object so that Xen's accelerator compat properties get applied. Revert the flawed commit. This fixes the Xen regression, but brings back the block backend regression. The next commits will fix it again. Signed-off-by: Markus Armbruster Reviewed-by: Igor Mammedov --- vl.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/vl.c b/vl.c index d61d5604e5..c1d5484e12 100644 --- a/vl.c +++ b/vl.c @@ -4276,17 +4276,10 @@ int main(int argc, char **argv, char **envp) exit(0); } =20 - /* - * Migration object can only be created after global properties - * are applied correctly. - */ - migration_object_init(); - /* * Note: we need to create block backends before * machine_set_property(), so machine properties can refer to - * them, and after migration_object_init(), so we can create - * migration blockers. + * them. */ configure_blockdev(&bdo_queue, machine_class, snapshot); =20 @@ -4304,6 +4297,12 @@ int main(int argc, char **argv, char **envp) machine_class->name, machine_class->deprecation_reaso= n); } =20 + /* + * Migration object can only be created after global properties + * are applied correctly. + */ + migration_object_init(); + if (qtest_chrdev) { qtest_init(qtest_chrdev, qtest_log, &error_fatal); } --=20 2.17.2 From nobody Fri May 17 06:43:17 2024 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 1554109979863677.9628572390102; Mon, 1 Apr 2019 02:12:59 -0700 (PDT) Received: from localhost ([127.0.0.1]:33718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAszw-0000qB-MV for importer@patchew.org; Mon, 01 Apr 2019 05:12:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsvj-0005Mu-BQ for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAsvh-0004Ei-Pi for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43104) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hAsvh-0004Dz-EP 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 7B5A1307B49E; 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 7772660FAB; Mon, 1 Apr 2019 09:08:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id EB6411132BD3; Mon, 1 Apr 2019 11:08:27 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 1 Apr 2019 11:08:24 +0200 Message-Id: <20190401090827.20793-3-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.46]); 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 2/5] Revert "migration: move only_migratable to MigrationState" 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" This reverts commit 3df663e575f1876d7f3bc684f80e72fca0703d39. This reverts commit b605c47b57b58e61a901a50a0762dccf43d94783. Command line option --only-migratable is for disallowing any configuration that can block migration. Initially, --only-migratable set global variable @only_migratable. Commit 3df663e575 "migration: move only_migratable to MigrationState" replaced it by MigrationState member @only_migratable. That was a mistake. First, it doesn't make sense on the design level. MigrationState captures the state of an individual migration, but --only-migratable isn't a property of an individual migration, it's a restriction on QEMU configuration. With fault tolerance, we could have several migrations at once. --only-migratable would certainly protect all of them. Storing it in MigrationState feels inappropriate. Second, it contributes to a dependency cycle that manifests itself as a bug now. Putting @only_migratable into MigrationState means its available only after migration_object_init(). We can't set it before migration_object_init(), so we delay setting it with a global property (this is fixup commit b605c47b57 "migration: fix handling for --only-migratable"). We can't get it before migration_object_init(), so anything that uses it can only run afterwards. Since migrate_add_blocker() needs to obey --only-migratable, any code adding migration blockers can run only afterwards. 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. Moving @only_migratable into MigrationState was a mistake. Revert it. This doesn't quite break the "migration_object_init() before configure_blockdev() dependency, since migrate_add_blocker() still has another dependency on migration_object_init(). To be addressed the next commit Conflicts: include/migration/misc.h migration/migration.c migration/migration.h vl.c Signed-off-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Igor Mammedov --- include/sysemu/sysemu.h | 1 + migration/migration.c | 5 ++--- migration/migration.h | 3 --- migration/savevm.c | 2 +- vl.c | 9 ++------- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 6065d9e420..5f133cae83 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -14,6 +14,7 @@ /* vl.c */ =20 extern const char *bios_name; +extern int only_migratable; extern const char *qemu_name; extern QemuUUID qemu_uuid; extern bool qemu_uuid_set; diff --git a/migration/migration.c b/migration/migration.c index 69f75124c9..f6076e5295 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1707,7 +1707,7 @@ static GSList *migration_blockers; =20 int migrate_add_blocker(Error *reason, Error **errp) { - if (migrate_get_current()->only_migratable) { + if (only_migratable) { error_propagate_prepend(errp, error_copy(reason), "disallowing migration blocker " "(--only_migratable) for: "); @@ -3337,7 +3337,7 @@ void migration_global_dump(Monitor *mon) monitor_printf(mon, "store-global-state: %s\n", ms->store_global_state ? "on" : "off"); monitor_printf(mon, "only-migratable: %s\n", - ms->only_migratable ? "on" : "off"); + only_migratable ? "on" : "off"); monitor_printf(mon, "send-configuration: %s\n", ms->send_configuration ? "on" : "off"); monitor_printf(mon, "send-section-footer: %s\n", @@ -3352,7 +3352,6 @@ void migration_global_dump(Monitor *mon) static Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, store_global_state, true), - DEFINE_PROP_BOOL("only-migratable", MigrationState, only_migratable, f= alse), DEFINE_PROP_BOOL("send-configuration", MigrationState, send_configuration, true), DEFINE_PROP_BOOL("send-section-footer", MigrationState, diff --git a/migration/migration.h b/migration/migration.h index 0f986935e1..438f17edad 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -219,9 +219,6 @@ struct MigrationState */ bool store_global_state; =20 - /* Whether the VM is only allowing for migratable devices */ - bool only_migratable; - /* Whether we send QEMU_VM_CONFIGURATION during migration */ bool send_configuration; /* Whether we send section footer during migration */ diff --git a/migration/savevm.c b/migration/savevm.c index 1415001d1c..34bcad3807 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2844,7 +2844,7 @@ void vmstate_register_ram_global(MemoryRegion *mr) bool vmstate_check_only_migratable(const VMStateDescription *vmsd) { /* check needed if --only-migratable is specified */ - if (!migrate_get_current()->only_migratable) { + if (!only_migratable) { return true; } =20 diff --git a/vl.c b/vl.c index c1d5484e12..e4d7ad6b85 100644 --- a/vl.c +++ b/vl.c @@ -185,6 +185,7 @@ const char *prom_envs[MAX_PROM_ENVS]; int boot_menu; bool boot_strict; uint8_t *boot_splash_filedata; +int only_migratable; /* turn it off unless user states otherwise */ bool wakeup_suspend_enabled; =20 int icount_align_option; @@ -3799,13 +3800,7 @@ int main(int argc, char **argv, char **envp) incoming =3D optarg; break; case QEMU_OPTION_only_migratable: - /* - * TODO: we can remove this option one day, and we - * should all use: - * - * "-global migration.only-migratable=3Dtrue" - */ - qemu_global_option("migration.only-migratable=3Dtrue"); + only_migratable =3D 1; break; case QEMU_OPTION_nodefaults: has_defaults =3D 0; --=20 2.17.2 From nobody Fri May 17 06:43:17 2024 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 From nobody Fri May 17 06:43:17 2024 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 1554109844159213.30862455513113; Mon, 1 Apr 2019 02:10:44 -0700 (PDT) Received: from localhost ([127.0.0.1]:33050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsxn-0006dy-0Y for importer@patchew.org; Mon, 01 Apr 2019 05:10:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsvj-0005NI-FQ for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAsvi-0004F8-Gz for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9511) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hAsvi-0004Ee-9c for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9565BF961F; Mon, 1 Apr 2019 09:08:33 +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 80692272C9; Mon, 1 Apr 2019 09:08:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id F244B1132B74; Mon, 1 Apr 2019 11:08:27 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 1 Apr 2019 11:08:26 +0200 Message-Id: <20190401090827.20793-5-armbru@redhat.com> In-Reply-To: <20190401090827.20793-1-armbru@redhat.com> References: <20190401090827.20793-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 01 Apr 2019 09:08:33 +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 4/5] vl: Document dependencies hiding in global and compat props 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" Signed-off-by: Markus Armbruster Reviewed-by: Igor Mammedov --- vl.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index e4d7ad6b85..8c6d06b01d 100644 --- a/vl.c +++ b/vl.c @@ -4285,16 +4285,36 @@ int main(int argc, char **argv, char **envp) current_machine->maxram_size =3D maxram_size; current_machine->ram_slots =3D ram_slots; =20 + /* + * Note: uses machine properties such as kernel-irqchip, must run + * after machine_set_property(). + */ configure_accelerator(current_machine, argv[0]); =20 + /* + * Beware, QOM objects created before this point miss global and + * compat properties. + * + * Global properties get set up by qdev_prop_register_global(), + * called from user_register_global_props(), and certain option + * desugaring. Also in CPU feature desugaring (buried in + * parse_cpu_model()), which happens below this point, but may + * only target the CPU type, which can only be created after + * parse_cpu_model() returned the type. + * + * Machine compat properties: object_set_machine_compat_props(). + * Accelerator compat props: object_set_accelerator_compat_props(), + * called from configure_accelerator(). + */ + if (!qtest_enabled() && machine_class->deprecation_reason) { error_report("Machine type '%s' is deprecated: %s", machine_class->name, machine_class->deprecation_reaso= n); } =20 /* - * Migration object can only be created after global properties - * are applied correctly. + * Note: creates a QOM object, must run only after global and + * compat properties have been set up. */ migration_object_init(); =20 --=20 2.17.2 From nobody Fri May 17 06:43:17 2024 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 1554109869609177.52319452852862; Mon, 1 Apr 2019 02:11:09 -0700 (PDT) Received: from localhost ([127.0.0.1]:33182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsyC-000730-EQ for importer@patchew.org; Mon, 01 Apr 2019 05:11:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hAsvl-0005PQ-Rh for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hAsvk-0004H7-Vg for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35512) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hAsvk-0004Gi-OM for qemu-devel@nongnu.org; Mon, 01 Apr 2019 05:08:36 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0243030198A5; Mon, 1 Apr 2019 09:08:36 +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 9EF2B5D9D4; Mon, 1 Apr 2019 09:08:33 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 018A01132B38; Mon, 1 Apr 2019 11:08:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 1 Apr 2019 11:08:27 +0200 Message-Id: <20190401090827.20793-6-armbru@redhat.com> In-Reply-To: <20190401090827.20793-1-armbru@redhat.com> References: <20190401090827.20793-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 01 Apr 2019 09:08:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 5/5] accel: Unbreak accelerator fallback 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-Type: text/plain; charset="utf-8" When the user specifies a list of accelerators, we pick the first one that initializes successfully. Recent commit 1a3ec8c1564 broke that. Reproducer: $ qemu-system-x86_64 --machine accel=3Dxen:tcg xencall: error: Could not obtain handle on privileged command interface= : No such file or directory xen be core: xen be core: can't open xen interface can't open xen interface qemu-system-x86_64: failed to initialize Xen: Operation not permitted qemu-system-x86_64: /home/armbru/work/qemu/qom/object.c:436: object_set= _accelerator_compat_props: Assertion `!object_compat_props[0]' failed. Root cause: we register accelerator compat properties even when the accelerator fails. The failed assertion is object_set_accelerator_compat_props() telling us off. Fix by calling it only for the accelerator that succeeded. Fixes: 1a3ec8c1564f51628cce10d435a2e22559ea29fd Signed-off-by: Markus Armbruster Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/accel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/accel/accel.c b/accel/accel.c index 8deb475b5d..454fef9d92 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -65,8 +65,9 @@ static int accel_init_machine(AccelClass *acc, MachineSta= te *ms) ms->accelerator =3D NULL; *(acc->allowed) =3D false; object_unref(OBJECT(accel)); + } else { + object_set_accelerator_compat_props(acc->compat_props); } - object_set_accelerator_compat_props(acc->compat_props); return ret; } =20 --=20 2.17.2