From: Peter Xu <peterx@redhat.com>
To: Hao Xiang <hao.xiang@linux.dev>
Cc: marcandre.lureau@redhat.com, farosas@suse.de, armbru@redhat.com,
lvivier@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v4 11/14] migration/multifd: Add migration option set packet size.
Date: Wed, 1 May 2024 15:36:01 -0400 [thread overview]
Message-ID: <ZjKZof0M6rrGmwjL@x1n> (raw)
In-Reply-To: <20240425022117.4035031-12-hao.xiang@linux.dev>
On Thu, Apr 25, 2024 at 02:21:14AM +0000, Hao Xiang wrote:
> The current multifd packet size is 128 * 4kb. This change adds
> an option to set the packet size. Both sender and receiver needs
> to set the same packet size for things to work.
>
> Signed-off-by: Hao Xiang <hao.xiang@linux.dev>
> ---
> migration/options.c | 36 ++++++++++++++++++++++++++++++++++++
> migration/options.h | 1 +
> qapi/migration.json | 21 ++++++++++++++++++---
> 3 files changed, 55 insertions(+), 3 deletions(-)
>
> diff --git a/migration/options.c b/migration/options.c
> index dc8642df81..a9deb079eb 100644
> --- a/migration/options.c
> +++ b/migration/options.c
> @@ -79,6 +79,12 @@
> #define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5
> #define DEFAULT_MIGRATE_ANNOUNCE_STEP 100
>
> +/*
> + * Parameter for multifd packet size.
> + */
> +#define DEFAULT_MIGRATE_MULTIFD_PACKET_SIZE (128 * 4 * 1024)
> +#define MAX_MIGRATE_MULTIFD_PACKET_SIZE (1023 * 4 * 1024)
> +
> #define DEFINE_PROP_MIG_CAP(name, x) \
> DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false)
>
> @@ -184,6 +190,9 @@ Property migration_properties[] = {
> ZERO_PAGE_DETECTION_MULTIFD),
> DEFINE_PROP_STRING("multifd-dsa-accel", MigrationState,
> parameters.multifd_dsa_accel),
> + DEFINE_PROP_SIZE("multifd-packet-size", MigrationState,
> + parameters.multifd_packet_size,
> + DEFAULT_MIGRATE_MULTIFD_PACKET_SIZE),
Having such knob looks all fine, but I feel like this patch is half-baked,
no? There seems to have another part in the next patch. Maybe they need
to be squashed together.
>
> /* Migration capabilities */
> DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
> @@ -879,6 +888,13 @@ int migrate_multifd_channels(void)
> return s->parameters.multifd_channels;
> }
>
> +uint64_t migrate_multifd_packet_size(void)
> +{
> + MigrationState *s = migrate_get_current();
> +
> + return s->parameters.multifd_packet_size;
> +}
> +
> MultiFDCompression migrate_multifd_compression(void)
> {
> MigrationState *s = migrate_get_current();
> @@ -1031,6 +1047,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
> params->x_checkpoint_delay = s->parameters.x_checkpoint_delay;
> params->has_block_incremental = true;
> params->block_incremental = s->parameters.block_incremental;
> + params->has_multifd_packet_size = true;
> + params->multifd_packet_size = s->parameters.multifd_packet_size;
> params->has_multifd_channels = true;
> params->multifd_channels = s->parameters.multifd_channels;
> params->has_multifd_compression = true;
> @@ -1094,6 +1112,7 @@ void migrate_params_init(MigrationParameters *params)
> params->has_downtime_limit = true;
> params->has_x_checkpoint_delay = true;
> params->has_block_incremental = true;
> + params->has_multifd_packet_size = true;
> params->has_multifd_channels = true;
> params->has_multifd_compression = true;
> params->has_multifd_zlib_level = true;
> @@ -1195,6 +1214,17 @@ bool migrate_params_check(MigrationParameters *params, Error **errp)
>
> /* x_checkpoint_delay is now always positive */
>
> + if (params->has_multifd_packet_size &&
> + ((params->multifd_packet_size < DEFAULT_MIGRATE_MULTIFD_PACKET_SIZE) ||
> + (params->multifd_packet_size > MAX_MIGRATE_MULTIFD_PACKET_SIZE) ||
> + (params->multifd_packet_size % qemu_target_page_size() != 0))) {
> + error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
> + "multifd_packet_size",
> + "a value between 524288 and 4190208, "
We should reference the macros here.
> + "must be a multiple of guest VM's page size.");
> + return false;
> + }
> +
> if (params->has_multifd_channels && (params->multifd_channels < 1)) {
> error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
> "multifd_channels",
> @@ -1374,6 +1404,9 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
> if (params->has_block_incremental) {
> dest->block_incremental = params->block_incremental;
> }
> + if (params->has_multifd_packet_size) {
> + dest->multifd_packet_size = params->multifd_packet_size;
> + }
> if (params->has_multifd_channels) {
> dest->multifd_channels = params->multifd_channels;
> }
> @@ -1524,6 +1557,9 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
> " use blockdev-mirror with NBD instead");
> s->parameters.block_incremental = params->block_incremental;
> }
> + if (params->has_multifd_packet_size) {
> + s->parameters.multifd_packet_size = params->multifd_packet_size;
> + }
> if (params->has_multifd_channels) {
> s->parameters.multifd_channels = params->multifd_channels;
> }
> diff --git a/migration/options.h b/migration/options.h
> index 1cb3393be9..23995e6608 100644
> --- a/migration/options.h
> +++ b/migration/options.h
> @@ -92,6 +92,7 @@ const char *migrate_tls_hostname(void);
> uint64_t migrate_xbzrle_cache_size(void);
> ZeroPageDetection migrate_zero_page_detection(void);
> const char *migrate_multifd_dsa_accel(void);
> +uint64_t migrate_multifd_packet_size(void);
>
> /* parameters setters */
>
> diff --git a/qapi/migration.json b/qapi/migration.json
> index 934fa8839e..39d609c394 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -920,6 +920,10 @@
> # characters. Setting this string to an empty string means disabling
> # DSA accelerator offloading. Defaults to an empty string. (since 9.2)
> #
> +# @multifd-packet-size: Packet size in bytes used to migrate data.
> +# The value needs to be a multiple of guest VM's page size.
Maybe just call it "guest page size".
> +# The default value is 524288 and max value is 4190208. (Since 9.2)
IMHO we can avoid mentioning these in QAPI. This will be a very, very,
developer oriented value: if the default isn't the best to the majority of
people, we should change the default. Not easy for an admin to understand
what is this about.
I'm even thinking whether we should only expose it via one migration debug
option (-global migration.multifd-packet-size only), rather exporting it in
QMP or even HMP. Or do you want this actually to be tunable for real?
> +#
> # Features:
> #
> # @deprecated: Member @block-incremental is deprecated. Use
> @@ -954,7 +958,8 @@
> { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
> 'vcpu-dirty-limit',
> 'mode',
> - 'zero-page-detection'] }
> + 'zero-page-detection',
> + 'multifd-packet-size'] }
>
> ##
> # @MigrateSetParameters:
> @@ -1134,6 +1139,10 @@
> # characters. Setting this string to an empty string means disabling
> # DSA accelerator offloading. Defaults to an empty string. (since 9.2)
> #
> +# @multifd-packet-size: Packet size in bytes used to migrate data.
> +# The value needs to be a multiple of guest VM's page size.
> +# The default value is 524288 and max value is 4190208. (Since 9.2)
> +#
> # Features:
> #
> # @deprecated: Member @block-incremental is deprecated. Use
> @@ -1189,7 +1198,8 @@
> '*vcpu-dirty-limit': 'uint64',
> '*mode': 'MigMode',
> '*zero-page-detection': 'ZeroPageDetection',
> - '*multifd-dsa-accel': 'StrOrNull'} }
> + '*multifd-dsa-accel': 'StrOrNull',
> + '*multifd-packet-size' : 'uint64'} }
>
> ##
> # @migrate-set-parameters:
> @@ -1373,6 +1383,10 @@
> # characters. Setting this string to an empty string means disabling
> # DSA accelerator offloading. Defaults to an empty string. (since 9.2)
> #
> +# @multifd-packet-size: Packet size in bytes used to migrate data.
> +# The value needs to be a multiple of guest VM's page size.
> +# The default value is 524288 and max value is 4190208. (Since 9.2)
> +#
> # Features:
> #
> # @deprecated: Member @block-incremental is deprecated. Use
> @@ -1425,7 +1439,8 @@
> '*vcpu-dirty-limit': 'uint64',
> '*mode': 'MigMode',
> '*zero-page-detection': 'ZeroPageDetection',
> - '*multifd-dsa-accel': 'str'} }
> + '*multifd-dsa-accel': 'str',
> + '*multifd-packet-size': 'uint64'} }
>
> ##
> # @query-migrate-parameters:
> --
> 2.30.2
>
>
--
Peter Xu
next prev parent reply other threads:[~2024-05-01 19:37 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 2:21 [PATCH v4 00/14] Use Intel DSA accelerator to offload zero page checking in multifd live migration Hao Xiang
2024-04-25 2:21 ` [PATCH v4 01/14] meson: Introduce new instruction set enqcmd to the build system Hao Xiang
2024-04-25 18:50 ` Fabiano Rosas
2024-04-25 2:21 ` [PATCH v4 02/14] util/dsa: Add dependency idxd Hao Xiang
2024-04-25 20:33 ` Fabiano Rosas
2024-04-25 2:21 ` [PATCH v4 03/14] util/dsa: Implement DSA device start and stop logic Hao Xiang
2024-04-25 14:21 ` Daniel P. Berrangé
2024-04-25 14:25 ` Daniel P. Berrangé
2024-04-25 14:32 ` Daniel P. Berrangé
2024-04-25 21:22 ` Fabiano Rosas
2024-04-25 2:21 ` [PATCH v4 04/14] util/dsa: Implement DSA task enqueue and dequeue Hao Xiang
2024-04-25 20:55 ` Fabiano Rosas
2024-04-25 21:48 ` Fabiano Rosas
2024-04-25 2:21 ` [PATCH v4 05/14] util/dsa: Implement DSA task asynchronous completion thread model Hao Xiang
2024-04-25 2:21 ` [PATCH v4 06/14] util/dsa: Implement zero page checking in DSA task Hao Xiang
2024-04-25 2:21 ` [PATCH v4 07/14] util/dsa: Implement DSA task asynchronous submission and wait for completion Hao Xiang
2024-05-01 18:59 ` Peter Xu
2024-04-25 2:21 ` [PATCH v4 08/14] migration/multifd: Add new migration option for multifd DSA offloading Hao Xiang
2024-04-25 14:17 ` Daniel P. Berrangé
2024-04-26 9:16 ` Markus Armbruster
2024-04-25 2:21 ` [PATCH v4 09/14] migration/multifd: Prepare to introduce DSA acceleration on the multifd path Hao Xiang
2024-05-01 19:18 ` Peter Xu
2024-04-25 2:21 ` [PATCH v4 10/14] migration/multifd: Enable DSA offloading in multifd sender path Hao Xiang
2024-04-25 14:29 ` Daniel P. Berrangé
2024-04-25 15:39 ` Fabiano Rosas
2024-05-01 19:25 ` Peter Xu
2024-04-25 2:21 ` [PATCH v4 11/14] migration/multifd: Add migration option set packet size Hao Xiang
2024-05-01 19:36 ` Peter Xu [this message]
2024-04-25 2:21 ` [PATCH v4 12/14] migration/multifd: Enable set packet size migration option Hao Xiang
2024-04-25 2:21 ` [PATCH v4 13/14] util/dsa: Add unit test coverage for Intel DSA task submission and completion Hao Xiang
2024-04-25 2:21 ` [PATCH v4 14/14] migration/multifd: Add integration tests for multifd with Intel DSA offloading Hao Xiang
2024-05-01 19:54 ` [PATCH v4 00/14] Use Intel DSA accelerator to offload zero page checking in multifd live migration Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZjKZof0M6rrGmwjL@x1n \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=farosas@suse.de \
--cc=hao.xiang@linux.dev \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).