[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 30/39] migration: Check in savevm_state_handler_insert for dups
From: |
Juan Quintela |
Subject: |
[PULL 30/39] migration: Check in savevm_state_handler_insert for dups |
Date: |
Tue, 24 Oct 2023 15:12:56 +0200 |
From: Peter Xu <peterx@redhat.com>
Before finally register one SaveStateEntry, we detect for duplicated
entries. This could be helpful to notify us asap instead of get
silent migration failures which could be hard to diagnose.
For example, this patch will generate a message like this (if without
previous fixes on x2apic) as long as we wants to boot a VM instance
with "-smp 200,maxcpus=288,sockets=2,cores=72,threads=2" and QEMU will
bail out even before VM starts:
savevm_state_handler_insert: Detected duplicate SaveStateEntry: id=apic,
instance_id=0x0
Suggested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231020090731.28701-10-quintela@redhat.com>
---
migration/savevm.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/migration/savevm.c b/migration/savevm.c
index 1d1639c4b6..11ece3a91a 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -237,6 +237,8 @@ static SaveState savevm_state = {
.global_section_id = 0,
};
+static SaveStateEntry *find_se(const char *idstr, uint32_t instance_id);
+
static bool should_validate_capability(int capability)
{
assert(capability >= 0 && capability < MIGRATION_CAPABILITY__MAX);
@@ -716,6 +718,18 @@ static void savevm_state_handler_insert(SaveStateEntry
*nse)
assert(priority <= MIG_PRI_MAX);
+ /*
+ * This should never happen otherwise migration will probably fail
+ * silently somewhere because we can be wrongly applying one
+ * object properties upon another one. Bail out ASAP.
+ */
+ if (find_se(nse->idstr, nse->instance_id)) {
+ error_report("%s: Detected duplicate SaveStateEntry: "
+ "id=%s, instance_id=0x%"PRIx32, __func__,
+ nse->idstr, nse->instance_id);
+ exit(EXIT_FAILURE);
+ }
+
for (i = priority - 1; i >= 0; i--) {
se = savevm_state.handler_pri_head[i];
if (se != NULL) {
--
2.41.0
- [PULL 25/39] migration: Create vmstate_register_any(), (continued)
- [PULL 25/39] migration: Create vmstate_register_any(), Juan Quintela, 2023/10/24
- [PULL 17/39] migration: Rename ram_compressed_pages() to compress_ram_pages(), Juan Quintela, 2023/10/24
- [PULL 24/39] migration: set file error on subsection loading, Juan Quintela, 2023/10/24
- [PULL 07/39] migration: Give one error if trying to set MULTIFD and XBZRLE, Juan Quintela, 2023/10/24
- [PULL 29/39] migration: Hack to maintain backwards compatibility for ppc, Juan Quintela, 2023/10/24
- [PULL 27/39] migration: Use vmstate_register_any() for isa-ide, Juan Quintela, 2023/10/24
- [PULL 31/39] migration: Improve example and documentation of vmstate_register(), Juan Quintela, 2023/10/24
- [PULL 35/39] qemu-iotests: Filter warnings about block migration being deprecated, Juan Quintela, 2023/10/24
- [PULL 28/39] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp, Juan Quintela, 2023/10/24
- [PULL 33/39] migration: Use vmstate_register_any() for eeprom93xx, Juan Quintela, 2023/10/24
- [PULL 30/39] migration: Check in savevm_state_handler_insert for dups,
Juan Quintela <=
- [PULL 36/39] migration: migrate 'inc' command option is deprecated., Juan Quintela, 2023/10/24
- [PULL 26/39] migration: Use vmstate_register_any(), Juan Quintela, 2023/10/24
- [PULL 37/39] migration: migrate 'blk' command option is deprecated., Juan Quintela, 2023/10/24
- [PULL 38/39] migration: Deprecate block migration, Juan Quintela, 2023/10/24
- [PULL 34/39] migration: Use vmstate_register_any() for vmware_vga, Juan Quintela, 2023/10/24
- [PULL 39/39] migration: Deprecate old compression method, Juan Quintela, 2023/10/24
- [PULL 32/39] migration: Use vmstate_register_any() for audio, Juan Quintela, 2023/10/24
- Re: [PULL 00/39] Migration 20231024 patches, Stefan Hajnoczi, 2023/10/25