From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Bohdan Trach <bv.trach@gmail.com>
Cc: Bohdan Trach <bohdan.trach@mailbox.tu-dresden.de>,
amit.shah@redhat.com, thomas.knauth@googlemail.com,
qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH RFC 1/3] memory: Add dump-pc-mem command for checkpointing
Date: Mon, 16 Nov 2015 16:46:19 +0000 [thread overview]
Message-ID: <20151116164618.GE2417@work-vm> (raw)
In-Reply-To: <d2e6189248c6e4c2d04f849d57409952ff79da94.1429272036.git.bv.trach@gmail.com>
* Bohdan Trach (bv.trach@gmail.com) wrote:
> From: Bohdan Trach <bohdan.trach@mailbox.tu-dresden.de>
>
> dump-pc-mem command is added for checkpointing guest memory to
> file. Only system RAM region is saved. This checkpoint is later used to
> recover unchanged pages.
Why not just use the 'dump_guest_memory' commands; they dump it in interesting
existing formats; they have headers in the files as well rather than just
a raw blob of data.
If you wanted to restrict to only certain RAM blocks, then I'd suggest adding
a feature to that existing command.
You might also find that you want other RAMBlocks as well, for example where
RAM is added using hot plu, those are separate RAM blocks.
Dave
> Signed-off-by: Bohdan Trach <bohdan.trach@mailbox.tu-dresden.de>
> ---
> arch_init.c | 19 +++++++++++++++++++
> hmp-commands.hx | 16 ++++++++++++++++
> hmp.c | 9 +++++++++
> hmp.h | 1 +
> qapi-schema.json | 11 +++++++++++
> qmp-commands.hx | 19 +++++++++++++++++++
> 6 files changed, 75 insertions(+)
>
> diff --git a/arch_init.c b/arch_init.c
> index 4c8fcee..b8a4fb1 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -603,6 +603,25 @@ static void migration_bitmap_sync(void)
> }
> }
>
> +void qmp_dump_pc_ram(const char *file, Error **errp) {
> +
> + int rc;
> + int fd;
> + fd = open(file,
> + O_CREAT|O_WRONLY,
> + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
> + assert(-1 != fd);
> +
> + RAMBlock *block = QLIST_FIRST_RCU(&ram_list.blocks);
> + uint64_t offset;
> + for (offset=0; offset<ram_size; offset+=TARGET_PAGE_SIZE) {
> + rc = write(fd, block->host+offset, TARGET_PAGE_SIZE);
> + assert(TARGET_PAGE_SIZE == rc);
> + }
> + rc = close(fd);
> + assert(0 == rc);
> +}
> +
> /**
> * ram_save_page: Send the given page to the stream
> *
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 3089533..0c47a4f 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -1043,6 +1043,22 @@ gdb. Without -z|-l|-s, the dump format is ELF.
> ETEXI
>
> {
> + .name = "dump-pc-ram",
> + .args_type = "filename:F",
> + .params = "filename",
> + .help = "dump pc ram to file",
> + .mhandler.cmd = hmp_dump_pc_ram,
> + },
> +
> +
> +STEXI
> +@item dump-pc-ram
> +@findex dump-guest-memory
> +Dump pc ram to file.
> + filename: dump file name
> +ETEXI
> +
> + {
> .name = "snapshot_blkdev",
> .args_type = "reuse:-n,device:B,snapshot-file:s?,format:s?",
> .params = "[-n] device [new-image-file] [format]",
> diff --git a/hmp.c b/hmp.c
> index f31ae27..5e27dd8 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1473,6 +1473,15 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
> g_free(prot);
> }
>
> +void hmp_dump_pc_ram(Monitor *mon, const QDict *qdict)
> +{
> + Error *errp = NULL;
> + const char *file = qdict_get_str(qdict, "filename");
> +
> + qmp_dump_pc_ram(file, &errp);
> + hmp_handle_error(mon, &errp);
> +}
> +
> void hmp_netdev_add(Monitor *mon, const QDict *qdict)
> {
> Error *err = NULL;
> diff --git a/hmp.h b/hmp.h
> index 2b9308b..805a71b 100644
> --- a/hmp.h
> +++ b/hmp.h
> @@ -79,6 +79,7 @@ void hmp_block_job_complete(Monitor *mon, const QDict *qdict);
> void hmp_migrate(Monitor *mon, const QDict *qdict);
> void hmp_device_del(Monitor *mon, const QDict *qdict);
> void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict);
> +void hmp_dump_pc_ram(Monitor *mon, const QDict *qdict);
> void hmp_netdev_add(Monitor *mon, const QDict *qdict);
> void hmp_netdev_del(Monitor *mon, const QDict *qdict);
> void hmp_getfd(Monitor *mon, const QDict *qdict);
> diff --git a/qapi-schema.json b/qapi-schema.json
> index ac9594d..338bfd3 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -3648,3 +3648,14 @@
> # Since: 2.1
> ##
> { 'command': 'rtc-reset-reinjection' }
> +
> +##
> +# @dump-pc-ram:
> +#
> +# Checkpoints guest.
> +#
> +# @file: the file to save the memory to as binary data
> +#
> +# Returns: Nothing on success
> +##
> +{ 'command': 'dump-pc-ram', 'data': {'file': 'str'} }
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index 3a42ad0..0be3c42 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -854,6 +854,25 @@ Notes:
> EQMP
>
> {
> + .name = "dump-pc-ram",
> + .args_type = "file:s",
> + .params = "file",
> + .help = "dump pc ram to file",
> + .user_print = monitor_user_noop,
> + .mhandler.cmd_new = qmp_marshal_input_dump_pc_ram,
> + },
> +
> +SQMP
> +dump
> +
> +
> +Dump pc ram to file.
> +
> +Arguments:
> +
> +EQMP
> +
> + {
> .name = "query-dump-guest-memory-capability",
> .args_type = "",
> .mhandler.cmd_new = qmp_marshal_input_query_dump_guest_memory_capability,
> --
> 2.0.5
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2015-11-16 16:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 12:12 [Qemu-devel] [PATCH RFC 0/3] Checkpoint-assisted migration proposal Bohdan Trach
2015-04-17 12:13 ` [Qemu-devel] [PATCH RFC 1/3] memory: Add dump-pc-mem command for checkpointing Bohdan Trach
2015-04-17 13:53 ` Eric Blake
2015-04-18 7:40 ` Bohdan Trach
2015-11-16 16:46 ` Dr. David Alan Gilbert [this message]
2015-11-17 15:38 ` Bohdan Trach
2015-11-17 16:02 ` Dr. David Alan Gilbert
2015-04-17 12:13 ` [Qemu-devel] [PATCH RFC 2/3] memory: implement checkpoint handling Bohdan Trach
2015-11-16 16:56 ` Dr. David Alan Gilbert
2015-11-17 15:38 ` Bohdan Trach
2015-04-17 12:13 ` [Qemu-devel] [PATCH RFC 3/3] migration: use checkpoint during migration Bohdan Trach
2015-11-17 12:26 ` Dr. David Alan Gilbert
2015-11-17 15:38 ` Bohdan Trach
2015-11-17 16:05 ` Dr. David Alan Gilbert
2015-11-17 16:34 ` Bohdan Trach
2015-11-17 16:39 ` Dr. David Alan Gilbert
2015-04-24 11:38 ` [Qemu-devel] [PATCH RFC, Ping 0/3] Checkpoint-assisted migration proposal Bohdan Trach
2015-05-11 11:13 ` Amit Shah
2015-06-09 10:00 ` Bohdan Trach
2015-08-19 9:19 ` Bohdan Trach
2015-09-15 10:39 ` [Qemu-devel] [PATCH RFC " Amit Shah
2015-10-05 8:33 ` Thomas Knauth
2015-10-05 8:59 ` Amit Shah
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=20151116164618.GE2417@work-vm \
--to=dgilbert@redhat.com \
--cc=amit.shah@redhat.com \
--cc=bohdan.trach@mailbox.tu-dresden.de \
--cc=bv.trach@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thomas.knauth@googlemail.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).