From: "Cédric Le Goater" <clg@redhat.com>
To: Avihai Horon <avihaih@nvidia.com>, qemu-devel@nongnu.org
Cc: Alex Williamson <alex.williamson@redhat.com>,
Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>,
Leonardo Bras <leobras@redhat.com>,
Yanghang Liu <yanghliu@redhat.com>
Subject: Re: [PATCH v3 3/6] migration: Move more initializations to migrate_init()
Date: Wed, 6 Sep 2023 18:16:43 +0200 [thread overview]
Message-ID: <819d69f1-b212-e84e-6b6c-ec9178b6fdf2@redhat.com> (raw)
In-Reply-To: <20230906150853.22176-4-avihaih@nvidia.com>
On 9/6/23 17:08, Avihai Horon wrote:
> Initialization of mig_stats, compression_counters and VFIO bytes
> transferred is hard-coded in migration code path and snapshot code path.
>
> Make the code cleaner by initializing them in migrate_init().
>
> Suggested-by: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
> ---
> migration/migration.c | 14 +++++++-------
> migration/savevm.c | 3 ---
> 2 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 92866a8f49..ce01a3ba6a 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1425,6 +1425,13 @@ void migrate_init(MigrationState *s)
> s->iteration_initial_bytes = 0;
> s->threshold_size = 0;
> s->switchover_acked = false;
> + /*
> + * set mig_stats compression_counters memory to zero for a
> + * new migration
> + */
> + memset(&mig_stats, 0, sizeof(mig_stats));
> + memset(&compression_counters, 0, sizeof(compression_counters));
> + migration_reset_vfio_bytes_transferred();
> }
>
> int migrate_add_blocker_internal(Error *reason, Error **errp)
> @@ -1635,13 +1642,6 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
> }
>
> migrate_init(s);
> - /*
> - * set mig_stats compression_counters memory to zero for a
> - * new migration
> - */
> - memset(&mig_stats, 0, sizeof(mig_stats));
> - memset(&compression_counters, 0, sizeof(compression_counters));
> - migration_reset_vfio_bytes_transferred();
>
> return true;
> }
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 5bf8b59a7d..e14efeced0 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1620,9 +1620,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
> }
>
> migrate_init(ms);
> - memset(&mig_stats, 0, sizeof(mig_stats));
> - memset(&compression_counters, 0, sizeof(compression_counters));
> - migration_reset_vfio_bytes_transferred();
> ms->to_dst_file = f;
>
> qemu_mutex_unlock_iothread();
next prev parent reply other threads:[~2023-09-06 16:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 15:08 [PATCH v3 0/6] vfio/migration: Block VFIO migration with postcopy and background snapshot Avihai Horon
2023-09-06 15:08 ` [PATCH v3 1/6] migration: Add migration prefix to functions in target.c Avihai Horon
2023-09-06 15:08 ` [PATCH v3 2/6] vfio/migration: Fail adding device with enable-migration=on and existing blocker Avihai Horon
2023-09-06 15:08 ` [PATCH v3 3/6] migration: Move more initializations to migrate_init() Avihai Horon
2023-09-06 16:16 ` Cédric Le Goater [this message]
2023-09-06 15:08 ` [PATCH v3 4/6] migration: Add .save_prepare() handler to struct SaveVMHandlers Avihai Horon
2023-09-06 15:08 ` [PATCH v3 5/6] vfio/migration: Block VFIO migration with postcopy migration Avihai Horon
2023-09-06 15:18 ` Peter Xu
2023-09-06 15:08 ` [PATCH v3 6/6] vfio/migration: Block VFIO migration with background snapshot Avihai Horon
2023-09-07 8:55 ` [PATCH v3 0/6] vfio/migration: Block VFIO migration with postcopy and " Cédric Le Goater
2023-09-07 9:07 ` Cédric Le Goater
2023-09-08 21:47 ` 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=819d69f1-b212-e84e-6b6c-ec9178b6fdf2@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=avihaih@nvidia.com \
--cc=leobras@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yanghliu@redhat.com \
/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).