[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 6/6] migration: stop tracking ram writes when cancelling backgroun
From: |
Juan Quintela |
Subject: |
[PULL 6/6] migration: stop tracking ram writes when cancelling background migration |
Date: |
Fri, 2 Jun 2023 01:44:26 +0200 |
From: Fiona Ebner <f.ebner@proxmox.com>
Currently, it is only done when the iteration finishes successfully.
Not cleaning up the userfaultfd write protection can lead to
symptoms/issues such as the process hanging in memmove or GDB not
being able to attach.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Message-Id: <20230526115908.196171-1-f.ebner@proxmox.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 7c3425c6fe..dc05c6f6ea 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2400,13 +2400,6 @@ static void bg_migration_completion(MigrationState *s)
{
int current_active_state = s->state;
- /*
- * Stop tracking RAM writes - un-protect memory, un-register UFFD
- * memory ranges, flush kernel wait queues and wake up threads
- * waiting for write fault to be resolved.
- */
- ram_write_tracking_stop();
-
if (s->state == MIGRATION_STATUS_ACTIVE) {
/*
* By this moment we have RAM content saved into the migration stream.
@@ -2788,6 +2781,13 @@ static void migration_iteration_finish(MigrationState *s)
static void bg_migration_iteration_finish(MigrationState *s)
{
+ /*
+ * Stop tracking RAM writes - un-protect memory, un-register UFFD
+ * memory ranges, flush kernel wait queues and wake up threads
+ * waiting for write fault to be resolved.
+ */
+ ram_write_tracking_stop();
+
qemu_mutex_lock_iothread();
switch (s->state) {
case MIGRATION_STATUS_COMPLETED:
--
2.40.1
- [PULL 0/6] Migration 20230601 patches, Juan Quintela, 2023/06/01
- [PULL 1/6] runstate: add runstate_get(), Juan Quintela, 2023/06/01
- [PULL 3/6] runstate: drop unused runstate_store(), Juan Quintela, 2023/06/01
- [PULL 4/6] migration: switch from .vm_was_running to .vm_old_state, Juan Quintela, 2023/06/01
- [PULL 5/6] migration: restore vmstate on migration failure, Juan Quintela, 2023/06/01
- [PULL 6/6] migration: stop tracking ram writes when cancelling background migration,
Juan Quintela <=
- [PULL 2/6] migration: never fail in global_state_store(), Juan Quintela, 2023/06/01
- Re: [PULL 0/6] Migration 20230601 patches, Richard Henderson, 2023/06/02