From nobody Thu May 2 13:00:35 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 1495019883511910.6855317794535; Wed, 17 May 2017 04:18:03 -0700 (PDT) Received: from localhost ([::1]:46951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwxt-0005BE-3U for importer@patchew.org; Wed, 17 May 2017 07:18:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwtx-00029t-LO for qemu-devel@nongnu.org; Wed, 17 May 2017 07:13:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAwtu-00024f-VU for qemu-devel@nongnu.org; Wed, 17 May 2017 07:13:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60430) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAwtu-000249-MU for qemu-devel@nongnu.org; Wed, 17 May 2017 07:13:54 -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 998E180C04 for ; Wed, 17 May 2017 11:13:53 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 306FA627DD; Wed, 17 May 2017 11:13:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 998E180C04 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 998E180C04 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 13:13:40 +0200 Message-Id: <20170517111346.21450-2-quintela@redhat.com> In-Reply-To: <20170517111346.21450-1-quintela@redhat.com> References: <20170517111346.21450-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.26]); Wed, 17 May 2017 11:13:53 +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] [PULL 1/7] migration: Fix regression with compression threads 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 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" Compression threads got broken on commit commit 247956946651ae0280f7b1ea88bb6237dd01c231 Author: Juan Quintela Date: Tue Mar 21 11:45:01 2017 +0100 ram: reorganize last_sent_block On do_compress_ram_page() we use a different QEMUFile than the migration one. We need to pass it there. The failure can be seen as: (qemu) qemu-system-x86_64: Unknown combination of migration flags: 0 qemu-system-x86_64: error while loading state section id 3(ram) qemu-system-x86_64: load of migration failed: Invalid argument Signed-off-by: Juan Quintela Reviewed-by: Peter Xu Tested-by: Peter Xu --- migration/ram.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 293d27c..995d1fc 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -436,20 +436,21 @@ void migrate_compress_threads_create(void) * @offset: offset inside the block for the page * in the lower bits, it contains flags */ -static size_t save_page_header(RAMState *rs, RAMBlock *block, ram_addr_t o= ffset) +static size_t save_page_header(RAMState *rs, QEMUFile *f, RAMBlock *block, + ram_addr_t offset) { size_t size, len; =20 if (block =3D=3D rs->last_sent_block) { offset |=3D RAM_SAVE_FLAG_CONTINUE; } - qemu_put_be64(rs->f, offset); + qemu_put_be64(f, offset); size =3D 8; =20 if (!(offset & RAM_SAVE_FLAG_CONTINUE)) { len =3D strlen(block->idstr); - qemu_put_byte(rs->f, len); - qemu_put_buffer(rs->f, (uint8_t *)block->idstr, len); + qemu_put_byte(f, len); + qemu_put_buffer(f, (uint8_t *)block->idstr, len); size +=3D 1 + len; rs->last_sent_block =3D block; } @@ -571,7 +572,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **cur= rent_data, } =20 /* Send XBZRLE based compressed page */ - bytes_xbzrle =3D save_page_header(rs, block, + bytes_xbzrle =3D save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_XBZRLE); qemu_put_byte(rs->f, ENCODING_FLAG_XBZRLE); qemu_put_be16(rs->f, encoded_len); @@ -745,7 +746,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *block= , ram_addr_t offset, if (is_zero_range(p, TARGET_PAGE_SIZE)) { rs->zero_pages++; rs->bytes_transferred +=3D - save_page_header(rs, block, offset | RAM_SAVE_FLAG_COMPRESS); + save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_COMP= RESS); qemu_put_byte(rs->f, 0); rs->bytes_transferred +=3D 1; pages =3D 1; @@ -834,7 +835,7 @@ static int ram_save_page(RAMState *rs, PageSearchStatus= *pss, bool last_stage) =20 /* XBZRLE overflow or normal page */ if (pages =3D=3D -1) { - rs->bytes_transferred +=3D save_page_header(rs, block, + rs->bytes_transferred +=3D save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_P= AGE); if (send_async) { qemu_put_buffer_async(rs->f, p, TARGET_PAGE_SIZE, @@ -860,7 +861,7 @@ static int do_compress_ram_page(QEMUFile *f, RAMBlock *= block, int bytes_sent, blen; uint8_t *p =3D block->host + (offset & TARGET_PAGE_MASK); =20 - bytes_sent =3D save_page_header(rs, block, offset | + bytes_sent =3D save_page_header(rs, f, block, offset | RAM_SAVE_FLAG_COMPRESS_PAGE); blen =3D qemu_put_compression_data(f, p, TARGET_PAGE_SIZE, migrate_compress_level()); @@ -991,7 +992,7 @@ static int ram_save_compressed_page(RAMState *rs, PageS= earchStatus *pss, pages =3D save_zero_page(rs, block, offset, p); if (pages =3D=3D -1) { /* Make sure the first page is sent out before other pages= */ - bytes_xmit =3D save_page_header(rs, block, offset | + bytes_xmit =3D save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_COMPRESS_PAGE); blen =3D qemu_put_compression_data(rs->f, p, TARGET_PAGE_S= IZE, migrate_compress_level()); --=20 2.9.3 From nobody Thu May 2 13:00:35 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 1495019939496215.95864301681013; Wed, 17 May 2017 04:18:59 -0700 (PDT) Received: from localhost ([::1]:46952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwyn-00060E-2F for importer@patchew.org; Wed, 17 May 2017 07:18:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwu9-0002Ki-Nb for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAwu8-0002D9-7J for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49048) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAwu7-0002Cm-UB for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:08 -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 DC948C049D57 for ; Wed, 17 May 2017 11:14:01 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5B301836B; Wed, 17 May 2017 11:13:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DC948C049D57 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DC948C049D57 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 13:13:41 +0200 Message-Id: <20170517111346.21450-3-quintela@redhat.com> In-Reply-To: <20170517111346.21450-1-quintela@redhat.com> References: <20170517111346.21450-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.31]); Wed, 17 May 2017 11:14:07 +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] [PULL 2/7] migration: Pass Error ** argument to {save, load}_vmstate 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 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" This way we use the "normal" way of printing errors for hmp commands. Signed-off-by: Juan Quintela Suggested-by: Paolo Bonzini Reviewed-by: Peter Xu Reviewed-by: Laurent Vivier --- hmp.c | 9 +++++++-- include/sysemu/sysemu.h | 4 ++-- migration/savevm.c | 51 ++++++++++++++++++++++++--------------------= ---- replay/replay-snapshot.c | 8 ++++++-- vl.c | 4 +++- 5 files changed, 43 insertions(+), 33 deletions(-) diff --git a/hmp.c b/hmp.c index 524e589..b9dd933 100644 --- a/hmp.c +++ b/hmp.c @@ -1274,17 +1274,22 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict) { int saved_vm_running =3D runstate_is_running(); const char *name =3D qdict_get_str(qdict, "name"); + Error *err =3D NULL; =20 vm_stop(RUN_STATE_RESTORE_VM); =20 - if (load_vmstate(name) =3D=3D 0 && saved_vm_running) { + if (load_vmstate(name, &err) =3D=3D 0 && saved_vm_running) { vm_start(); } + hmp_handle_error(mon, &err); } =20 void hmp_savevm(Monitor *mon, const QDict *qdict) { - save_vmstate(qdict_get_try_str(qdict, "name")); + Error *err =3D NULL; + + save_vmstate(qdict_get_try_str(qdict, "name"), &err); + hmp_handle_error(mon, &err); } =20 void hmp_delvm(Monitor *mon, const QDict *qdict) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index be9e22c..282f6bc 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -75,8 +75,8 @@ void qemu_remove_exit_notifier(Notifier *notify); void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); =20 -int save_vmstate(const char *name); -int load_vmstate(const char *name); +int save_vmstate(const char *name, Error **errp); +int load_vmstate(const char *name, Error **errp); =20 void qemu_announce_self(void); =20 diff --git a/migration/savevm.c b/migration/savevm.c index 7f66d58..b4f736f 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2069,7 +2069,7 @@ int qemu_loadvm_state(QEMUFile *f) return ret; } =20 -int save_vmstate(const char *name) +int save_vmstate(const char *name, Error **errp) { BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn =3D &sn1, old_sn1, *old_sn =3D &old_sn1; @@ -2079,29 +2079,27 @@ int save_vmstate(const char *name) uint64_t vm_state_size; qemu_timeval tv; struct tm tm; - Error *local_err =3D NULL; AioContext *aio_context; =20 if (!bdrv_all_can_snapshot(&bs)) { - error_report("Device '%s' is writable but does not support snapsho= ts", - bdrv_get_device_name(bs)); + error_setg(errp, "Device '%s' is writable but does not support " + "snapshots", bdrv_get_device_name(bs)); return ret; } =20 /* Delete old snapshots of the same name */ if (name) { - ret =3D bdrv_all_delete_snapshot(name, &bs1, &local_err); + ret =3D bdrv_all_delete_snapshot(name, &bs1, errp); if (ret < 0) { - error_reportf_err(local_err, - "Error while deleting snapshot on device '%s= ': ", - bdrv_get_device_name(bs1)); + error_prepend(errp, "Error while deleting snapshot on device " + "'%s': ", bdrv_get_device_name(bs1)); return ret; } } =20 bs =3D bdrv_all_find_vmstate_bs(); if (bs =3D=3D NULL) { - error_report("No block device can accept snapshots"); + error_setg(errp, "No block device can accept snapshots"); return ret; } aio_context =3D bdrv_get_aio_context(bs); @@ -2110,7 +2108,7 @@ int save_vmstate(const char *name) =20 ret =3D global_state_store(); if (ret) { - error_report("Error saving global state"); + error_setg(errp, "Error saving global state"); return ret; } vm_stop(RUN_STATE_SAVE_VM); @@ -2142,21 +2140,20 @@ int save_vmstate(const char *name) /* save the VM state */ f =3D qemu_fopen_bdrv(bs, 1); if (!f) { - error_report("Could not open VM state file"); + error_setg(errp, "Could not open VM state file"); goto the_end; } - ret =3D qemu_savevm_state(f, &local_err); + ret =3D qemu_savevm_state(f, errp); vm_state_size =3D qemu_ftell(f); qemu_fclose(f); if (ret < 0) { - error_report_err(local_err); goto the_end; } =20 ret =3D bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs); if (ret < 0) { - error_report("Error while creating snapshot on '%s'", - bdrv_get_device_name(bs)); + error_setg(errp, "Error while creating snapshot on '%s'", + bdrv_get_device_name(bs)); goto the_end; } =20 @@ -2229,7 +2226,7 @@ void qmp_xen_load_devices_state(const char *filename,= Error **errp) migration_incoming_state_destroy(); } =20 -int load_vmstate(const char *name) +int load_vmstate(const char *name, Error **errp) { BlockDriverState *bs, *bs_vm_state; QEMUSnapshotInfo sn; @@ -2239,20 +2236,22 @@ int load_vmstate(const char *name) MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 if (!bdrv_all_can_snapshot(&bs)) { - error_report("Device '%s' is writable but does not support snapsho= ts", - bdrv_get_device_name(bs)); + error_setg(errp, + "Device '%s' is writable but does not support snapshots= ", + bdrv_get_device_name(bs)); return -ENOTSUP; } ret =3D bdrv_all_find_snapshot(name, &bs); if (ret < 0) { - error_report("Device '%s' does not have the requested snapshot '%s= '", - bdrv_get_device_name(bs), name); + error_setg(errp, + "Device '%s' does not have the requested snapshot '%s'", + bdrv_get_device_name(bs), name); return ret; } =20 bs_vm_state =3D bdrv_all_find_vmstate_bs(); if (!bs_vm_state) { - error_report("No block device supports snapshots"); + error_setg(errp, "No block device supports snapshots"); return -ENOTSUP; } aio_context =3D bdrv_get_aio_context(bs_vm_state); @@ -2264,8 +2263,8 @@ int load_vmstate(const char *name) if (ret < 0) { return ret; } else if (sn.vm_state_size =3D=3D 0) { - error_report("This is a disk-only snapshot. Revert to it offline " - "using qemu-img."); + error_setg(errp, "This is a disk-only snapshot. Revert to it " + " offline using qemu-img"); return -EINVAL; } =20 @@ -2274,7 +2273,7 @@ int load_vmstate(const char *name) =20 ret =3D bdrv_all_goto_snapshot(name, &bs); if (ret < 0) { - error_report("Error %d while activating snapshot '%s' on '%s'", + error_setg(errp, "Error %d while activating snapshot '%s' on '%s'", ret, name, bdrv_get_device_name(bs)); return ret; } @@ -2282,7 +2281,7 @@ int load_vmstate(const char *name) /* restore the VM state */ f =3D qemu_fopen_bdrv(bs_vm_state, 0); if (!f) { - error_report("Could not open VM state file"); + error_setg(errp, "Could not open VM state file"); return -EINVAL; } =20 @@ -2296,7 +2295,7 @@ int load_vmstate(const char *name) =20 migration_incoming_state_destroy(); if (ret < 0) { - error_report("Error %d while loading VM state", ret); + error_setg(errp, "Error %d while loading VM state", ret); return ret; } =20 diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index 8cced46..c75cd38 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -62,14 +62,18 @@ void replay_vmstate_register(void) =20 void replay_vmstate_init(void) { + Error *err =3D NULL; + if (replay_snapshot) { if (replay_mode =3D=3D REPLAY_MODE_RECORD) { - if (save_vmstate(replay_snapshot) !=3D 0) { + if (save_vmstate(replay_snapshot, &err) !=3D 0) { + error_report_err(err); error_report("Could not create snapshot for icount record"= ); exit(1); } } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { - if (load_vmstate(replay_snapshot) !=3D 0) { + if (load_vmstate(replay_snapshot, &err) !=3D 0) { + error_report_err(err); error_report("Could not load snapshot for icount replay"); exit(1); } diff --git a/vl.c b/vl.c index 5c9b40e..1512df6 100644 --- a/vl.c +++ b/vl.c @@ -4701,7 +4701,9 @@ int main(int argc, char **argv, char **envp) if (replay_mode !=3D REPLAY_MODE_NONE) { replay_vmstate_init(); } else if (loadvm) { - if (load_vmstate(loadvm) < 0) { + Error *local_err =3D NULL; + if (load_vmstate(loadvm, &local_err) < 0) { + error_report_err(local_err); autostart =3D 0; } } --=20 2.9.3 From nobody Thu May 2 13:00:35 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 1495019870635345.3818104812409; Wed, 17 May 2017 04:17:50 -0700 (PDT) Received: from localhost ([::1]:46949 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwxh-0004w7-9M for importer@patchew.org; Wed, 17 May 2017 07:17:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwu0-0002Cp-ID for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAwtz-00027K-KN for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40016) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAwtz-00026o-CA for qemu-devel@nongnu.org; Wed, 17 May 2017 07:13:59 -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 6EF1C81227 for ; Wed, 17 May 2017 11:13:58 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 166B1627DD; Wed, 17 May 2017 11:13:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6EF1C81227 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6EF1C81227 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 13:13:42 +0200 Message-Id: <20170517111346.21450-4-quintela@redhat.com> In-Reply-To: <20170517111346.21450-1-quintela@redhat.com> References: <20170517111346.21450-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.25]); Wed, 17 May 2017 11:13:58 +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] [PULL 3/7] ram: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO 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 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" Reflects better what it does now, and avoid confussions with RAM_SAVE_FLAG_COMPRESS_PAGE. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 995d1fc..76c118c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -48,8 +48,14 @@ /***********************************************************/ /* ram save/restore */ =20 +/* RAM_SAVE_FLAG_ZERO used to be named RAM_SAVE_FLAG_COMPRESS, it + * worked for pages that where filled with the same char. We switched + * it to only search for the zero value. And to avoid confusion with + * RAM_SSAVE_FLAG_COMPRESS_PAGE just rename it. + */ + #define RAM_SAVE_FLAG_FULL 0x01 /* Obsolete, not used anymore */ -#define RAM_SAVE_FLAG_COMPRESS 0x02 +#define RAM_SAVE_FLAG_ZERO 0x02 #define RAM_SAVE_FLAG_MEM_SIZE 0x04 #define RAM_SAVE_FLAG_PAGE 0x08 #define RAM_SAVE_FLAG_EOS 0x10 @@ -746,7 +752,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *block= , ram_addr_t offset, if (is_zero_range(p, TARGET_PAGE_SIZE)) { rs->zero_pages++; rs->bytes_transferred +=3D - save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_COMP= RESS); + save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_ZERO= ); qemu_put_byte(rs->f, 0); rs->bytes_transferred +=3D 1; pages =3D 1; @@ -2406,7 +2412,7 @@ static int ram_load_postcopy(QEMUFile *f) =20 trace_ram_load_postcopy_loop((uint64_t)addr, flags); place_needed =3D false; - if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE)) { + if (flags & (RAM_SAVE_FLAG_ZERO | RAM_SAVE_FLAG_PAGE)) { block =3D ram_block_from_stream(f, flags); =20 host =3D host_from_ram_block_offset(block, addr); @@ -2453,7 +2459,7 @@ static int ram_load_postcopy(QEMUFile *f) last_host =3D host; =20 switch (flags & ~RAM_SAVE_FLAG_CONTINUE) { - case RAM_SAVE_FLAG_COMPRESS: + case RAM_SAVE_FLAG_ZERO: ch =3D qemu_get_byte(f); memset(page_buffer, ch, TARGET_PAGE_SIZE); if (ch) { @@ -2542,7 +2548,7 @@ static int ram_load(QEMUFile *f, void *opaque, int ve= rsion_id) flags =3D addr & ~TARGET_PAGE_MASK; addr &=3D TARGET_PAGE_MASK; =20 - if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE | + if (flags & (RAM_SAVE_FLAG_ZERO | RAM_SAVE_FLAG_PAGE | RAM_SAVE_FLAG_COMPRESS_PAGE | RAM_SAVE_FLAG_XBZRLE)) { RAMBlock *block =3D ram_block_from_stream(f, flags); =20 @@ -2604,7 +2610,7 @@ static int ram_load(QEMUFile *f, void *opaque, int ve= rsion_id) } break; =20 - case RAM_SAVE_FLAG_COMPRESS: + case RAM_SAVE_FLAG_ZERO: ch =3D qemu_get_byte(f); ram_handle_compressed(host, ch, TARGET_PAGE_SIZE); break; --=20 2.9.3 From nobody Thu May 2 13:00:35 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 149502002398996.69054791137887; Wed, 17 May 2017 04:20:23 -0700 (PDT) Received: from localhost ([::1]:46959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAx07-00074o-Km for importer@patchew.org; Wed, 17 May 2017 07:20:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwu6-0002IR-5s for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAwu2-0002Aq-Tu for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44734) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAwu2-0002AL-Ll for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:02 -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 A850A4621C for ; Wed, 17 May 2017 11:14:01 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id BECA317136; Wed, 17 May 2017 11:13:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A850A4621C 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 A850A4621C From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 13:13:43 +0200 Message-Id: <20170517111346.21450-5-quintela@redhat.com> In-Reply-To: <20170517111346.21450-1-quintela@redhat.com> References: <20170517111346.21450-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, 17 May 2017 11:14:01 +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] [PULL 4/7] migration: Create migration/blocker.h 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 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" This allows us to remove lots of includes of migration/migration.h Signed-off-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- block/qcow.c | 2 +- block/vdi.c | 2 +- block/vhdx.c | 2 +- block/vmdk.c | 2 +- block/vpc.c | 2 +- block/vvfat.c | 2 +- hw/9pfs/9p.c | 2 +- hw/display/qxl.c | 2 +- hw/display/virtio-gpu.c | 2 +- hw/intc/arm_gic_kvm.c | 2 +- hw/intc/arm_gicv3_its_kvm.c | 2 +- hw/intc/arm_gicv3_kvm.c | 2 +- hw/misc/ivshmem.c | 2 +- hw/scsi/vhost-scsi.c | 2 +- hw/virtio/vhost.c | 2 +- include/migration/blocker.h | 35 +++++++++++++++++++++++++++++++++++ include/migration/migration.h | 18 ------------------ migration/migration.c | 1 + stubs/migr-blocker.c | 2 +- target/i386/kvm.c | 2 +- 20 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 include/migration/blocker.h diff --git a/block/qcow.c b/block/qcow.c index 5d147b9..95ab123 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -32,7 +32,7 @@ #include #include "qapi/qmp/qerror.h" #include "crypto/cipher.h" -#include "migration/migration.h" +#include "migration/blocker.h" =20 /**************************************************************/ /* QEMU COW block driver with compression and encryption support */ diff --git a/block/vdi.c b/block/vdi.c index d12d9cd..79af477 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -55,7 +55,7 @@ #include "sysemu/block-backend.h" #include "qemu/module.h" #include "qemu/bswap.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "qemu/coroutine.h" #include "qemu/cutils.h" #include "qemu/uuid.h" diff --git a/block/vhdx.c b/block/vhdx.c index e8fe3fb..8b270b5 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -24,7 +24,7 @@ #include "qemu/crc32c.h" #include "qemu/bswap.h" #include "block/vhdx.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "qemu/uuid.h" =20 /* Options for VHDX creation */ diff --git a/block/vmdk.c b/block/vmdk.c index c61b9cc..55581b0 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -31,7 +31,7 @@ #include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/bswap.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "qemu/cutils.h" #include =20 diff --git a/block/vpc.c b/block/vpc.c index ecfee77..4240ba9 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -28,7 +28,7 @@ #include "block/block_int.h" #include "sysemu/block-backend.h" #include "qemu/module.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "qemu/bswap.h" #include "qemu/uuid.h" =20 diff --git a/block/vvfat.c b/block/vvfat.c index 9c82371..426ca70 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -28,7 +28,7 @@ #include "block/block_int.h" #include "qemu/module.h" #include "qemu/bswap.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qstring.h" diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index c80ba67..ab3e22f 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -23,7 +23,7 @@ #include "9p-xattr.h" #include "coth.h" #include "trace.h" -#include "migration/migration.h" +#include "migration/blocker.h" =20 int open_fd_hw; int total_open_fd; diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 4d94cec..ad09bb9 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -26,7 +26,7 @@ #include "qemu/queue.h" #include "qemu/atomic.h" #include "sysemu/sysemu.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "trace.h" =20 #include "qxl.h" diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index cfb5dfa..58dc0b2 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -19,7 +19,7 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-bus.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "qemu/log.h" #include "qapi/error.h" =20 diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c index ec952ec..af5cd36 100644 --- a/hw/intc/arm_gic_kvm.c +++ b/hw/intc/arm_gic_kvm.c @@ -24,7 +24,7 @@ #include "qemu-common.h" #include "cpu.h" #include "hw/sysbus.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "sysemu/kvm.h" #include "kvm_arm.h" #include "gic_internal.h" diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c index bd4f3aa..a0441d6 100644 --- a/hw/intc/arm_gicv3_its_kvm.c +++ b/hw/intc/arm_gicv3_its_kvm.c @@ -24,7 +24,7 @@ #include "sysemu/sysemu.h" #include "sysemu/kvm.h" #include "kvm_arm.h" -#include "migration/migration.h" +#include "migration/blocker.h" =20 #define TYPE_KVM_ARM_ITS "arm-its-kvm" #define KVM_ARM_ITS(obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_I= TS) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 19aab56..4ee2baa 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -28,7 +28,7 @@ #include "kvm_arm.h" #include "gicv3_internal.h" #include "vgic_common.h" -#include "migration/migration.h" +#include "migration/blocker.h" =20 #ifdef DEBUG_GICV3_KVM #define DPRINTF(fmt, ...) \ diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 82ce837..475e36a 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -25,7 +25,7 @@ #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "sysemu/kvm.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "qemu/error-report.h" #include "qemu/event_notifier.h" #include "qom/object_interfaces.h" diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 8f53ac3..cd4ab05 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -21,7 +21,7 @@ #include "qemu/error-report.h" #include "qemu/queue.h" #include "monitor/monitor.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "hw/virtio/vhost-scsi.h" #include "hw/virtio/vhost.h" #include "hw/virtio/virtio-scsi.h" diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 0001e60..03a46a7 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -25,7 +25,7 @@ #include "exec/address-spaces.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "sysemu/dma.h" =20 /* enabled until disconnected backend stabilizes */ diff --git a/include/migration/blocker.h b/include/migration/blocker.h new file mode 100644 index 0000000..acd2701 --- /dev/null +++ b/include/migration/blocker.h @@ -0,0 +1,35 @@ +/* + * QEMU migration blockers + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef MIGRATION_BLOCKER_H +#define MIGRATION_BLOCKER_H + +/** + * @migrate_add_blocker - prevent migration from proceeding + * + * @reason - an error to be returned whenever migration is attempted + * + * @errp - [out] The reason (if any) we cannot block migration right now. + * + * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. + */ +int migrate_add_blocker(Error *reason, Error **errp); + +/** + * @migrate_del_blocker - remove a blocking error from migration + * + * @reason - the error blocking migration + */ +void migrate_del_blocker(Error *reason); + +#endif diff --git a/include/migration/migration.h b/include/migration/migration.h index e29cb01..47262bd 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -275,24 +275,6 @@ int ram_discard_range(const char *block_name, uint64_t= start, size_t length); int ram_postcopy_incoming_init(MigrationIncomingState *mis); void ram_postcopy_migrated_memory_release(MigrationState *ms); =20 -/** - * @migrate_add_blocker - prevent migration from proceeding - * - * @reason - an error to be returned whenever migration is attempted - * - * @errp - [out] The reason (if any) we cannot block migration right now. - * - * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. - */ -int migrate_add_blocker(Error *reason, Error **errp); - -/** - * @migrate_del_blocker - remove a blocking error from migration - * - * @reason - the error blocking migration - */ -void migrate_del_blocker(Error *reason); - int check_migratable(Object *obj, Error **err); =20 bool migrate_release_ram(void); diff --git a/migration/migration.c b/migration/migration.c index a5ade23..5c92851 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -17,6 +17,7 @@ #include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" +#include "migration/blocker.h" #include "migration/migration.h" #include "migration/qemu-file.h" #include "sysemu/sysemu.h" diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c index a5ba18f..2b64ac9 100644 --- a/stubs/migr-blocker.c +++ b/stubs/migr-blocker.c @@ -1,6 +1,6 @@ #include "qemu/osdep.h" #include "qemu-common.h" -#include "migration/migration.h" +#include "migration/blocker.h" =20 int migrate_add_blocker(Error *reason, Error **errp) { diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 55865db..011d4a5 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -43,7 +43,7 @@ #include "standard-headers/asm-x86/hyperv.h" #include "hw/pci/pci.h" #include "hw/pci/msi.h" -#include "migration/migration.h" +#include "migration/blocker.h" #include "exec/memattrs.h" #include "trace.h" =20 --=20 2.9.3 From nobody Thu May 2 13:00:35 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 1495020016350792.4424568317528; Wed, 17 May 2017 04:20:16 -0700 (PDT) Received: from localhost ([::1]:46958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAx02-00070w-Lk for importer@patchew.org; Wed, 17 May 2017 07:20:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwu7-0002JV-EF for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAwu6-0002CP-Db for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36658) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAwu6-0002Bv-7X for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:06 -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 365C180F6B for ; Wed, 17 May 2017 11:14:05 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0713317136; Wed, 17 May 2017 11:14:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 365C180F6B Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 365C180F6B From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 13:13:44 +0200 Message-Id: <20170517111346.21450-6-quintela@redhat.com> In-Reply-To: <20170517111346.21450-1-quintela@redhat.com> References: <20170517111346.21450-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.27]); Wed, 17 May 2017 11:14:05 +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] [PULL 5/7] migration: Move page_cache.c to migration/ 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 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" It is only used by migration, so move it there. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Makefile.objs | 1 - migration/Makefile.objs | 2 +- page_cache.c =3D> migration/page_cache.c | 0 {include/migration =3D> migration}/page_cache.h | 0 tests/Makefile.include | 2 +- 5 files changed, 2 insertions(+), 3 deletions(-) rename page_cache.c =3D> migration/page_cache.c (100%) rename {include/migration =3D> migration}/page_cache.h (100%) diff --git a/Makefile.objs b/Makefile.objs index 6167e7b..2100845 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -49,7 +49,6 @@ common-obj-$(CONFIG_POSIX) +=3D os-posix.o common-obj-$(CONFIG_LINUX) +=3D fsdev/ =20 common-obj-y +=3D migration/ -common-obj-y +=3D page_cache.o #aio.o =20 common-obj-$(CONFIG_SPICE) +=3D spice-qemu-char.o =20 diff --git a/migration/Makefile.objs b/migration/Makefile.objs index 480dd49..c1920b6 100644 --- a/migration/Makefile.objs +++ b/migration/Makefile.objs @@ -1,7 +1,7 @@ common-obj-y +=3D migration.o socket.o fd.o exec.o common-obj-y +=3D tls.o common-obj-y +=3D colo-comm.o colo.o colo-failover.o -common-obj-y +=3D vmstate.o +common-obj-y +=3D vmstate.o page_cache.o common-obj-y +=3D qemu-file.o common-obj-y +=3D qemu-file-channel.o common-obj-y +=3D xbzrle.o postcopy-ram.o diff --git a/page_cache.c b/migration/page_cache.c similarity index 100% rename from page_cache.c rename to migration/page_cache.c diff --git a/include/migration/page_cache.h b/migration/page_cache.h similarity index 100% rename from include/migration/page_cache.h rename to migration/page_cache.h diff --git a/tests/Makefile.include b/tests/Makefile.include index 16ff8f3..4277597 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -554,7 +554,7 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool= .o $(test-block-obj-y) tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y) tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o -tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o page_ca= che.o $(test-util-obj-y) +tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migrati= on/page_cache.o $(test-util-obj-y) tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o tests/test-int128$(EXESUF): tests/test-int128.o tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y) --=20 2.9.3 From nobody Thu May 2 13:00:35 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 1495020130994134.22591692484923; Wed, 17 May 2017 04:22:10 -0700 (PDT) Received: from localhost ([::1]:46971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAx1s-0008LB-Ic for importer@patchew.org; Wed, 17 May 2017 07:22:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwuG-0002QH-De for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAwuF-0002Ii-3k for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54502) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAwuE-0002Hu-R3 for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:15 -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 BEC76CED7 for ; Wed, 17 May 2017 11:14:08 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28C7318366; Wed, 17 May 2017 11:14:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BEC76CED7 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BEC76CED7 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 13:13:45 +0200 Message-Id: <20170517111346.21450-7-quintela@redhat.com> In-Reply-To: <20170517111346.21450-1-quintela@redhat.com> References: <20170517111346.21450-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.30]); Wed, 17 May 2017 11:14:13 +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] [PULL 6/7] migration: Move postcopy stuff to postcopy-ram.c 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 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" Yes, we don't have a good place to put that stuff. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- include/migration/migration.h | 26 -------------------------- migration/migration.c | 18 ------------------ migration/postcopy-ram.c | 18 ++++++++++++++++++ migration/postcopy-ram.h | 26 ++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index 47262bd..97e78ba 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -61,28 +61,6 @@ enum mig_rp_message_type { =20 typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head; =20 -/* The current postcopy state is read/set by postcopy_state_get/set - * which update it atomically. - * The state is updated as postcopy messages are received, and - * in general only one thread should be writing to the state at any one - * time, initially the main thread and then the listen thread; - * Corner cases are where either thread finishes early and/or errors. - * The state is checked as messages are received to ensure that - * the source is sending us messages in the correct order. - * The state is also used by the RAM reception code to know if it - * has to place pages atomically, and the cleanup code at the end of - * the main thread to know if it has to delay cleanup until the end - * of postcopy. - */ -typedef enum { - POSTCOPY_INCOMING_NONE =3D 0, /* Initial state - no postcopy */ - POSTCOPY_INCOMING_ADVISE, - POSTCOPY_INCOMING_DISCARD, - POSTCOPY_INCOMING_LISTENING, - POSTCOPY_INCOMING_RUNNING, - POSTCOPY_INCOMING_END -} PostcopyState; - /* State for the incoming migration */ struct MigrationIncomingState { QEMUFile *from_src_file; @@ -339,8 +317,4 @@ void global_state_store_running(void); void migration_page_queue_free(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t = len); uint64_t ram_pagesize_summary(void); - -PostcopyState postcopy_state_get(void); -/* Set the state and return the old state */ -PostcopyState postcopy_state_set(PostcopyState new_state); #endif diff --git a/migration/migration.c b/migration/migration.c index 5c92851..ed11c1f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -78,13 +78,6 @@ static NotifierList migration_state_notifiers =3D =20 static bool deferred_incoming; =20 -/* - * Current state of incoming postcopy; note this is not part of - * MigrationIncomingState since it's state is used during cleanup - * at the end as MIS is being freed. - */ -static PostcopyState incoming_postcopy_state; - /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -2098,14 +2091,3 @@ void migrate_fd_connect(MigrationState *s) s->migration_thread_running =3D true; } =20 -PostcopyState postcopy_state_get(void) -{ - return atomic_mb_read(&incoming_postcopy_state); -} - -/* Set the state and return the old state */ -PostcopyState postcopy_state_set(PostcopyState new_state) -{ - return atomic_xchg(&incoming_postcopy_state, new_state); -} - diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index cdadaf6..a0489f6 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -784,3 +784,21 @@ void postcopy_discard_send_finish(MigrationState *ms, = PostcopyDiscardState *pds) =20 g_free(pds); } + +/* + * Current state of incoming postcopy; note this is not part of + * MigrationIncomingState since it's state is used during cleanup + * at the end as MIS is being freed. + */ +static PostcopyState incoming_postcopy_state; + +PostcopyState postcopy_state_get(void) +{ + return atomic_mb_read(&incoming_postcopy_state); +} + +/* Set the state and return the old state */ +PostcopyState postcopy_state_set(PostcopyState new_state) +{ + return atomic_xchg(&incoming_postcopy_state, new_state); +} diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 4c25f03..52d51e8 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -81,6 +81,28 @@ int postcopy_place_page(MigrationIncomingState *mis, voi= d *host, void *from, int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, size_t pagesize); =20 +/* The current postcopy state is read/set by postcopy_state_get/set + * which update it atomically. + * The state is updated as postcopy messages are received, and + * in general only one thread should be writing to the state at any one + * time, initially the main thread and then the listen thread; + * Corner cases are where either thread finishes early and/or errors. + * The state is checked as messages are received to ensure that + * the source is sending us messages in the correct order. + * The state is also used by the RAM reception code to know if it + * has to place pages atomically, and the cleanup code at the end of + * the main thread to know if it has to delay cleanup until the end + * of postcopy. + */ +typedef enum { + POSTCOPY_INCOMING_NONE =3D 0, /* Initial state - no postcopy */ + POSTCOPY_INCOMING_ADVISE, + POSTCOPY_INCOMING_DISCARD, + POSTCOPY_INCOMING_LISTENING, + POSTCOPY_INCOMING_RUNNING, + POSTCOPY_INCOMING_END +} PostcopyState; + /* * Allocate a page of memory that can be mapped at a later point in time * using postcopy_place_page @@ -88,4 +110,8 @@ int postcopy_place_page_zero(MigrationIncomingState *mis= , void *host, */ void *postcopy_get_tmp_page(MigrationIncomingState *mis); =20 +PostcopyState postcopy_state_get(void); +/* Set the state and return the old state */ +PostcopyState postcopy_state_set(PostcopyState new_state); + #endif --=20 2.9.3 From nobody Thu May 2 13:00:35 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 1495020063896741.5619305990872; Wed, 17 May 2017 04:21:03 -0700 (PDT) Received: from localhost ([::1]:46966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAx0n-0007hs-E0 for importer@patchew.org; Wed, 17 May 2017 07:21:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAwuC-0002Mx-S6 for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAwuB-0002FB-J0 for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dAwuB-0002Ei-9i for qemu-devel@nongnu.org; Wed, 17 May 2017 07:14:11 -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 5268FC0B39C4 for ; Wed, 17 May 2017 11:14:10 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6319627DD; Wed, 17 May 2017 11:14:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5268FC0B39C4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5268FC0B39C4 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 13:13:46 +0200 Message-Id: <20170517111346.21450-8-quintela@redhat.com> In-Reply-To: <20170517111346.21450-1-quintela@redhat.com> References: <20170517111346.21450-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.32]); Wed, 17 May 2017 11:14:10 +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] [PULL 7/7] migration: Move check_migratable() into qdev.c 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 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" The function is only used once, and nothing else in migration knows about objects. Create the function vmstate_device_is_migratable() in savem.c that really do the bit that is related with migration. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- hw/core/qdev.c | 20 ++++++++++++++++---- include/migration/migration.h | 6 ------ include/migration/vmstate.h | 2 ++ include/sysemu/sysemu.h | 2 +- migration/migration.c | 15 --------------- migration/savevm.c | 10 ++++++++++ stubs/vmstate.c | 5 ++--- 7 files changed, 31 insertions(+), 29 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 02b632f..6f1b070 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -37,7 +37,7 @@ #include "hw/boards.h" #include "hw/sysbus.h" #include "qapi-event.h" -#include "migration/migration.h" +#include "migration/vmstate.h" =20 bool qdev_hotplug =3D false; static bool qdev_hot_added =3D false; @@ -861,6 +861,20 @@ static bool device_get_realized(Object *obj, Error **e= rrp) return dev->realized; } =20 +static bool check_only_migratable(Object *obj, Error **err) +{ + DeviceClass *dc =3D DEVICE_GET_CLASS(obj); + + if (!vmstate_check_only_migratable(dc->vmsd)) { + error_setg(err, "Device %s is not migratable, but " + "--only-migratable was specified", + object_get_typename(obj)); + return false; + } + + return true; +} + static void device_set_realized(Object *obj, bool value, Error **errp) { DeviceState *dev =3D DEVICE(obj); @@ -870,7 +884,6 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) Error *local_err =3D NULL; bool unattached_parent =3D false; static int unattached_count; - int ret; =20 if (dev->hotplugged && !dc->hotpluggable) { error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj)); @@ -878,8 +891,7 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) } =20 if (value && !dev->realized) { - ret =3D check_migratable(obj, &local_err); - if (ret < 0) { + if (!check_only_migratable(obj, &local_err)) { goto fail; } =20 diff --git a/include/migration/migration.h b/include/migration/migration.h index 97e78ba..49ec501 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -22,7 +22,6 @@ #include "qapi-types.h" #include "exec/cpu-common.h" #include "qemu/coroutine_int.h" -#include "qom/object.h" =20 #define QEMU_VM_FILE_MAGIC 0x5145564d #define QEMU_VM_FILE_VERSION_COMPAT 0x00000002 @@ -39,9 +38,6 @@ #define QEMU_VM_COMMAND 0x08 #define QEMU_VM_SECTION_FOOTER 0x7e =20 -/* for vl.c */ -extern int only_migratable; - struct MigrationParams { bool blk; bool shared; @@ -253,8 +249,6 @@ int ram_discard_range(const char *block_name, uint64_t = start, size_t length); int ram_postcopy_incoming_init(MigrationIncomingState *mis); void ram_postcopy_migrated_memory_release(MigrationState *ms); =20 -int check_migratable(Object *obj, Error **err); - bool migrate_release_ram(void); bool migrate_postcopy_ram(void); bool migrate_zero_blocks(void); diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index f4bf3f1..8489659 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1067,4 +1067,6 @@ int64_t self_announce_delay(int round) =20 void dump_vmstate_json_to_file(FILE *out_fp); =20 +bool vmstate_check_only_migratable(const VMStateDescription *vmsd); + #endif diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 282f6bc..83c1ceb 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -15,7 +15,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 ed11c1f..0304c01 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1143,21 +1143,6 @@ void migrate_del_blocker(Error *reason) migration_blockers =3D g_slist_remove(migration_blockers, reason); } =20 -int check_migratable(Object *obj, Error **err) -{ - DeviceClass *dc =3D DEVICE_GET_CLASS(obj); - if (only_migratable && dc->vmsd) { - if (dc->vmsd->unmigratable) { - error_setg(err, "Device %s is not migratable, but " - "--only-migratable was specified", - object_get_typename(obj)); - return -1; - } - } - - return 0; -} - void qmp_migrate_incoming(const char *uri, Error **errp) { Error *local_err =3D NULL; diff --git a/migration/savevm.c b/migration/savevm.c index b4f736f..f5e8194 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2317,3 +2317,13 @@ void vmstate_register_ram_global(MemoryRegion *mr) { vmstate_register_ram(mr, NULL); } + +bool vmstate_check_only_migratable(const VMStateDescription *vmsd) +{ + /* check needed if --only-migratable is specified */ + if (!only_migratable) { + return true; + } + + return !(vmsd && vmsd->unmigratable); +} diff --git a/stubs/vmstate.c b/stubs/vmstate.c index 6d52f29..6399474 100644 --- a/stubs/vmstate.c +++ b/stubs/vmstate.c @@ -1,7 +1,6 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "migration/vmstate.h" -#include "migration/migration.h" =20 const VMStateDescription vmstate_dummy =3D {}; =20 @@ -21,7 +20,7 @@ void vmstate_unregister(DeviceState *dev, { } =20 -int check_migratable(Object *obj, Error **err) +bool vmstate_check_only_migratable(const VMStateDescription *vmsd) { - return 0; + return true; } --=20 2.9.3