Skip to contentSkip to conversation

Some minor fixes for migration states

PATCH Superseded Zhang Chen 3 participants 13 messages Dec 31, 2021 – Jan 27, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

cover Some minor fixes for migration states

This series solved some fixme and comments in code. Please see the details in each patch commit message.

Zhang Chen (3):
migration/migration.c: Add missed default error handler for migration
state
migration/migration.c: Avoid COLO boot in postcopy migration migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when
migration finished

 migration/migration.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/3 migration/migration.c: Add missed default error handler for migration state

In the migration_completion() no other status is expected, for example MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED, etc.

---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/migration.c +1 -1
index 0652165610..2afa77da03 100644
@@ -3205,7 +3205,7 @@ static void migration_completion(MigrationState *s)
         qemu_mutex_unlock_iothread();
 
         trace_migration_completion_postcopy_end_after_complete();
-    } else if (s->state == MIGRATION_STATUS_CANCELLING) {
+    } else {
         goto fail;
     }
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] migration/migration.c: Add missed default error handler for migration state

Quoted 4 lines · * Zhang Chen ([email protected]) wrote:

In the migration_completion() no other status is expected, for example MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED, etc.

I think you're right;

however, did you actually see this trigger in a different state?

Dave

Quoted 20 lines
---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/migration.c +1 -1
index 0652165610..2afa77da03 100644
@@ -3205,7 +3205,7 @@ static void migration_completion(MigrationState *s)
         qemu_mutex_unlock_iothread();
 
         trace_migration_completion_postcopy_end_after_complete();
-    } else if (s->state == MIGRATION_STATUS_CANCELLING) {
+    } else {
         goto fail;
     }
 
Signature · 1 line
2.25.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#3 lore raw

RE: [PATCH 1/3] migration/migration.c: Add missed default error handler for migration state

Quoted 15 lines

-----Original Message-----
From: Dr. David Alan Gilbert <[email protected]>
Sent: Thursday, January 20, 2022 1:52 AM
To: Zhang, Chen <[email protected]>
Cc: Juan Quintela <[email protected]>; qemu-dev <qemu- [email protected]>
Subject: Re: [PATCH 1/3] migration/migration.c: Add missed default error handler for migration state

Quoted 3 lines · * Zhang Chen ([email protected]) wrote:

In the migration_completion() no other status is expected, for example MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED, etc.

Quoted 7 lines
Quoted 1 line

I think you're right;

however, did you actually see this trigger in a different state?

No, I just read the code and found it.

Thanks
Chen

Quoted 25 lines

Dave

migration/migration.c static void migration_completion(MigrationState

Quoted 9 lines
---
 migration/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/migration.c index renamed from migration/migration.c +0 -0

0652165610..2afa77da03 100644

migration/migration.c +0 -0
@@ -3205,7 +3205,7 @@ static void migration_completion(MigrationState

*s)

Quoted 11 lines
migration/migration.c +1 -2
         qemu_mutex_unlock_iothread();
 
         trace_migration_completion_postcopy_end_after_complete();
-    } else if (s->state == MIGRATION_STATUS_CANCELLING) {
+    } else {
         goto fail;
     }
 
--

2.25.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

author
#5 lore raw

PATCH 2/3 migration/migration.c: Avoid COLO boot in postcopy migration

In reply to Zhang Chen

COLO dose not support postcopy migration and remove the Fixme.

---
 migration/migration.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
migration/migration.c +5 -5
index 2afa77da03..3fac9c67ca 100644
@@ -3230,7 +3230,11 @@ static void migration_completion(MigrationState *s)
         goto fail_invalidate;
     }
 
-    if (!migrate_colo_enabled()) {
+    if (migrate_colo_enabled() && s->state == MIGRATION_STATUS_ACTIVE) {
+        /* COLO dose not support postcopy */
+        migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+                          MIGRATION_STATUS_COLO);
+    } else {
         migrate_set_state(&s->state, current_active_state,
                           MIGRATION_STATUS_COMPLETED);
     }
@@ -3621,10 +3625,6 @@ static void migration_iteration_finish(MigrationState *s)
                          "COLO enabled", __func__);
         }
         migrate_start_colo_process(s);
-        /*
-         * Fixme: we will run VM in COLO no matter its old running state.
-         * After exited COLO, we will keep running.
-         */
          /* Fallthrough */
     case MIGRATION_STATUS_ACTIVE:
         /*
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH 2/3] migration/migration.c: Avoid COLO boot in postcopy migration

Quoted 1 line · * Zhang Chen ([email protected]) wrote:

COLO dose not support postcopy migration and remove the Fixme.

'does' not 'dose'

Quoted 10 lines
---
 migration/migration.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
migration/migration.c +0 -0
index 2afa77da03..3fac9c67ca 100644

migration/migration.c static void migration_completion(MigrationState *s) · line 3236

Quoted 8 lines
migration/migration.c +4 -1
@@ -3230,7 +3230,11 @@ static void migration_completion(MigrationState *s)
         goto fail_invalidate;
     }
 
-    if (!migrate_colo_enabled()) {
+    if (migrate_colo_enabled() && s->state == MIGRATION_STATUS_ACTIVE) {
+        /* COLO dose not support postcopy */
+        migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+                          MIGRATION_STATUS_COLO);

I'm a bit confused; where were we setting the source state to COLO before - I can't find it!

Dave

Quoted 18 lines
migration/migration.c +1 -4
+    } else {
         migrate_set_state(&s->state, current_active_state,
                           MIGRATION_STATUS_COMPLETED);
     }
@@ -3621,10 +3625,6 @@ static void migration_iteration_finish(MigrationState *s)
                          "COLO enabled", __func__);
         }
         migrate_start_colo_process(s);
-        /*
-         * Fixme: we will run VM in COLO no matter its old running state.
-         * After exited COLO, we will keep running.
-         */
          /* Fallthrough */
     case MIGRATION_STATUS_ACTIVE:
         /*
Signature · 1 line
2.25.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#7 lore raw

RE: [PATCH 2/3] migration/migration.c: Avoid COLO boot in postcopy migration

Quoted 11 lines

-----Original Message-----
From: Dr. David Alan Gilbert <[email protected]>
Sent: Thursday, January 20, 2022 3:41 AM
To: Zhang, Chen <[email protected]>
Cc: Juan Quintela <[email protected]>; qemu-dev <qemu- [email protected]>
Subject: Re: [PATCH 2/3] migration/migration.c: Avoid COLO boot in postcopy migration

Quoted 6 lines
Quoted 1 line · * Zhang Chen ([email protected]) wrote:

COLO dose not support postcopy migration and remove the Fixme.

'does' not 'dose'

Yes, typo.

Quoted 16 lines

migration/migration.c static void migration_completion(MigrationState

Quoted 10 lines
---
 migration/migration.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
migration/migration.c index renamed from migration/migration.c +0 -0

2afa77da03..3fac9c67ca 100644

migration/migration.c +0 -0
@@ -3230,7 +3230,11 @@ static void migration_completion(MigrationState

*s)

migration/migration.c static void migration_completion(MigrationState *s)

Quoted 5 lines
migration/migration.c +1 -1
         goto fail_invalidate;
     }
 
-    if (!migrate_colo_enabled()) {
+    if (migrate_colo_enabled() && s->state ==
Quoted 7 lines

MIGRATION_STATUS_ACTIVE) {

migration/migration.c static void migration_completion(MigrationState *s) · line 3236

Quoted 3 lines
migration/migration.c +3 -0
+        /* COLO dose not support postcopy */
+        migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+                          MIGRATION_STATUS_COLO);

I'm a bit confused; where were we setting the source state to COLO before - I can't find it!

Yes, please read this mail:
https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg03525.html

After that I found I missed something, so this patch disabled postcopy migration and try to fix it.

Thanks
Chen

Quoted 24 lines

Dave

migration/migration.c static void

Quoted 5 lines
migration/migration.c +1 -0
+    } else {
         migrate_set_state(&s->state, current_active_state,
                           MIGRATION_STATUS_COMPLETED);
     }
@@ -3621,10 +3625,6 @@ static void

migration_iteration_finish(MigrationState *s)

Quoted 11 lines
migration/migration.c +0 -5
                          "COLO enabled", __func__);
         }
         migrate_start_colo_process(s);
-        /*
-         * Fixme: we will run VM in COLO no matter its old running state.
-         * After exited COLO, we will keep running.
-         */
          /* Fallthrough */
     case MIGRATION_STATUS_ACTIVE:
         /*
--
Quoted 2 lines

2.25.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#9 lore raw

RE: [PATCH 2/3] migration/migration.c: Avoid COLO boot in postcopy migration

Quoted 11 lines

-----Original Message-----
From: Juan Quintela <[email protected]>
Sent: Thursday, January 27, 2022 3:30 AM
To: Zhang, Chen <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>; qemu-dev <qemu- [email protected]>
Subject: Re: [PATCH 2/3] migration/migration.c: Avoid COLO boot in postcopy migration

Quoted 8 lines
Quoted 3 lines · Zhang Chen

COLO dose not support postcopy migration and remove the Fixme.

fixed the typo.

OK, already updated V2 for this series.

Thanks
Chen

author
#10 lore raw

PATCH 3/3 migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when migration finished

In reply to Zhang Chen

The MIGRATION_STATUS_ACTIVE indicates that migration is running. Remove it to be handled by the default operation,
It should be part of the unknown ending states.

---
 migration/migration.c | 6 ------
 1 file changed, 6 deletions(-)
migration/migration.c +0 -6
index 3fac9c67ca..21e1498f46 100644
@@ -3625,12 +3625,6 @@ static void migration_iteration_finish(MigrationState *s)
                          "COLO enabled", __func__);
         }
         migrate_start_colo_process(s);
-         /* Fallthrough */
-    case MIGRATION_STATUS_ACTIVE:
-        /*
-         * We should really assert here, but since it's during
-         * migration, let's try to reduce the usage of assertions.
-         */
         s->vm_was_running = true;
         /* Fallthrough */
     case MIGRATION_STATUS_FAILED:
Signature · 1 line
2.25.1
Reviewed-by on v1 3/3
#11 lore raw

Re: [PATCH 3/3] migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when migration finished

Quoted 5 lines · Zhang Chen

The MIGRATION_STATUS_ACTIVE indicates that migration is running. Remove it to be handled by the default operation,
It should be part of the unknown ending states.

queued

#12 lore raw
In reply to Zhang Chen

Any comments? Ping...

Thanks
Chen

Quoted 23 lines

-----Original Message-----
From: Zhang, Chen <[email protected]>
Sent: Friday, December 31, 2021 2:00 PM
To: Dr. David Alan Gilbert <[email protected]>; Juan Quintela <[email protected]>; qemu-dev <[email protected]>
Cc: Zhang, Chen <[email protected]>
Subject: [PATCH 0/3] Some minor fixes for migration states

This series solved some fixme and comments in code. Please see the details in each patch commit message.

Zhang Chen (3):
migration/migration.c: Add missed default error handler for migration
state
migration/migration.c: Avoid COLO boot in postcopy migration migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when
migration finished

 migration/migration.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

--
2.25.1