[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 12/12 v11] introduce a new monitor command 'dump
From: |
Wen Congyang |
Subject: |
Re: [Qemu-devel] [PATCH 12/12 v11] introduce a new monitor command 'dump-guest-memory' to dump guest's memory |
Date: |
Mon, 02 Apr 2012 10:54:11 +0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 |
At 03/26/2012 06:06 PM, Wen Congyang Wrote:
> The command's usage:
> dump [-p] protocol [begin] [length]
> The supported protocol can be file or fd:
> 1. file: the protocol starts with "file:", and the following string is
> the file's path.
> 2. fd: the protocol starts with "fd:", and the following string is the
> fd's name.
>
> Note:
> 1. If you want to use gdb to process the core, please specify -p option.
> The reason why the -p option is not default is:
> a. guest machine in a catastrophic state can have corrupted memory,
> which we cannot trust.
> b. The guest machine can be in read-mode even if paging is enabled.
> For example: the guest machine uses ACPI to sleep, and ACPI sleep
> state goes in real-mode.
> 2. This command doesn't support the fd that is is associated with a pipe,
> socket, or FIFO(lseek will fail with such fd).
> 3. If you don't want to dump all guest's memory, please specify the start
> physical address and the length.
>
> Signed-off-by: Wen Congyang <address@hidden>
> ---
> Makefile.target | 2 +-
> dump.c | 827
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> elf.h | 5 +
> hmp-commands.hx | 28 ++
> hmp.c | 22 ++
> hmp.h | 1 +
> memory_mapping.c | 27 ++
> memory_mapping.h | 3 +
> qapi-schema.json | 34 +++
> qmp-commands.hx | 38 +++
> 10 files changed, 986 insertions(+), 1 deletions(-)
> create mode 100644 dump.c
<cut>
> +/* write the memroy to vmcore. 1 page per I/O. */
> +static int write_memory(DumpState *s, RAMBlock *block, ram_addr_t start,
> + target_phys_addr_t *offset, int64_t size)
> +{
> + int i, ret;
The type of i should be int64_t. Otherwise, i * TARGET_PAGE_SIZE
may be overflow.
I will resend this patch.
Thanks
Wen Congyang
> +
> + for (i = 0; i < size / TARGET_PAGE_SIZE; i++) {
> + ret = write_data(s, block->host + start + i * TARGET_PAGE_SIZE,
> + TARGET_PAGE_SIZE, offset);
> + if (ret < 0) {
> + return ret;
> + }
> + }
> +
> + if ((size % TARGET_PAGE_SIZE) != 0) {
> + ret = write_data(s, block->host + start + i * TARGET_PAGE_SIZE,
> + size % TARGET_PAGE_SIZE, offset);
> + if (ret < 0) {
> + return ret;
> + }
> + }
> +
> + return 0;
> +}
> +
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH 12/12 v11] introduce a new monitor command 'dump-guest-memory' to dump guest's memory,
Wen Congyang <=