Fabiano Rosas wrote on Mon, 30 Jun 2025 16:58:55 -0300:

> Some migration parameters are updated immediately once they are set
> via migrate-set-parameters. Move that work outside of
> migrate_params_apply() and leave that function with the single
> responsibility of setting s->parameters and not doing any
> side-effects.
> 
> Reviewed-by: Peter Xu <[email protected]>
> Signed-off-by: Fabiano Rosas <[email protected]>
> 
> diff --git a/migration/options.c b/migration/options.c
> index 295367ce92..1f8a977865 100644
> --- a/migration/options.c
> +++ b/migration/options.c
> @@ -1083,6 +1083,31 @@ void migrate_params_init(MigrationParameters *params)
>      params->has_direct_io = true;
>  }
>  
> +static void migrate_post_update_params(MigrationParameters *new, Error 
> **errp)
> +{
> +    MigrationState *s = migrate_get_current();
> +
> +    if (new->has_max_bandwidth) {
> +        if (s->to_dst_file && !migration_in_postcopy()) {
> +            migration_rate_set(new->max_bandwidth);
> +        }
> +    }
> +
> +    if (new->has_x_checkpoint_delay) {
> +        colo_checkpoint_delay_set();
> +    }
> +
> +    if (new->has_xbzrle_cache_size) {
> +        xbzrle_cache_resize(new->xbzrle_cache_size, errp);
> +    }
> +
> +    if (new->has_max_postcopy_bandwidth) {
> +        if (s->to_dst_file && migration_in_postcopy()) {
> +            migration_rate_set(new->max_postcopy_bandwidth);
> +        }
> +    }
> +}
> +
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 2140785a05..7432f82bdd 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -174,7 +174,7 @@ static void XBZRLE_cache_unlock(void)
>  /**
>   * xbzrle_cache_resize: resize the xbzrle cache
>   *
> - * This function is called from migrate_params_apply in main
> + * This function is called from migrate_post_update_config in main
>   * thread, possibly while a migration is in progress.  A running
>   * migration may be using the cache and might finish during this call,
>   * hence changes to the cache are protected by XBZRLE.lock().
> -- 

The function is migrate_post_update_params, 
but the comment says migrate_post_update_config.

--
Regards,
Bin Guo


Reply via email to