From nobody Thu Apr 25 08:44:02 2024 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 1495616262550834.7669258302292; Wed, 24 May 2017 01:57:42 -0700 (PDT) Received: from localhost ([::1]:53630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS6v-0000wE-3i for importer@patchew.org; Wed, 24 May 2017 04:57:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS4p-0007aX-Sd for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDS4m-00070S-0v for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42836) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDS4l-000702-Nf for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B80E61B91; Wed, 24 May 2017 08:55:26 +0000 (UTC) Received: from secure.mitica (ovpn-117-10.ams2.redhat.com [10.36.117.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9201176D3; Wed, 24 May 2017 08:55:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6B80E61B91 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6B80E61B91 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 24 May 2017 10:55:17 +0200 Message-Id: <20170524085519.22856-2-quintela@redhat.com> In-Reply-To: <20170524085519.22856-1-quintela@redhat.com> References: <20170524085519.22856-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 24 May 2017 08:55:26 +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 1/3] migration: Use savevm_handlers instead of loadvm copy 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com, Juan Quintela 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" From: Juan Quintela There is no reason for having the loadvm_handlers at all. There is only one use, and we can use the savevm handlers. We will remove the loadvm handlers on a following patch. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/savevm.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index d971e5e..55ac8c1 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1792,7 +1792,7 @@ struct LoadStateEntry { * Returns: true if the footer was good * false if there is a problem (and calls error_report to say why) */ -static bool check_section_footer(QEMUFile *f, LoadStateEntry *le) +static bool check_section_footer(QEMUFile *f, SaveStateEntry *se) { uint8_t read_mark; uint32_t read_section_id; @@ -1805,15 +1805,15 @@ static bool check_section_footer(QEMUFile *f, LoadS= tateEntry *le) read_mark =3D qemu_get_byte(f); =20 if (read_mark !=3D QEMU_VM_SECTION_FOOTER) { - error_report("Missing section footer for %s", le->se->idstr); + error_report("Missing section footer for %s", se->idstr); return false; } =20 read_section_id =3D qemu_get_be32(f); - if (read_section_id !=3D le->section_id) { + if (read_section_id !=3D se->section_id) { error_report("Mismatched section id in footer for %s -" " read 0x%x expected 0x%x", - le->se->idstr, read_section_id, le->section_id); + se->idstr, read_section_id, se->section_id); return false; } =20 @@ -1887,7 +1887,7 @@ qemu_loadvm_section_start_full(QEMUFile *f, Migration= IncomingState *mis) " device '%s'", instance_id, idstr); return ret; } - if (!check_section_footer(f, le)) { + if (!check_section_footer(f, se)) { return -EINVAL; } =20 @@ -1898,29 +1898,29 @@ static int qemu_loadvm_section_part_end(QEMUFile *f, MigrationIncomingState *mis) { uint32_t section_id; - LoadStateEntry *le; + SaveStateEntry *se; int ret; =20 section_id =3D qemu_get_be32(f); =20 trace_qemu_loadvm_state_section_partend(section_id); - QLIST_FOREACH(le, &mis->loadvm_handlers, entry) { - if (le->section_id =3D=3D section_id) { + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + if (se->section_id =3D=3D section_id) { break; } } - if (le =3D=3D NULL) { + if (se =3D=3D NULL) { error_report("Unknown savevm section %d", section_id); return -EINVAL; } =20 - ret =3D vmstate_load(f, le->se, le->version_id); + ret =3D vmstate_load(f, se, se->version_id); if (ret < 0) { error_report("error while loading state section id %d(%s)", - section_id, le->se->idstr); + section_id, se->idstr); return ret; } - if (!check_section_footer(f, le)) { + if (!check_section_footer(f, se)) { return -EINVAL; } =20 --=20 2.9.3 From nobody Thu Apr 25 08:44:02 2024 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 1495616316770948.4296029973816; Wed, 24 May 2017 01:58:36 -0700 (PDT) Received: from localhost ([::1]:53633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS7n-0001cP-C2 for importer@patchew.org; Wed, 24 May 2017 04:58:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS4o-0007a8-OL for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDS4n-00071I-LF for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDS4n-00070p-CZ for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44BD98046D; Wed, 24 May 2017 08:55:28 +0000 (UTC) Received: from secure.mitica (ovpn-117-10.ams2.redhat.com [10.36.117.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB40E17B95; Wed, 24 May 2017 08:55:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 44BD98046D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 44BD98046D From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 24 May 2017 10:55:18 +0200 Message-Id: <20170524085519.22856-3-quintela@redhat.com> In-Reply-To: <20170524085519.22856-1-quintela@redhat.com> References: <20170524085519.22856-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 24 May 2017 08:55:28 +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 2/3] migration: loadvm handlers are not used 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com, Juan Quintela 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" From: Juan Quintela So we remove all traces of them. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- include/migration/migration.h | 5 ----- include/migration/vmstate.h | 2 -- include/qemu/typedefs.h | 1 - migration/migration.c | 2 -- migration/savevm.c | 28 +--------------------------- 5 files changed, 1 insertion(+), 37 deletions(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index 0e807b6..d1a353a 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -50,8 +50,6 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; =20 -typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head; - /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -89,9 +87,6 @@ struct MigrationIncomingState { /* The coroutine we should enter (back) after failover */ Coroutine *migration_incoming_co; QemuSemaphore colo_incoming_sem; - - /* See savevm.c */ - LoadStateEntry_Head loadvm_handlers; }; =20 MigrationIncomingState *migration_incoming_get_current(void); diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index f97411d..6689562 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1020,8 +1020,6 @@ extern const VMStateInfo vmstate_info_qtailq; =20 #define SELF_ANNOUNCE_ROUNDS 5 =20 -void loadvm_free_handlers(MigrationIncomingState *mis); - int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, void *opaque, int version_id); void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 33a6aa1..51958bf 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -39,7 +39,6 @@ typedef struct I2SCodec I2SCodec; typedef struct ISABus ISABus; typedef struct ISADevice ISADevice; typedef struct IsaDma IsaDma; -typedef struct LoadStateEntry LoadStateEntry; typedef struct MACAddr MACAddr; typedef struct MachineClass MachineClass; typedef struct MachineState MachineState; diff --git a/migration/migration.c b/migration/migration.c index ad29e53..891a260 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -121,7 +121,6 @@ MigrationIncomingState *migration_incoming_get_current(= void) if (!once) { mis_current.state =3D MIGRATION_STATUS_NONE; memset(&mis_current, 0, sizeof(MigrationIncomingState)); - QLIST_INIT(&mis_current.loadvm_handlers); qemu_mutex_init(&mis_current.rp_mutex); qemu_event_init(&mis_current.main_thread_load_event, false); once =3D true; @@ -134,7 +133,6 @@ void migration_incoming_state_destroy(void) struct MigrationIncomingState *mis =3D migration_incoming_get_current(= ); =20 qemu_event_destroy(&mis->main_thread_load_event); - loadvm_free_handlers(mis); } =20 =20 diff --git a/migration/savevm.c b/migration/savevm.c index 55ac8c1..96b7173 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1779,13 +1779,6 @@ static int loadvm_process_command(QEMUFile *f) return 0; } =20 -struct LoadStateEntry { - QLIST_ENTRY(LoadStateEntry) entry; - SaveStateEntry *se; - int section_id; - int version_id; -}; - /* * Read a footer off the wire and check that it matches the expected secti= on * @@ -1821,22 +1814,11 @@ static bool check_section_footer(QEMUFile *f, SaveS= tateEntry *se) return true; } =20 -void loadvm_free_handlers(MigrationIncomingState *mis) -{ - LoadStateEntry *le, *new_le; - - QLIST_FOREACH_SAFE(le, &mis->loadvm_handlers, entry, new_le) { - QLIST_REMOVE(le, entry); - g_free(le); - } -} - static int qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis) { uint32_t instance_id, version_id, section_id; SaveStateEntry *se; - LoadStateEntry *le; char idstr[256]; int ret; =20 @@ -1873,15 +1855,7 @@ qemu_loadvm_section_start_full(QEMUFile *f, Migratio= nIncomingState *mis) return -EINVAL; } =20 - /* Add entry */ - le =3D g_malloc0(sizeof(*le)); - - le->se =3D se; - le->section_id =3D section_id; - le->version_id =3D version_id; - QLIST_INSERT_HEAD(&mis->loadvm_handlers, le, entry); - - ret =3D vmstate_load(f, le->se, le->version_id); + ret =3D vmstate_load(f, se, se->version_id); if (ret < 0) { error_report("error while loading state for instance 0x%x of" " device '%s'", instance_id, idstr); --=20 2.9.3 From nobody Thu Apr 25 08:44:02 2024 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 149561644430213.29506138048339; Wed, 24 May 2017 02:00:44 -0700 (PDT) Received: from localhost ([::1]:53648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS9r-0003Hh-0K for importer@patchew.org; Wed, 24 May 2017 05:00:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDS4q-0007ak-4O for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDS4p-000725-DV for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53474) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dDS4p-00071e-7A for qemu-devel@nongnu.org; Wed, 24 May 2017 04:55:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1EC324DB14; Wed, 24 May 2017 08:55:30 +0000 (UTC) Received: from secure.mitica (ovpn-117-10.ams2.redhat.com [10.36.117.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95420176D3; Wed, 24 May 2017 08:55:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1EC324DB14 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=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1EC324DB14 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 24 May 2017 10:55:19 +0200 Message-Id: <20170524085519.22856-4-quintela@redhat.com> In-Reply-To: <20170524085519.22856-1-quintela@redhat.com> References: <20170524085519.22856-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 24 May 2017 08:55:30 +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 3/3] migration: Remove section_id parameter from vmstate_load 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com, Juan Quintela 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" From: Juan Quintela Everything else assumes that we always load a device from its own savevm handler. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/savevm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 96b7173..e847a6b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -721,13 +721,13 @@ void vmstate_unregister(DeviceState *dev, const VMSta= teDescription *vmsd, } } =20 -static int vmstate_load(QEMUFile *f, SaveStateEntry *se, int version_id) +static int vmstate_load(QEMUFile *f, SaveStateEntry *se) { trace_vmstate_load(se->idstr, se->vmsd ? se->vmsd->name : "(old)"); if (!se->vmsd) { /* Old style */ - return se->ops->load_state(f, se->opaque, version_id); + return se->ops->load_state(f, se->opaque, se->version_id); } - return vmstate_load_state(f, se->vmsd, se->opaque, version_id); + return vmstate_load_state(f, se->vmsd, se->opaque, se->version_id); } =20 static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, QJSON = *vmdesc) @@ -1855,7 +1855,7 @@ qemu_loadvm_section_start_full(QEMUFile *f, Migration= IncomingState *mis) return -EINVAL; } =20 - ret =3D vmstate_load(f, se, se->version_id); + ret =3D vmstate_load(f, se); if (ret < 0) { error_report("error while loading state for instance 0x%x of" " device '%s'", instance_id, idstr); @@ -1888,7 +1888,7 @@ qemu_loadvm_section_part_end(QEMUFile *f, MigrationIn= comingState *mis) return -EINVAL; } =20 - ret =3D vmstate_load(f, se, se->version_id); + ret =3D vmstate_load(f, se); if (ret < 0) { error_report("error while loading state section id %d(%s)", section_id, se->idstr); --=20 2.9.3