From: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
To: pbonzini@redhat.com
Cc: qemu-devel@nongnu.org, rkagan@virtuozzo.com
Subject: Re: [Qemu-devel] [PATCH] dump: fix Windows dump memory run mapping
Date: Sun, 9 Sep 2018 21:28:16 +0300 [thread overview]
Message-ID: <20180909212816.6e0f0ee5@phystech.edu> (raw)
In-Reply-To: <1535567456-6904-1-git-send-email-viktor.prutyanov@virtuozzo.com>
В Wed, 29 Aug 2018 21:30:56 +0300
Viktor Prutyanov <viktor.prutyanov@virtuozzo.com> пишет:
> We should map and use guest memory run by parts if it can't be mapped
> as a whole.
> After this patch, continuos guest physical memory blocks which are not
> continuos in host virtual address space will be processed correctly.
>
> Signed-off-by: Viktor Prutyanov <viktor.prutyanov@virtuozzo.com>
> ---
> win_dump.c | 40 ++++++++++++++++++++++------------------
> 1 file changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/win_dump.c b/win_dump.c
> index b15c191..aa39d9c 100644
> --- a/win_dump.c
> +++ b/win_dump.c
> @@ -30,28 +30,32 @@ static size_t write_run(WinDumpPhyMemRun64 *run,
> int fd, Error **errp) void *buf;
> uint64_t addr = run->BasePage << TARGET_PAGE_BITS;
> uint64_t size = run->PageCount << TARGET_PAGE_BITS;
> - uint64_t len = size;
> + uint64_t len, l;
> + size_t total = 0;
>
> - buf = cpu_physical_memory_map(addr, &len, false);
> - if (!buf) {
> - error_setg(errp, "win-dump: failed to map run");
> - return 0;
> - }
> - if (len != size) {
> - error_setg(errp, "win-dump: failed to map entire run");
> - len = 0;
> - goto out_unmap;
> - }
> + while (size) {
> + len = size;
>
> - len = qemu_write_full(fd, buf, len);
> - if (len != size) {
> - error_setg(errp, QERR_IO_ERROR);
> - }
> + buf = cpu_physical_memory_map(addr, &len, false);
> + if (!buf) {
> + error_setg(errp, "win-dump: failed to map physical range"
> + " 0x%016lx-0x%016lx", addr, addr + size
> - 1);
> + return 0;
> + }
> +
> + l = qemu_write_full(fd, buf, len);
> + cpu_physical_memory_unmap(buf, addr, false, len);
> + if (l != len) {
> + error_setg(errp, QERR_IO_ERROR);
> + return 0;
> + }
>
> -out_unmap:
> - cpu_physical_memory_unmap(buf, addr, false, len);
> + addr += l;
> + size -= l;
> + total += l;
> + }
>
> - return len;
> + return total;
> }
>
> static void write_runs(DumpState *s, WinDumpHeader64 *h, Error
> **errp)
ping
next prev parent reply other threads:[~2018-09-09 18:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 18:30 [Qemu-devel] [PATCH] dump: fix Windows dump memory run mapping Viktor Prutyanov
2018-09-05 14:06 ` Прутьянов, Виктор Владимирович
2018-09-09 18:28 ` Viktor Prutyanov [this message]
2018-09-11 13:02 ` Paolo Bonzini
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=20180909212816.6e0f0ee5@phystech.edu \
--to=viktor.prutyanov@phystech.edu \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkagan@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.