Skip to contentSkip to conversation

Migration deadcode removal

PATCH Superseded [email protected] 4 participants 12 messages Sep 18, 2024 – Sep 19, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Migration deadcode removal

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This is a set of deadcode removal around migration
found by looking for unused symbols.

Note this does remove the old zero-blocks
capability, but it's been meaningless anyway since block migration went.

Dave

Dr. David Alan Gilbert (3):
migration: Remove migrate_cap_set
migration: Remove unused zero-blocks capability
migration: Remove unused socket_send_channel_create_sync

 migration/options.c | 28 ----------------------------
 migration/options.h |  2 --
 migration/socket.c  | 18 ------------------
 migration/socket.h  |  1 -
 qapi/migration.json | 10 +---------
 5 files changed, 1 insertion(+), 58 deletions(-)
Signature · 1 line
2.46.0
#1 lore raw

PATCH 1/3 migration: Remove migrate_cap_set

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_cap_set has been unused since
18d154f575 ("migration: Remove 'blk/-b' option from migrate commands")

Remove it.

---
 migration/options.c | 20 --------------------
 migration/options.h |  1 -
 2 files changed, 21 deletions(-)
migration/options.c +0 -20
index 147cd2b8fd..9460c5dee9 100644
@@ -605,26 +605,6 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
     return true;
 }
 
-bool migrate_cap_set(int cap, bool value, Error **errp)
-{
-    MigrationState *s = migrate_get_current();
-    bool new_caps[MIGRATION_CAPABILITY__MAX];
-
-    if (migration_is_running()) {
-        error_setg(errp, "There's a migration process in progress");
-        return false;
-    }
-
-    memcpy(new_caps, s->capabilities, sizeof(new_caps));
-    new_caps[cap] = value;
-
-    if (!migrate_caps_check(s->capabilities, new_caps, errp)) {
-        return false;
-    }
-    s->capabilities[cap] = value;
-    return true;
-}
-
 MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
 {
     MigrationCapabilityStatusList *head = NULL, **tail = &head;
migration/options.h +0 -1
index a0bd6edc06..36e7b3723f 100644
@@ -58,7 +58,6 @@ bool migrate_tls(void);
 /* capabilities helpers */
 
 bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp);
-bool migrate_cap_set(int cap, bool value, Error **errp);
 
 /* parameters */
 
Signature · 1 line
2.46.0
#3 lore raw

PATCH 2/3 migration: Remove unused zero-blocks capability

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_zero_blocks is unused since
eef0bae3a7 ("migration: Remove block migration")

Remove it.
That whole zero-blocks capability was just for old-school block migration anyway.

Remove the capability as well.

---
 migration/options.c |  8 --------
 migration/options.h |  1 -
 qapi/migration.json | 10 +---------
 3 files changed, 1 insertion(+), 18 deletions(-)
migration/options.c +0 -8
index 9460c5dee9..997e060612 100644
@@ -177,7 +177,6 @@ Property migration_properties[] = {
     DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
     DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
     DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
-    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
     DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
     DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
     DEFINE_PROP_MIG_CAP("x-postcopy-preempt",
@@ -339,13 +338,6 @@ bool migrate_xbzrle(void)
     return s->capabilities[MIGRATION_CAPABILITY_XBZRLE];
 }
 
-bool migrate_zero_blocks(void)
-{
-    MigrationState *s = migrate_get_current();
-
-    return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS];
-}
-
 bool migrate_zero_copy_send(void)
 {
     MigrationState *s = migrate_get_current();
migration/options.h +0 -1
index 36e7b3723f..79084eed0d 100644
@@ -40,7 +40,6 @@ bool migrate_release_ram(void);
 bool migrate_return_path(void);
 bool migrate_validate_uuid(void);
 bool migrate_xbzrle(void);
-bool migrate_zero_blocks(void);
 bool migrate_zero_copy_send(void);
 
 /*
qapi/migration.json +1 -9
index b66cccf107..82d0fc962e 100644
@@ -389,13 +389,6 @@
 #     footprint is mlock()'d on demand or all at once.  Refer to
 #     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
 #
-# @zero-blocks: During storage migration encode blocks of zeroes
-#     efficiently.  This essentially saves 1MB of zeroes per block on
-#     the wire.  Enabling requires source and target VM to support
-#     this feature.  To enable it is sufficient to enable the
-#     capability on the source VM.  The feature is disabled by
-#     default.  (since 1.6)
-#
 # @events: generate events for each migration state change (since 2.4)
 #
 # @auto-converge: If enabled, QEMU will automatically throttle down
@@ -483,7 +476,7 @@
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',
@@ -542,7 +535,6 @@
 #           {"state": false, "capability": "xbzrle"},
 #           {"state": false, "capability": "rdma-pin-all"},
 #           {"state": false, "capability": "auto-converge"},
-#           {"state": false, "capability": "zero-blocks"},
 #           {"state": true, "capability": "events"},
 #           {"state": false, "capability": "postcopy-ram"},
 #           {"state": false, "capability": "x-colo"}
Signature · 1 line
2.46.0
#4 lore raw

Re: [PATCH 2/3] migration: Remove unused zero-blocks capability

Quoted 23 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_zero_blocks is unused since
eef0bae3a7 ("migration: Remove block migration")

Remove it.
That whole zero-blocks capability was just for old-school block migration anyway.

Remove the capability as well.

---
 migration/options.c |  8 --------
 migration/options.h |  1 -
 qapi/migration.json | 10 +---------
 3 files changed, 1 insertion(+), 18 deletions(-)
migration/options.c +0 -0
index 9460c5dee9..997e060612 100644

migration/options.c Property migration_properties[] = { · line 182

Quoted 7 lines
migration/options.c +0 -1
@@ -177,7 +177,6 @@ Property migration_properties[] = {
     DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
     DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
     DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
-    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
     DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
     DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
     DEFINE_PROP_MIG_CAP("x-postcopy-preempt",

Property of (pseudo-)device "migration". The "x-" prefix suggests we expect management software not to rely on it. Okay.

[...]

Quoted 19 lines
qapi/migration.json +0 -7
index b66cccf107..82d0fc962e 100644
@@ -389,13 +389,6 @@
 #     footprint is mlock()'d on demand or all at once.  Refer to
 #     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
 #
-# @zero-blocks: During storage migration encode blocks of zeroes
-#     efficiently.  This essentially saves 1MB of zeroes per block on
-#     the wire.  Enabling requires source and target VM to support
-#     this feature.  To enable it is sufficient to enable the
-#     capability on the source VM.  The feature is disabled by
-#     default.  (since 1.6)
-#
 # @events: generate events for each migration state change (since 2.4)
 #
 # @auto-converge: If enabled, QEMU will automatically throttle down

qapi/migration.json line 482

Quoted 8 lines
qapi/migration.json +1 -1
@@ -483,7 +476,7 @@
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',

This is used by migrate-set-capabilities and query-migrate-capabilities, via ['MigrationCapabilityStatus'].

query-migrate-capabilities is unaffected: it couldn't return zero-blocks anymore even before the patch.

migrate-set-capabilities changes incompatibly, I'm afraid. Before the patch:

    {"execute": "migrate-set-capabilities", "arguments": {"capabilities": [{"capability": "zero-blocks", "state": true}]}}
    {"return": {}}

Afterwards:

    {"error": {"class": "GenericError", "desc": "Parameter 'capability' does not accept value 'zero-blocks'"}}

If we had somehow rejected the capability when it made no sense, removing it now it never makes sense would be obviously fine.

The straight & narrow path is to deprecate now, remove later.

If we believe nothing relies on it, we can bend the rules and remove right away. Missing then: update to docs/about/removed-features.rst.

qapi/migration.json line 540

Quoted 8 lines
qapi/migration.json +0 -1
@@ -542,7 +535,6 @@
 #           {"state": false, "capability": "xbzrle"},
 #           {"state": false, "capability": "rdma-pin-all"},
 #           {"state": false, "capability": "auto-converge"},
-#           {"state": false, "capability": "zero-blocks"},
 #           {"state": true, "capability": "events"},
 #           {"state": false, "capability": "postcopy-ram"},
 #           {"state": false, "capability": "x-colo"}

Example for query-migrate-capabilities. Good.

#5 lore raw

Re: [PATCH 2/3] migration: Remove unused zero-blocks capability

Quoted 78 lines · Markus Armbruster
Quoted 23 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_zero_blocks is unused since
eef0bae3a7 ("migration: Remove block migration")

Remove it.
That whole zero-blocks capability was just for old-school block migration anyway.

Remove the capability as well.

---
 migration/options.c |  8 --------
 migration/options.h |  1 -
 qapi/migration.json | 10 +---------
 3 files changed, 1 insertion(+), 18 deletions(-)
migration/options.c +0 -0
index 9460c5dee9..997e060612 100644

migration/options.c Property migration_properties[] = { · line 182

Quoted 7 lines
migration/options.c +0 -1
@@ -177,7 +177,6 @@ Property migration_properties[] = {
     DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
     DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
     DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
-    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
     DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
     DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
     DEFINE_PROP_MIG_CAP("x-postcopy-preempt",

Property of (pseudo-)device "migration". The "x-" prefix suggests we expect management software not to rely on it. Okay.

[...]

Quoted 19 lines
qapi/migration.json +0 -7
index b66cccf107..82d0fc962e 100644
@@ -389,13 +389,6 @@
 #     footprint is mlock()'d on demand or all at once.  Refer to
 #     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
 #
-# @zero-blocks: During storage migration encode blocks of zeroes
-#     efficiently.  This essentially saves 1MB of zeroes per block on
-#     the wire.  Enabling requires source and target VM to support
-#     this feature.  To enable it is sufficient to enable the
-#     capability on the source VM.  The feature is disabled by
-#     default.  (since 1.6)
-#
 # @events: generate events for each migration state change (since 2.4)
 #
 # @auto-converge: If enabled, QEMU will automatically throttle down

qapi/migration.json line 482

Quoted 8 lines
qapi/migration.json +1 -1
@@ -483,7 +476,7 @@
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',

This is used by migrate-set-capabilities and query-migrate-capabilities, via ['MigrationCapabilityStatus'].

query-migrate-capabilities is unaffected: it couldn't return zero-blocks anymore even before the patch.

migrate-set-capabilities changes incompatibly, I'm afraid. Before the patch:

    {"execute": "migrate-set-capabilities", "arguments": {"capabilities": [{"capability": "zero-blocks", "state": true}]}}
    {"return": {}}
Quoted 8 lines

Afterwards:

    {"error": {"class": "GenericError", "desc": "Parameter 'capability' does not accept value 'zero-blocks'"}}

If we had somehow rejected the capability when it made no sense, removing it now it never makes sense would be obviously fine.

The straight & narrow path is to deprecate now, remove later.

I wonder whether we can make this one simpler, as IIUC this cap depends on the block migration feature, which properly went through the deprecation process and got removed in the previous release.

IOW, currently QEMU behaves the same with this cap on/off, ignoring it completely. I think it means the deprecation message (even if we provide some for two extra releases..) wouldn't be anything helpful as anyone who uses this feature already got affected before this patch.. this feature, together with block migration, are simply all gone already?

Quoted 3 lines

If we believe nothing relies on it, we can bend the rules and remove right away. Missing then: update to docs/about/removed-features.rst.

Indeed, we could mention there.

Thanks,

Quoted 12 lines

qapi/migration.json line 540

Quoted 9 lines
qapi/migration.json +0 -1
@@ -542,7 +535,6 @@
 #           {"state": false, "capability": "xbzrle"},
 #           {"state": false, "capability": "rdma-pin-all"},
 #           {"state": false, "capability": "auto-converge"},
-#           {"state": false, "capability": "zero-blocks"},
 #           {"state": true, "capability": "events"},
 #           {"state": false, "capability": "postcopy-ram"},
 #           {"state": false, "capability": "x-colo"}

Example for query-migrate-capabilities. Good.

Signature · 1 line
Peter Xu
#6 lore raw

Re: [PATCH 2/3] migration: Remove unused zero-blocks capability

Quoted 92 lines · Peter Xu
Quoted 78 lines · Markus Armbruster
Quoted 23 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_zero_blocks is unused since
eef0bae3a7 ("migration: Remove block migration")

Remove it.
That whole zero-blocks capability was just for old-school block migration anyway.

Remove the capability as well.

---
 migration/options.c |  8 --------
 migration/options.h |  1 -
 qapi/migration.json | 10 +---------
 3 files changed, 1 insertion(+), 18 deletions(-)
migration/options.c +0 -0
index 9460c5dee9..997e060612 100644

migration/options.c Property migration_properties[] = { · line 182

Quoted 7 lines
migration/options.c +0 -1
@@ -177,7 +177,6 @@ Property migration_properties[] = {
     DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
     DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
     DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
-    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
     DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
     DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
     DEFINE_PROP_MIG_CAP("x-postcopy-preempt",

Property of (pseudo-)device "migration". The "x-" prefix suggests we expect management software not to rely on it. Okay.

[...]

Quoted 19 lines
qapi/migration.json +0 -7
index b66cccf107..82d0fc962e 100644
@@ -389,13 +389,6 @@
 #     footprint is mlock()'d on demand or all at once.  Refer to
 #     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
 #
-# @zero-blocks: During storage migration encode blocks of zeroes
-#     efficiently.  This essentially saves 1MB of zeroes per block on
-#     the wire.  Enabling requires source and target VM to support
-#     this feature.  To enable it is sufficient to enable the
-#     capability on the source VM.  The feature is disabled by
-#     default.  (since 1.6)
-#
 # @events: generate events for each migration state change (since 2.4)
 #
 # @auto-converge: If enabled, QEMU will automatically throttle down

qapi/migration.json line 482

Quoted 8 lines
qapi/migration.json +1 -1
@@ -483,7 +476,7 @@
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',

This is used by migrate-set-capabilities and query-migrate-capabilities, via ['MigrationCapabilityStatus'].

query-migrate-capabilities is unaffected: it couldn't return zero-blocks anymore even before the patch.

migrate-set-capabilities changes incompatibly, I'm afraid. Before the patch:

    {"execute": "migrate-set-capabilities", "arguments": {"capabilities": [{"capability": "zero-blocks", "state": true}]}}
    {"return": {}}
Quoted 8 lines

Afterwards:

    {"error": {"class": "GenericError", "desc": "Parameter 'capability' does not accept value 'zero-blocks'"}}

If we had somehow rejected the capability when it made no sense, removing it now it never makes sense would be obviously fine.

The straight & narrow path is to deprecate now, remove later.

I wonder whether we can make this one simpler, as IIUC this cap depends on the block migration feature, which properly went through the deprecation process and got removed in the previous release.

Quoted 5 lines

IOW, currently QEMU behaves the same with this cap on/off, ignoring it completely. I think it means the deprecation message (even if we provide some for two extra releases..) wouldn't be anything helpful as anyone who uses this feature already got affected before this patch.. this feature, together with block migration, are simply all gone already?

We break compatibility for users who supply capability @zero-blocks even though they are not using block migration.

Before this patch, the capability is silently ignored.

Afterwards, we reject it.

This harmless misuse was *not* affected by our prior removal of block migration.

It *is* affected by the proposed removal of the capability.

We either treat this in struct accordance to our rules: deprecate now, remove later. Or we bend our them:

Quoted 2 lines
Quoted 2 lines

If we believe nothing relies on it, we can bend the rules and remove right away.

Not for me to decide.

Quoted 17 lines
Quoted 1 line

Missing then: update to docs/about/removed-features.rst.

Indeed, we could mention there.

Thanks,

Quoted 11 lines

qapi/migration.json line 540

Quoted 9 lines
qapi/migration.json +0 -1
@@ -542,7 +535,6 @@
 #           {"state": false, "capability": "xbzrle"},
 #           {"state": false, "capability": "rdma-pin-all"},
 #           {"state": false, "capability": "auto-converge"},
-#           {"state": false, "capability": "zero-blocks"},
 #           {"state": true, "capability": "events"},
 #           {"state": false, "capability": "postcopy-ram"},
 #           {"state": false, "capability": "x-colo"}

Example for query-migrate-capabilities. Good.

#7 lore raw

Re: [PATCH 2/3] migration: Remove unused zero-blocks capability

Quoted 103 lines · Markus Armbruster
Quoted 92 lines · Peter Xu
Quoted 78 lines · Markus Armbruster
Quoted 23 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_zero_blocks is unused since
eef0bae3a7 ("migration: Remove block migration")

Remove it.
That whole zero-blocks capability was just for old-school block migration anyway.

Remove the capability as well.

---
 migration/options.c |  8 --------
 migration/options.h |  1 -
 qapi/migration.json | 10 +---------
 3 files changed, 1 insertion(+), 18 deletions(-)
migration/options.c +0 -0
index 9460c5dee9..997e060612 100644

migration/options.c Property migration_properties[] = { · line 182

Quoted 7 lines
migration/options.c +0 -1
@@ -177,7 +177,6 @@ Property migration_properties[] = {
     DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
     DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
     DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
-    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
     DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
     DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
     DEFINE_PROP_MIG_CAP("x-postcopy-preempt",

Property of (pseudo-)device "migration". The "x-" prefix suggests we expect management software not to rely on it. Okay.

[...]

Quoted 19 lines
qapi/migration.json +0 -7
index b66cccf107..82d0fc962e 100644
@@ -389,13 +389,6 @@
 #     footprint is mlock()'d on demand or all at once.  Refer to
 #     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
 #
-# @zero-blocks: During storage migration encode blocks of zeroes
-#     efficiently.  This essentially saves 1MB of zeroes per block on
-#     the wire.  Enabling requires source and target VM to support
-#     this feature.  To enable it is sufficient to enable the
-#     capability on the source VM.  The feature is disabled by
-#     default.  (since 1.6)
-#
 # @events: generate events for each migration state change (since 2.4)
 #
 # @auto-converge: If enabled, QEMU will automatically throttle down

qapi/migration.json line 482

Quoted 8 lines
qapi/migration.json +1 -1
@@ -483,7 +476,7 @@
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',

This is used by migrate-set-capabilities and query-migrate-capabilities, via ['MigrationCapabilityStatus'].

query-migrate-capabilities is unaffected: it couldn't return zero-blocks anymore even before the patch.

migrate-set-capabilities changes incompatibly, I'm afraid. Before the patch:

    {"execute": "migrate-set-capabilities", "arguments": {"capabilities": [{"capability": "zero-blocks", "state": true}]}}
    {"return": {}}
Quoted 8 lines

Afterwards:

    {"error": {"class": "GenericError", "desc": "Parameter 'capability' does not accept value 'zero-blocks'"}}

If we had somehow rejected the capability when it made no sense, removing it now it never makes sense would be obviously fine.

The straight & narrow path is to deprecate now, remove later.

I wonder whether we can make this one simpler, as IIUC this cap depends on the block migration feature, which properly went through the deprecation process and got removed in the previous release.

Quoted 5 lines

IOW, currently QEMU behaves the same with this cap on/off, ignoring it completely. I think it means the deprecation message (even if we provide some for two extra releases..) wouldn't be anything helpful as anyone who uses this feature already got affected before this patch.. this feature, together with block migration, are simply all gone already?

We break compatibility for users who supply capability @zero-blocks even though they are not using block migration.

Quoted 8 lines

Before this patch, the capability is silently ignored.

Afterwards, we reject it.

This harmless misuse was *not* affected by our prior removal of block migration.

It *is* affected by the proposed removal of the capability.

How does this policy_skip thing works? Could we automatically warn whenever a capability has the 'deprecated' feature in migration.json?

Also, some of the incompatibility errors in migrate_caps_check() could be simplified with something like a new:
'features': [ 'conflicts': [ 'cap1', 'cap2' ] ]
to indicate which caps are incompatible between themselves.

Quoted 9 lines

We either treat this in struct accordance to our rules: deprecate now, remove later. Or we bend our them:

Quoted 2 lines
Quoted 2 lines

If we believe nothing relies on it, we can bend the rules and remove right away.

Not for me to decide.

I'm fine either way, but in any case:

-- >8 --
From 3ff313a52e37b8cb407c900d7a1aa266560aebb7 Mon Sep 17 00:00:00 2001
From: Fabiano Rosas <[email protected]>
Date: Thu, 19 Sep 2024 09:49:44 -0300
Subject: [PATCH] migration: Deprecate zero-blocks capability

The zero-blocks capability was meant to be used along with the block migration, which has been removed already in commit eef0bae3a7 ("migration: Remove block migration").

Setting zero-blocks is currently a noop, but the outright removal of the capability would cause and error in case some users are still setting it. Put the capability through the deprecation process.

---
 docs/about/deprecated.rst | 6 ++++++
 migration/options.c       | 4 ++++
 qapi/migration.json       | 5 ++++-
 3 files changed, 14 insertions(+), 1 deletion(-)
docs/about/deprecated.rst +6 -0
index ed31d4b0b2..47cabb6fcc 100644
@@ -476,3 +476,9 @@ usage of providing a file descriptor to a plain file has been
 deprecated in favor of explicitly using the ``file:`` URI with the
 file descriptor being passed as an ``fdset``. Refer to the ``add-fd``
 command documentation for details on the ``fdset`` usage.
+
+``zero-blocks`` capability (since 9.2)
+''''''''''''''''''''''''''''''''''''''
+
+The ``zero-blocks`` capability was part of the block migration which
+doesn't exist anymore since it was removed in QEMU v9.1.
migration/options.c +4 -0
index 147cd2b8fd..b828bad0d9 100644
@@ -457,6 +457,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
     ERRP_GUARD();
     MigrationIncomingState *mis = migration_incoming_get_current();
 
+    if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) {
+        warn_report("zero-blocks capability is deprecated");
+    }
+
 #ifndef CONFIG_REPLICATION
     if (new_caps[MIGRATION_CAPABILITY_X_COLO]) {
         error_setg(errp, "QEMU compiled without replication module"
qapi/migration.json +4 -1
index b66cccf107..3af6aa1740 100644
@@ -479,11 +479,14 @@
 # Features:
 #
 # @unstable: Members @x-colo and @x-ignore-shared are experimental.
+# @deprecated: Member @zero-blocks is deprecated as being part of
+#     block migration which was already removed.
 #
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
+           { 'name': 'zero-blocks', 'features': [ 'deprecated' ] },
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',
Signature · 1 line
2.35.3
#8 lore raw

Re: [PATCH 2/3] migration: Remove unused zero-blocks capability

Quoted 126 lines · * Fabiano Rosas ([email protected]) wrote:
Quoted 103 lines · Markus Armbruster
Quoted 92 lines · Peter Xu
Quoted 78 lines · Markus Armbruster
Quoted 23 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_zero_blocks is unused since
eef0bae3a7 ("migration: Remove block migration")

Remove it.
That whole zero-blocks capability was just for old-school block migration anyway.

Remove the capability as well.

---
 migration/options.c |  8 --------
 migration/options.h |  1 -
 qapi/migration.json | 10 +---------
 3 files changed, 1 insertion(+), 18 deletions(-)
migration/options.c +0 -0
index 9460c5dee9..997e060612 100644

migration/options.c Property migration_properties[] = { · line 182

Quoted 7 lines
migration/options.c +0 -1
@@ -177,7 +177,6 @@ Property migration_properties[] = {
     DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
     DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
     DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
-    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
     DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
     DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
     DEFINE_PROP_MIG_CAP("x-postcopy-preempt",

Property of (pseudo-)device "migration". The "x-" prefix suggests we expect management software not to rely on it. Okay.

[...]

Quoted 19 lines
qapi/migration.json +0 -7
index b66cccf107..82d0fc962e 100644
@@ -389,13 +389,6 @@
 #     footprint is mlock()'d on demand or all at once.  Refer to
 #     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
 #
-# @zero-blocks: During storage migration encode blocks of zeroes
-#     efficiently.  This essentially saves 1MB of zeroes per block on
-#     the wire.  Enabling requires source and target VM to support
-#     this feature.  To enable it is sufficient to enable the
-#     capability on the source VM.  The feature is disabled by
-#     default.  (since 1.6)
-#
 # @events: generate events for each migration state change (since 2.4)
 #
 # @auto-converge: If enabled, QEMU will automatically throttle down

qapi/migration.json line 482

Quoted 8 lines
qapi/migration.json +1 -1
@@ -483,7 +476,7 @@
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',

This is used by migrate-set-capabilities and query-migrate-capabilities, via ['MigrationCapabilityStatus'].

query-migrate-capabilities is unaffected: it couldn't return zero-blocks anymore even before the patch.

migrate-set-capabilities changes incompatibly, I'm afraid. Before the patch:

    {"execute": "migrate-set-capabilities", "arguments": {"capabilities": [{"capability": "zero-blocks", "state": true}]}}
    {"return": {}}
Quoted 8 lines

Afterwards:

    {"error": {"class": "GenericError", "desc": "Parameter 'capability' does not accept value 'zero-blocks'"}}

If we had somehow rejected the capability when it made no sense, removing it now it never makes sense would be obviously fine.

The straight & narrow path is to deprecate now, remove later.

I wonder whether we can make this one simpler, as IIUC this cap depends on the block migration feature, which properly went through the deprecation process and got removed in the previous release.

Quoted 5 lines

IOW, currently QEMU behaves the same with this cap on/off, ignoring it completely. I think it means the deprecation message (even if we provide some for two extra releases..) wouldn't be anything helpful as anyone who uses this feature already got affected before this patch.. this feature, together with block migration, are simply all gone already?

We break compatibility for users who supply capability @zero-blocks even though they are not using block migration.

Quoted 8 lines

Before this patch, the capability is silently ignored.

Afterwards, we reject it.

This harmless misuse was *not* affected by our prior removal of block migration.

It *is* affected by the proposed removal of the capability.

How does this policy_skip thing works? Could we automatically warn whenever a capability has the 'deprecated' feature in migration.json?

Also, some of the incompatibility errors in migrate_caps_check() could be simplified with something like a new:
'features': [ 'conflicts': [ 'cap1', 'cap2' ] ]
to indicate which caps are incompatible between themselves.

Quoted 4 lines

We either treat this in struct accordance to our rules: deprecate now, remove later. Or we bend our them:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

If we believe nothing relies on it, we can bend the rules and remove right away.

Not for me to decide.

I'm fine either way, but in any case:

OK, so I'll split my code to just remove the dead function rather than the actual capability; Thanks for Fabiano for doing the Deprecation stuff!

Dave

Quoted 73 lines

-- >8 --

Quoted 1 line

From 3ff313a52e37b8cb407c900d7a1aa266560aebb7 Mon Sep 17 00:00:00 2001

From: Fabiano Rosas <[email protected]>
Date: Thu, 19 Sep 2024 09:49:44 -0300
Subject: [PATCH] migration: Deprecate zero-blocks capability

The zero-blocks capability was meant to be used along with the block migration, which has been removed already in commit eef0bae3a7 ("migration: Remove block migration").

Setting zero-blocks is currently a noop, but the outright removal of the capability would cause and error in case some users are still setting it. Put the capability through the deprecation process.

---
 docs/about/deprecated.rst | 6 ++++++
 migration/options.c       | 4 ++++
 qapi/migration.json       | 5 ++++-
 3 files changed, 14 insertions(+), 1 deletion(-)
docs/about/deprecated.rst +6 -0
index ed31d4b0b2..47cabb6fcc 100644
@@ -476,3 +476,9 @@ usage of providing a file descriptor to a plain file has been
 deprecated in favor of explicitly using the ``file:`` URI with the
 file descriptor being passed as an ``fdset``. Refer to the ``add-fd``
 command documentation for details on the ``fdset`` usage.
+
+``zero-blocks`` capability (since 9.2)
+''''''''''''''''''''''''''''''''''''''
+
+The ``zero-blocks`` capability was part of the block migration which
+doesn't exist anymore since it was removed in QEMU v9.1.
migration/options.c +4 -0
index 147cd2b8fd..b828bad0d9 100644
@@ -457,6 +457,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
     ERRP_GUARD();
     MigrationIncomingState *mis = migration_incoming_get_current();
 
+    if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) {
+        warn_report("zero-blocks capability is deprecated");
+    }
+
 #ifndef CONFIG_REPLICATION
     if (new_caps[MIGRATION_CAPABILITY_X_COLO]) {
         error_setg(errp, "QEMU compiled without replication module"
qapi/migration.json +4 -1
index b66cccf107..3af6aa1740 100644
@@ -479,11 +479,14 @@
 # Features:
 #
 # @unstable: Members @x-colo and @x-ignore-shared are experimental.
+# @deprecated: Member @zero-blocks is deprecated as being part of
+#     block migration which was already removed.
 #
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
+           { 'name': 'zero-blocks', 'features': [ 'deprecated' ] },
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',
Signature · 1 line
2.35.3
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#9 lore raw

Re: [PATCH 2/3] migration: Remove unused zero-blocks capability

Quoted 130 lines · Dr. David Alan Gilbert
Quoted 129 lines · * Fabiano Rosas ([email protected]) wrote:
Quoted 103 lines · Markus Armbruster
Quoted 92 lines · Peter Xu
Quoted 78 lines · Markus Armbruster
Quoted 23 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

migrate_zero_blocks is unused since
eef0bae3a7 ("migration: Remove block migration")

Remove it.
That whole zero-blocks capability was just for old-school block migration anyway.

Remove the capability as well.

---
 migration/options.c |  8 --------
 migration/options.h |  1 -
 qapi/migration.json | 10 +---------
 3 files changed, 1 insertion(+), 18 deletions(-)
migration/options.c +0 -0
index 9460c5dee9..997e060612 100644

migration/options.c Property migration_properties[] = { · line 182

Quoted 7 lines
migration/options.c +0 -1
@@ -177,7 +177,6 @@ Property migration_properties[] = {
     DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
     DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL),
     DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE),
-    DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS),
     DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS),
     DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM),
     DEFINE_PROP_MIG_CAP("x-postcopy-preempt",

Property of (pseudo-)device "migration". The "x-" prefix suggests we expect management software not to rely on it. Okay.

[...]

Quoted 19 lines
qapi/migration.json +0 -7
index b66cccf107..82d0fc962e 100644
@@ -389,13 +389,6 @@
 #     footprint is mlock()'d on demand or all at once.  Refer to
 #     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
 #
-# @zero-blocks: During storage migration encode blocks of zeroes
-#     efficiently.  This essentially saves 1MB of zeroes per block on
-#     the wire.  Enabling requires source and target VM to support
-#     this feature.  To enable it is sufficient to enable the
-#     capability on the source VM.  The feature is disabled by
-#     default.  (since 1.6)
-#
 # @events: generate events for each migration state change (since 2.4)
 #
 # @auto-converge: If enabled, QEMU will automatically throttle down

qapi/migration.json line 482

Quoted 8 lines
qapi/migration.json +1 -1
@@ -483,7 +476,7 @@
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',

This is used by migrate-set-capabilities and query-migrate-capabilities, via ['MigrationCapabilityStatus'].

query-migrate-capabilities is unaffected: it couldn't return zero-blocks anymore even before the patch.

migrate-set-capabilities changes incompatibly, I'm afraid. Before the patch:

    {"execute": "migrate-set-capabilities", "arguments": {"capabilities": [{"capability": "zero-blocks", "state": true}]}}
    {"return": {}}
Quoted 8 lines

Afterwards:

    {"error": {"class": "GenericError", "desc": "Parameter 'capability' does not accept value 'zero-blocks'"}}

If we had somehow rejected the capability when it made no sense, removing it now it never makes sense would be obviously fine.

The straight & narrow path is to deprecate now, remove later.

I wonder whether we can make this one simpler, as IIUC this cap depends on the block migration feature, which properly went through the deprecation process and got removed in the previous release.

Quoted 5 lines

IOW, currently QEMU behaves the same with this cap on/off, ignoring it completely. I think it means the deprecation message (even if we provide some for two extra releases..) wouldn't be anything helpful as anyone who uses this feature already got affected before this patch.. this feature, together with block migration, are simply all gone already?

We break compatibility for users who supply capability @zero-blocks even though they are not using block migration.

Quoted 8 lines

Before this patch, the capability is silently ignored.

Afterwards, we reject it.

This harmless misuse was *not* affected by our prior removal of block migration.

It *is* affected by the proposed removal of the capability.

How does this policy_skip thing works? Could we automatically warn whenever a capability has the 'deprecated' feature in migration.json?

Also, some of the incompatibility errors in migrate_caps_check() could be simplified with something like a new:
'features': [ 'conflicts': [ 'cap1', 'cap2' ] ]
to indicate which caps are incompatible between themselves.

Quoted 7 lines

We either treat this in struct accordance to our rules: deprecate now, remove later. Or we bend our them:

Quoted 2 lines
Quoted 2 lines

If we believe nothing relies on it, we can bend the rules and remove right away.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Not for me to decide.

I'm fine either way, but in any case:

OK, so I'll split my code to just remove the dead function rather than the actual capability; Thanks for Fabiano for doing the Deprecation stuff!

I'll wait for a final ACK from Markus, then I can queue below patch directly into migration-next.

Thanks all!

Quoted 82 lines

Dave

Quoted 73 lines

-- >8 --

Quoted 1 line

From 3ff313a52e37b8cb407c900d7a1aa266560aebb7 Mon Sep 17 00:00:00 2001

From: Fabiano Rosas <[email protected]>
Date: Thu, 19 Sep 2024 09:49:44 -0300
Subject: [PATCH] migration: Deprecate zero-blocks capability

The zero-blocks capability was meant to be used along with the block migration, which has been removed already in commit eef0bae3a7 ("migration: Remove block migration").

Setting zero-blocks is currently a noop, but the outright removal of the capability would cause and error in case some users are still setting it. Put the capability through the deprecation process.

---
 docs/about/deprecated.rst | 6 ++++++
 migration/options.c       | 4 ++++
 qapi/migration.json       | 5 ++++-
 3 files changed, 14 insertions(+), 1 deletion(-)
docs/about/deprecated.rst +6 -0
index ed31d4b0b2..47cabb6fcc 100644
@@ -476,3 +476,9 @@ usage of providing a file descriptor to a plain file has been
 deprecated in favor of explicitly using the ``file:`` URI with the
 file descriptor being passed as an ``fdset``. Refer to the ``add-fd``
 command documentation for details on the ``fdset`` usage.
+
+``zero-blocks`` capability (since 9.2)
+''''''''''''''''''''''''''''''''''''''
+
+The ``zero-blocks`` capability was part of the block migration which
+doesn't exist anymore since it was removed in QEMU v9.1.
migration/options.c +4 -0
index 147cd2b8fd..b828bad0d9 100644
@@ -457,6 +457,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
     ERRP_GUARD();
     MigrationIncomingState *mis = migration_incoming_get_current();
 
+    if (new_caps[MIGRATION_CAPABILITY_ZERO_BLOCKS]) {
+        warn_report("zero-blocks capability is deprecated");
+    }
+
 #ifndef CONFIG_REPLICATION
     if (new_caps[MIGRATION_CAPABILITY_X_COLO]) {
         error_setg(errp, "QEMU compiled without replication module"
qapi/migration.json +4 -1
index b66cccf107..3af6aa1740 100644
@@ -479,11 +479,14 @@
 # Features:
 #
 # @unstable: Members @x-colo and @x-ignore-shared are experimental.
+# @deprecated: Member @zero-blocks is deprecated as being part of
+#     block migration which was already removed.
 #
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
-  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
+  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
+           { 'name': 'zero-blocks', 'features': [ 'deprecated' ] },
            'events', 'postcopy-ram',
            { 'name': 'x-colo', 'features': [ 'unstable' ] },
            'release-ram',
Signature · 1 line
2.35.3
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 1 line
Peter Xu
#10 lore raw

PATCH 3/3 migration: Remove unused socket_send_channel_create_sync

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

socket_send_channel_create_sync only use was removed by
d0edb8a173 ("migration: Create the postcopy preempt channel asynchronously")

Remove it.

---
 migration/socket.c | 18 ------------------
 migration/socket.h |  1 -
 2 files changed, 19 deletions(-)
migration/socket.c +0 -18
index 9ab89b1e08..5ec65b8c03 100644
@@ -42,24 +42,6 @@ void socket_send_channel_create(QIOTaskFunc f, void *data)
                                      f, data, NULL, NULL);
 }
 
-QIOChannel *socket_send_channel_create_sync(Error **errp)
-{
-    QIOChannelSocket *sioc = qio_channel_socket_new();
-
-    if (!outgoing_args.saddr) {
-        object_unref(OBJECT(sioc));
-        error_setg(errp, "Initial sock address not set!");
-        return NULL;
-    }
-
-    if (qio_channel_socket_connect_sync(sioc, outgoing_args.saddr, errp) < 0) {
-        object_unref(OBJECT(sioc));
-        return NULL;
-    }
-
-    return QIO_CHANNEL(sioc);
-}
-
 struct SocketConnectData {
     MigrationState *s;
     char *hostname;
migration/socket.h +0 -1
index 46c233ecd2..04ebbe95a1 100644
@@ -22,7 +22,6 @@
 #include "qemu/sockets.h"
 
 void socket_send_channel_create(QIOTaskFunc f, void *data);
-QIOChannel *socket_send_channel_create_sync(Error **errp);
 
 void socket_start_incoming_migration(SocketAddress *saddr, Error **errp);
 
Signature · 1 line
2.46.0