[PATCH 3/5] migration: Disallow xbzrle with postcopy

Peter Xu posted 5 patches 3 years, 4 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Juan Quintela <quintela@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>
There is a newer version of this series
[PATCH 3/5] migration: Disallow xbzrle with postcopy
Posted by Peter Xu 3 years, 4 months ago
It's not supported since the 1st day, as ram_load_postcopy does not handle
RAM_SAVE_FLAG_XBZRLE.  Mark it disabled explicitly.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/migration.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index bb8bbddfe4..fb4066dfb4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1268,6 +1268,11 @@ static bool migrate_caps_check(bool *cap_list,
             error_setg(errp, "Postcopy is not compatible with ignore-shared");
             return false;
         }
+
+        if (cap_list[MIGRATION_CAPABILITY_XBZRLE]) {
+            error_setg(errp, "Postcopy is not compatible with xbzrle");
+            return false;
+        }
     }
 
     if (cap_list[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) {
-- 
2.32.0
Re: [PATCH 3/5] migration: Disallow xbzrle with postcopy
Posted by Dr. David Alan Gilbert 3 years, 4 months ago
* Peter Xu (peterx@redhat.com) wrote:
> It's not supported since the 1st day, as ram_load_postcopy does not handle
> RAM_SAVE_FLAG_XBZRLE.  Mark it disabled explicitly.

We've already got a check in ram_save_page:

    if (rs->xbzrle_enabled && !migration_in_postcopy()) {
        pages = save_xbzrle_page(rs, &p, current_addr, block,
                                 offset);

so that's supposed to allow you to enable xbzrle with postcopy and take
advantage of xbzrle during the precopy phase.

Dave

> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/migration.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index bb8bbddfe4..fb4066dfb4 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1268,6 +1268,11 @@ static bool migrate_caps_check(bool *cap_list,
>              error_setg(errp, "Postcopy is not compatible with ignore-shared");
>              return false;
>          }
> +
> +        if (cap_list[MIGRATION_CAPABILITY_XBZRLE]) {
> +            error_setg(errp, "Postcopy is not compatible with xbzrle");
> +            return false;
> +        }
>      }
>  
>      if (cap_list[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) {
> -- 
> 2.32.0
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Re: [PATCH 3/5] migration: Disallow xbzrle with postcopy
Posted by Peter Xu 3 years, 4 months ago
On Thu, Sep 22, 2022 at 04:56:21PM +0100, Dr. David Alan Gilbert wrote:
> * Peter Xu (peterx@redhat.com) wrote:
> > It's not supported since the 1st day, as ram_load_postcopy does not handle
> > RAM_SAVE_FLAG_XBZRLE.  Mark it disabled explicitly.
> 
> We've already got a check in ram_save_page:
> 
>     if (rs->xbzrle_enabled && !migration_in_postcopy()) {
>         pages = save_xbzrle_page(rs, &p, current_addr, block,
>                                  offset);
> 
> so that's supposed to allow you to enable xbzrle with postcopy and take
> advantage of xbzrle during the precopy phase.

Ah!  Makes sense.  I'll drop this one.

-- 
Peter Xu