Skip to contentSkip to conversation

migration/postcopy: skip compression when postcopy is active

RFC PATCH In review Wei Yang 3 participants 3 messages Jul 25, 2019 – Aug 26, 2019

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

RFC PATCH 1/1 migration/postcopy: skip compression when postcopy is active

Now postcopy is not compatible with compression. And we disable setting these two capability at the same time. While we can still leverage compress before postcopy is active, for example at the bulk stage.

This patch skips compression when postcopy is active instead of forbidding setting these capability at the same time.

---
 migration/migration.c | 11 -----------
 migration/ram.c       | 10 ++++++++++
 2 files changed, 10 insertions(+), 11 deletions(-)
migration/migration.c +0 -11
index 5a496addbd..33c373033d 100644
@@ -995,17 +995,6 @@ static bool migrate_caps_check(bool *cap_list,
 #endif
 
     if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
-        if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) {
-            /* The decompression threads asynchronously write into RAM
-             * rather than use the atomic copies needed to avoid
-             * userfaulting.  It should be possible to fix the decompression
-             * threads for compatibility in future.
-             */
-            error_setg(errp, "Postcopy is not currently compatible "
-                       "with compression");
-            return false;
-        }
-
         /* This check is reasonably expensive, so only when it's being
          * set the first time, also it's only the destination that needs
          * special support.
migration/ram.c +10 -0
index da12774a24..a0d3bc60b2 100644
@@ -2384,6 +2384,16 @@ static bool save_page_use_compression(RAMState *rs)
         return false;
     }
 
+    /*
+     * The decompression threads asynchronously write into RAM
+     * rather than use the atomic copies needed to avoid
+     * userfaulting.  It should be possible to fix the decompression
+     * threads for compatibility in future.
+     */
+    if (migration_in_postcopy()) {
+        return false;
+    }
+
     /*
      * If xbzrle is on, stop using the data compression after first
      * round of migration even if compression is enabled. In theory,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · * Wei Yang ([email protected]) wrote:

Now postcopy is not compatible with compression. And we disable setting these two capability at the same time. While we can still leverage compress before postcopy is active, for example at the bulk stage.

This patch skips compression when postcopy is active instead of forbidding setting these capability at the same time.

So I think this is OK, because ram_save_complete has a call to flush_compressed_data in it.

However I think we should hold it until you figure out the other series that really enables compress; the problem is that as soon as you allow the capability, then there's nothing to distinguish this version and the version that fully enables it. So how would you stop this version being used as the source to the version which fully enables it?

So I think if we do the other series, then you should start off like this and then remove the capability check right at the end.

Dave

Quoted 51 lines
---
 migration/migration.c | 11 -----------
 migration/ram.c       | 10 ++++++++++
 2 files changed, 10 insertions(+), 11 deletions(-)
migration/migration.c +0 -11
index 5a496addbd..33c373033d 100644
@@ -995,17 +995,6 @@ static bool migrate_caps_check(bool *cap_list,
 #endif
 
     if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
-        if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) {
-            /* The decompression threads asynchronously write into RAM
-             * rather than use the atomic copies needed to avoid
-             * userfaulting.  It should be possible to fix the decompression
-             * threads for compatibility in future.
-             */
-            error_setg(errp, "Postcopy is not currently compatible "
-                       "with compression");
-            return false;
-        }
-
         /* This check is reasonably expensive, so only when it's being
          * set the first time, also it's only the destination that needs
          * special support.
migration/ram.c +10 -0
index da12774a24..a0d3bc60b2 100644
@@ -2384,6 +2384,16 @@ static bool save_page_use_compression(RAMState *rs)
         return false;
     }
 
+    /*
+     * The decompression threads asynchronously write into RAM
+     * rather than use the atomic copies needed to avoid
+     * userfaulting.  It should be possible to fix the decompression
+     * threads for compatibility in future.
+     */
+    if (migration_in_postcopy()) {
+        return false;
+    }
+
     /*
      * If xbzrle is on, stop using the data compression after first
      * round of migration even if compression is enabled. In theory,
Signature · 1 line
2.17.1

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

#2 lore raw
Quoted 13 lines · Dr. David Alan Gilbert
Quoted 8 lines · * Wei Yang ([email protected]) wrote:

Now postcopy is not compatible with compression. And we disable setting these two capability at the same time. While we can still leverage compress before postcopy is active, for example at the bulk stage.

This patch skips compression when postcopy is active instead of forbidding setting these capability at the same time.

So I think this is OK, because ram_save_complete has a call to flush_compressed_data in it.

Quoted 9 lines

However I think we should hold it until you figure out the other series that really enables compress; the problem is that as soon as you allow the capability, then there's nothing to distinguish this version and the version that fully enables it. So how would you stop this version being used as the source to the version which fully enables it?

So I think if we do the other series, then you should start off like this and then remove the capability check right at the end.

Agree, it is not proper to leave this middle state.

Quoted 55 lines

Dave

Quoted 51 lines
---
 migration/migration.c | 11 -----------
 migration/ram.c       | 10 ++++++++++
 2 files changed, 10 insertions(+), 11 deletions(-)
migration/migration.c +0 -11
index 5a496addbd..33c373033d 100644
@@ -995,17 +995,6 @@ static bool migrate_caps_check(bool *cap_list,
 #endif
 
     if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) {
-        if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) {
-            /* The decompression threads asynchronously write into RAM
-             * rather than use the atomic copies needed to avoid
-             * userfaulting.  It should be possible to fix the decompression
-             * threads for compatibility in future.
-             */
-            error_setg(errp, "Postcopy is not currently compatible "
-                       "with compression");
-            return false;
-        }
-
         /* This check is reasonably expensive, so only when it's being
          * set the first time, also it's only the destination that needs
          * special support.
migration/ram.c +10 -0
index da12774a24..a0d3bc60b2 100644
@@ -2384,6 +2384,16 @@ static bool save_page_use_compression(RAMState *rs)
         return false;
     }
 
+    /*
+     * The decompression threads asynchronously write into RAM
+     * rather than use the atomic copies needed to avoid
+     * userfaulting.  It should be possible to fix the decompression
+     * threads for compatibility in future.
+     */
+    if (migration_in_postcopy()) {
+        return false;
+    }
+
     /*
      * If xbzrle is on, stop using the data compression after first
      * round of migration even if compression is enabled. In theory,
Signature · 1 line
2.17.1

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

Signature · 2 lines
Wei Yang
Help you, Help me