On Tue, Jun 10, 2025 at 05:55:31PM -0300, Fabiano Rosas wrote:
> I think I caused some confusion here. I wrote migrate_params_override()
> last thing on a friday and forgot it did the right thing from the
> beginning:
> 
>     migrate_params_apply(&s->defaults);
>     qmp_migrate_set_parameters(new, errp);
> 
> This s->defaults is poorly named and is actualy already the merge of
> defaults + globals, because qdev does it for us. migrate_params_apply()

Ha!  I didn't remember this part of details when reading, but then I
followed with that idea it won't apply to &defaults.

> will then copy that to s->parameters and qmp_migrate_set_parameters()
> will apply the 'new' params from 'config' on top s->parameters. An
> example:
> 
> Setting multifd-channels (default 2) using various methods and querying
> both QMP and HMP:
> 
> a) global overrides default:
> 
>  $ ./qemu-system-x86_64 -global migration.multifd-channels=4 ...
>  => QMP: "multifd-channels": 4, HMP: multifd-channels: 4
> 
> b) migrate-set-parameter overrides global:
> 
>  { 'execute': 'migrate-set-parameters', 'arguments': { 'multifd-channels': 8 
> } }
>  => QMP: "multifd-channels": 8, HMP: multifd-channels: 8
> 
> c) config not touching the parameter, value is reset to global:
> 
>  { 'execute': 'migrate', 'arguments': { ..., 'config': { 'multifd': true } } }
>  => QMP: "multifd-channels": 4, HMP: multifd-channels: 4
> 
> d) config overrides all:
> 
>  { 'execute': 'migrate', 'arguments': { ..., 'config': {'multifd-channels': 
> 16 } } }
>  => QMP: "multifd-channels": 16, HMP: multifd-channels: 16
> 
> Without global:
> 
> e) default is set initially
> 
>  $ ./qemu-system-x86_64 ...
>  => QMP: "multifd-channels": 2, HMP: multifd-channels: 2
> 
> f) migrate-set-parameter overrides default:
> 
>  { 'execute': 'migrate-set-parameters', 'arguments': { 'multifd-channels': 8 
> } }
>  => QMP: "multifd-channels": 8, HMP: multifd-channels: 8
> 
> g) config not touching the parameter, value is reset to default:
> 
>  { 'execute': 'migrate', 'arguments': { ..., 'config': { 'multifd': true } } }
>  => "multifd-channels": 2, HMP: multifd-channels: 2
> 
> h) config overrides all:
> 
>  { 'execute': 'migrate', 'arguments': { ..., 'config': {'multifd-channels': 
> 16 } } }
>  => QMP: "multifd-channels": 16, HMP: multifd-channels: 16
> 
> I'll update the variable names and code comments to be more
> precise. Sorry for the noise.

Good to know it's even working.  Thanks for digging it.

-- 
Peter Xu


Reply via email to