Skip to contentSkip to conversation

migration: Check current_migration in migration_is_running()

PATCH In review Peter Xu 4 participants 6 messages Nov 5, 2024 – Nov 6, 2024

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 migration: Check current_migration in migration_is_running()

Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/[email protected]

When replacing migration_is_idle() with "!migration_is_running()", it was overlooked that the idle helper also checks for current_migration being available first.

The check would be there if the whole series was applied, but since the last patches in the previous series rely on some other patches to land first, we need to recover the behavior of migration_is_idle() first before that whole set will be merged.

I left migration_is_active / migration_is_device alone, as I don't think it's possible for them to hit his case (current_migration not initialized). Also they're prone to removal soon from VFIO side.

Cc Fabiano Rosas <[email protected]>
Cc Peter Maydell <[email protected]>
Fixes 34a8892dec ("migration: Drop migration_is_idle()")
---
 migration/migration.c | 4 ++++
 1 file changed, 4 insertions(+)
migration/migration.c +4 -0
index aedf7f0751..8c5bd0a75c 100644
@@ -1117,6 +1117,10 @@ bool migration_is_running(void)
 {
     MigrationState *s = current_migration;
 
+    if (!s) {
+        return false;
+    }
+
     switch (s->state) {
     case MIGRATION_STATUS_ACTIVE:
     case MIGRATION_STATUS_POSTCOPY_ACTIVE:
Signature · 1 line
2.45.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Peter Xu

Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/[email protected]

When replacing migration_is_idle() with "!migration_is_running()", it was overlooked that the idle helper also checks for current_migration being available first.

The check would be there if the whole series was applied, but since the last patches in the previous series rely on some other patches to land first, we need to recover the behavior of migration_is_idle() first before that whole set will be merged.

I left migration_is_active / migration_is_device alone, as I don't think it's possible for them to hit his case (current_migration not initialized). Also they're prone to removal soon from VFIO side.

Cc Fabiano Rosas <[email protected]>
Cc Peter Maydell <[email protected]>
Fixes 34a8892dec ("migration: Drop migration_is_idle()")
---
  migration/migration.c | 4 ++++
  1 file changed, 4 insertions(+)
migration/migration.c +0 -0
index aedf7f0751..8c5bd0a75c 100644

migration/migration.c bool migration_is_running(void) · line 1126

Quoted 10 lines
migration/migration.c +4 -0
@@ -1117,6 +1117,10 @@ bool migration_is_running(void)
  {
      MigrationState *s = current_migration;
 
+    if (!s) {
+        return false;
+    }
+
      switch (s->state) {
      case MIGRATION_STATUS_ACTIVE:
      case MIGRATION_STATUS_POSTCOPY_ACTIVE:
Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Xu
Quoted 17 lines · Peter Xu

Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/[email protected]

When replacing migration_is_idle() with "!migration_is_running()", it was overlooked that the idle helper also checks for current_migration being available first.

The check would be there if the whole series was applied, but since the last patches in the previous series rely on some other patches to land first, we need to recover the behavior of migration_is_idle() first before that whole set will be merged.

I left migration_is_active / migration_is_device alone, as I don't think it's possible for them to hit his case (current_migration not initialized). Also they're prone to removal soon from VFIO side.

Quoted 6 lines
Cc Fabiano Rosas <[email protected]>
Cc Peter Maydell <[email protected]>
Fixes 34a8892dec ("migration: Drop migration_is_idle()")
#4 lore raw
Quoted 12 lines · Thomas Huth
Quoted 3 lines · Peter Xu

Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/[email protected]

FWIW, this patch also fixes a lot of other broken iotests (vmdk and vpc) that occur when running "make check SPEED=thorough".

Good news!

I'm a bit confused by your message. I thought SPEED=slow was the most complete test setup, but is it SPEED=thorough instead?

#5 lore raw
Quoted 9 lines · Pierrick Bouvier
Quoted 8 lines · Thomas Huth
Quoted 3 lines · Peter Xu

Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/[email protected]

FWIW, this patch also fixes a lot of other broken iotests (vmdk and vpc) that occur when running "make check SPEED=thorough".

Quoted 8 lines
Quoted 4 lines

Good news!

I'm a bit confused by your message. I thought SPEED=slow was the most complete test setup, but is it SPEED=thorough instead?

It depends... for the qtests, "slow" and "thorough" is the same, but for the iotests, we enable even more additional formats with "thorough".

Thomas