From nobody Thu Nov 6 06:39:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498193671731465.561207020109; Thu, 22 Jun 2017 21:54:31 -0700 (PDT) Received: from localhost ([::1]:33587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOGc2-0003Xt-Cf for importer@patchew.org; Fri, 23 Jun 2017 00:54:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOGVP-0006Dp-JF for qemu-devel@nongnu.org; Fri, 23 Jun 2017 00:47:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOGVO-0001Ne-BD for qemu-devel@nongnu.org; Fri, 23 Jun 2017 00:47:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50120) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dOGVO-0001N9-2Q for qemu-devel@nongnu.org; Fri, 23 Jun 2017 00:47:38 -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 03FCF3DEE4 for ; Fri, 23 Jun 2017 04:47:37 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-47.pek2.redhat.com [10.72.12.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AF2070536; Fri, 23 Jun 2017 04:47:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 03FCF3DEE4 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 03FCF3DEE4 From: Peter Xu To: qemu-devel@nongnu.org Date: Fri, 23 Jun 2017 12:46:45 +0800 Message-Id: <1498193206-18007-10-git-send-email-peterx@redhat.com> In-Reply-To: <1498193206-18007-1-git-send-email-peterx@redhat.com> References: <1498193206-18007-1-git-send-email-peterx@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.29]); Fri, 23 Jun 2017 04:47:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 09/10] migration: merge enforce_config_section somewhat 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , peterx@redhat.com, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These two parameters: - MachineState::enforce_config_section - MigrationState::send_configuration are playing similar role here. This patch merges the first one into second, then we'll have a single place to reference whether we need to send the configuration section. I didn't remove the MachineState.enforce_config_section field since when applying that machine property (in machine_set_property()) we haven't yet initialized global properties and migration object. Then, it's still not easy to pass that boolean to MigrationState at such an early time. A natural benefit for current patch is that now we kept the meaning of "enforce-config-section" since it'll still have the highest priority (that's what "enforce" mean I guess). Reviewed-by: Juan Quintela Signed-off-by: Peter Xu --- migration/migration.c | 12 ++++++++++++ migration/savevm.c | 12 ++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 96c6412..e7e6cf3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -42,6 +42,7 @@ #include "exec/target_page.h" #include "io/channel-buffer.h" #include "migration/colo.h" +#include "hw/boards.h" =20 #define MAX_THROTTLE (32 << 20) /* Migration transfer speed throttli= ng */ =20 @@ -102,9 +103,20 @@ static MigrationState *current_migration; =20 void migration_object_init(void) { + MachineState *ms =3D MACHINE(qdev_get_machine()); + /* This can only be called once. */ assert(!current_migration); current_migration =3D MIGRATION_OBJ(object_new(TYPE_MIGRATION)); + + /* + * We cannot really do this in migration_instance_init() since at + * that time global properties are not yet applied, then this + * value will be definitely replaced by something else. + */ + if (ms->enforce_config_section) { + current_migration->send_configuration =3D true; + } } =20 /* For outgoing */ diff --git a/migration/savevm.c b/migration/savevm.c index 28fa1d5..6b1a9a5 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -943,20 +943,13 @@ bool qemu_savevm_state_blocked(Error **errp) return false; } =20 -static bool enforce_config_section(void) -{ - MachineState *machine =3D MACHINE(qdev_get_machine()); - return machine->enforce_config_section; -} - void qemu_savevm_state_header(QEMUFile *f) { trace_savevm_state_header(); qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); =20 - if (migrate_get_current()->send_configuration || - enforce_config_section()) { + if (migrate_get_current()->send_configuration) { qemu_put_byte(f, QEMU_VM_CONFIGURATION); vmstate_save_state(f, &vmstate_configuration, &savevm_state, 0); } @@ -1980,8 +1973,7 @@ int qemu_loadvm_state(QEMUFile *f) return -ENOTSUP; } =20 - if (migrate_get_current()->send_configuration || - enforce_config_section()) { + if (migrate_get_current()->send_configuration) { if (qemu_get_byte(f) !=3D QEMU_VM_CONFIGURATION) { error_report("Configuration section missing"); return -EINVAL; --=20 2.7.4