From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Alexey Perevalov <a.perevalov@samsung.com>
Cc: qemu-devel@nongnu.org, i.maximets@samsung.com
Subject: Re: [Qemu-devel] [PATCH 5/6] migration: send postcopy downtime back to source
Date: Mon, 24 Apr 2017 18:26:31 +0100 [thread overview]
Message-ID: <20170424172630.GO2362@work-vm> (raw)
In-Reply-To: <1492175840-5021-6-git-send-email-a.perevalov@samsung.com>
* Alexey Perevalov (a.perevalov@samsung.com) wrote:
> Right now to initiate postcopy live migration need to
> send request to source machine and specify destination.
>
> User could request migration status by query-migrate qmp command on
> source machine, but postcopy downtime is being evaluated on destination,
> so it should be transmitted back to source. For this purpose return path
> socket was shosen.
>
> Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
That will break a migration from an older QEMU to a newer QEMU with this feature
since the old QEMU won't know the message type and fail with a
'Received invalid message'
near the start of source_return_path_thread.
The simpler solution is to let the stat be read on the destination side
and not bother sending it backwards over the wire.
Dave
> ---
> include/migration/migration.h | 4 +++-
> migration/migration.c | 20 ++++++++++++++++++--
> migration/postcopy-ram.c | 1 +
> 3 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 5d2c628..5535aa6 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -55,7 +55,8 @@ enum mig_rp_message_type {
>
> MIG_RP_MSG_REQ_PAGES_ID, /* data (start: be64, len: be32, id: string) */
> MIG_RP_MSG_REQ_PAGES, /* data (start: be64, len: be32) */
> -
> + MIG_RP_MSG_DOWNTIME, /* downtime value from destination,
> + calculated and sent in case of post copy */
> MIG_RP_MSG_MAX
> };
>
> @@ -364,6 +365,7 @@ void migrate_send_rp_pong(MigrationIncomingState *mis,
> uint32_t value);
> void migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rbname,
> ram_addr_t start, size_t len);
> +void migrate_send_rp_downtime(MigrationIncomingState *mis, uint64_t downtime);
>
> void ram_control_before_iterate(QEMUFile *f, uint64_t flags);
> void ram_control_after_iterate(QEMUFile *f, uint64_t flags);
> diff --git a/migration/migration.c b/migration/migration.c
> index 5bac434..3134e24 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -553,6 +553,19 @@ void migrate_send_rp_message(MigrationIncomingState *mis,
> }
>
> /*
> + * Send postcopy migration downtime,
> + * at the moment of calling this function migration should
> + * be completed.
> + */
> +void migrate_send_rp_downtime(MigrationIncomingState *mis, uint64_t downtime)
> +{
> + uint64_t buf;
> +
> + buf = cpu_to_be64(downtime);
> + migrate_send_rp_message(mis, MIG_RP_MSG_DOWNTIME, sizeof(downtime), &buf);
> +}
> +
> +/*
> * Send a 'SHUT' message on the return channel with the given value
> * to indicate that we've finished with the RP. Non-0 value indicates
> * error.
> @@ -1483,6 +1496,7 @@ static struct rp_cmd_args {
> [MIG_RP_MSG_PONG] = { .len = 4, .name = "PONG" },
> [MIG_RP_MSG_REQ_PAGES] = { .len = 12, .name = "REQ_PAGES" },
> [MIG_RP_MSG_REQ_PAGES_ID] = { .len = -1, .name = "REQ_PAGES_ID" },
> + [MIG_RP_MSG_DOWNTIME] = { .len = 8, .name = "DOWNTIME" },
> [MIG_RP_MSG_MAX] = { .len = -1, .name = "MAX" },
> };
>
> @@ -1613,6 +1627,10 @@ static void *source_return_path_thread(void *opaque)
> migrate_handle_rp_req_pages(ms, (char *)&buf[13], start, len);
> break;
>
> + case MIG_RP_MSG_DOWNTIME:
> + ms->downtime = ldq_be_p(buf);
> + break;
> +
> default:
> break;
> }
> @@ -1677,7 +1695,6 @@ static int postcopy_start(MigrationState *ms, bool *old_vm_running)
> int ret;
> QIOChannelBuffer *bioc;
> QEMUFile *fb;
> - int64_t time_at_stop = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
> bool restart_block = false;
> migrate_set_state(&ms->state, MIGRATION_STATUS_ACTIVE,
> MIGRATION_STATUS_POSTCOPY_ACTIVE);
> @@ -1779,7 +1796,6 @@ static int postcopy_start(MigrationState *ms, bool *old_vm_running)
> */
> ms->postcopy_after_devices = true;
> notifier_list_notify(&migration_state_notifiers, ms);
> - ms->downtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - time_at_stop;
>
> qemu_mutex_unlock_iothread();
>
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index ea89f4e..42330fd 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -330,6 +330,7 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)
> }
>
> postcopy_state_set(POSTCOPY_INCOMING_END);
> + migrate_send_rp_downtime(mis, get_postcopy_total_downtime());
> migrate_send_rp_shut(mis, qemu_file_get_error(mis->from_src_file) != 0);
>
> if (mis->postcopy_tmp_page) {
> --
> 1.8.3.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-04-24 17:26 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170414131735eucas1p21f1fcadf426789276f567191372f7794@eucas1p2.samsung.com>
2017-04-14 13:17 ` [Qemu-devel] [PATCH 0/6] calculate downtime for postcopy live migration Alexey Perevalov
[not found] ` <CGME20170414131738eucas1p28fe4896d7f42d8c5b23cb95312c41eca@eucas1p2.samsung.com>
2017-04-14 13:17 ` [Qemu-devel] [PATCH 1/6] userfault: add pid into uffd_msg & update UFFD_FEATURE_* Alexey Perevalov
[not found] ` <CGME20170414131739eucas1p1ea9a6adcdbe8cfe45ac1ff582d28d873@eucas1p1.samsung.com>
2017-04-14 13:17 ` [Qemu-devel] [PATCH 2/6] util: introduce glib-helper.c Alexey Perevalov
2017-04-14 16:05 ` Philippe Mathieu-Daudé
2017-04-17 7:07 ` Alexey
2017-04-21 10:01 ` Dr. David Alan Gilbert
2017-04-21 10:27 ` Peter Maydell
2017-04-21 15:10 ` Alexey
2017-04-21 15:49 ` Peter Maydell
2017-04-25 11:23 ` Dr. David Alan Gilbert
[not found] ` <CGME20170414131739eucas1p27a3eed795ae545efff380d7c5f8358c3@eucas1p2.samsung.com>
2017-04-14 13:17 ` [Qemu-devel] [PATCH 3/6] migration: add UFFD_FEATURE_THREAD_ID feature support Alexey Perevalov
2017-04-21 10:24 ` Dr. David Alan Gilbert
2017-04-21 15:22 ` Alexey
2017-04-24 8:03 ` Peter Xu
2017-04-24 8:12 ` Peter Xu
2017-04-24 8:38 ` Alexey
2017-04-24 17:10 ` Dr. David Alan Gilbert
2017-04-25 7:55 ` Alexey
2017-04-25 11:14 ` Dr. David Alan Gilbert
2017-04-25 11:51 ` Alexey Perevalov
[not found] ` <CGME20170414131740eucas1p27eba648b990a93a627265c740e7ff118@eucas1p2.samsung.com>
2017-04-14 13:17 ` [Qemu-devel] [PATCH 4/6] migration: calculate downtime on dst side Alexey Perevalov
2017-04-21 12:00 ` Dr. David Alan Gilbert
2017-04-21 18:47 ` Alexey
2017-04-24 17:11 ` Dr. David Alan Gilbert
2017-04-22 9:49 ` [Qemu-devel] [PATCH 4/6] migration: calculate downtime on dst side (CPUMASK) Alexey
2017-04-24 17:13 ` Dr. David Alan Gilbert
2017-04-25 8:24 ` [Qemu-devel] [PATCH 4/6] migration: calculate downtime on dst side Peter Xu
2017-04-25 10:10 ` Alexey Perevalov
2017-04-25 10:25 ` Peter Xu
2017-04-25 10:47 ` Alexey Perevalov
[not found] ` <CGME20170414131740eucas1p28f240a4e6c78fb56be52f2641c3e5af6@eucas1p2.samsung.com>
2017-04-14 13:17 ` [Qemu-devel] [PATCH 5/6] migration: send postcopy downtime back to source Alexey Perevalov
2017-04-24 17:26 ` Dr. David Alan Gilbert [this message]
2017-04-25 5:51 ` Alexey
[not found] ` <CGME20170414131741eucas1p2f34e11e4292fef1c50ef63bd3522ad04@eucas1p2.samsung.com>
2017-04-14 13:17 ` [Qemu-devel] [PATCH 6/6] migration: detailed traces for postcopy Alexey Perevalov
2017-04-17 13:32 ` Philippe Mathieu-Daudé
2017-04-24 18:03 ` Dr. David Alan Gilbert
2017-04-17 2:32 ` [Qemu-devel] [PATCH 0/6] calculate downtime for postcopy live migration no-reply
2017-04-17 2:36 ` no-reply
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=20170424172630.GO2362@work-vm \
--to=dgilbert@redhat.com \
--cc=a.perevalov@samsung.com \
--cc=i.maximets@samsung.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).