All of lore.kernel.org
 help / color / mirror / Atom feed
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: wency@cn.fujitsu.com
Cc: jan.kiszka@siemens.com, qemu-devel@nongnu.org,
	lcapitulino@redhat.com, anderson@redhat.com,
	anthony@codemonkey.ws, eblake@redhat.com
Subject: Re: [Qemu-devel] [PATCH 11/11 v10] introduce a new monitor command 'dump-guest-memory' to dump guest's memory
Date: Mon, 26 Mar 2012 12:22:31 +0900 (   )	[thread overview]
Message-ID: <20120326.122231.39165724.d.hatayama@jp.fujitsu.com> (raw)
In-Reply-To: <4F6FC8CC.5010902@cn.fujitsu.com>

From: Wen Congyang <wency@cn.fujitsu.com>
Subject: Re: [PATCH 11/11 v10] introduce a new monitor command 'dump-guest-memory' to dump guest's memory
Date: Mon, 26 Mar 2012 09:39:24 +0800

> At 03/23/2012 05:40 PM, HATAYAMA Daisuke Wrote:
>> From: Wen Congyang <wency@cn.fujitsu.com>
>> Subject: [PATCH 11/11 v10] introduce a new monitor command 'dump-guest-memory' to dump guest's memory
>> Date: Tue, 20 Mar 2012 11:57:43 +0800
>> 
>>> +/* get the memory's offset in the vmcore */
>>> +static target_phys_addr_t get_offset(target_phys_addr_t phys_addr,
>>> +                                     DumpState *s)
>>> +{
>>> +    RAMBlock *block;
>>> +    target_phys_addr_t offset = s->memory_offset;
>>> +    int64_t size_in_block, start;
>>> +
>>> +    if (s->has_filter) {
>>> +        if (phys_addr < s->begin || phys_addr >= s->begin + s->length) {
>>> +            return -1;
>>> +        }
>>> +    }
>>> +
>>> +    QLIST_FOREACH(block, &ram_list.blocks, next) {
>>> +        if (s->has_filter) {
>>> +            if (block->offset >= s->begin + s->length ||
>>> +                block->offset + block->length <= s->begin) {
>>> +                /* This block is out of the range */
>>> +                continue;
>>> +            }
>>> +
>>> +            if (s->begin <= block->offset) {
>>> +                start = block->offset;
>>> +            } else {
>>> +                start = s->begin;
>>> +            }
>>> +
>>> +            size_in_block = block->length - (start - block->offset);
>>> +            if (s->begin + s->length < block->offset + block->length) {
>>> +                size_in_block -= block->offset + block->length -
>>> +                                 (s->begin + s->length);
>>> +            }
>>> +        } else {
>>> +            start = block->offset;
>>> +            size_in_block = block->length;
>>> +        }
>>> +
>>> +        if (phys_addr >= start && phys_addr < start + size_in_block) {
>>> +            return phys_addr - start + offset;
>>> +        }
>>> +
>>> +        offset += size_in_block;
>>> +    }
>>> +
>>> +    return -1;
>>> +}
>> 
>> OK. -1 is assigned to offset when the corresponding memory is filtered
>> and so not contained in dumpfile. But please give -1 a name. I want
>> the name to tell me the data is filterred.
>> 
>> Also, I couldn't imagine get_offset() does filtering processing. This
>> is important for the purspective of dump because there's data not
>> saved in dumpfile. Could you claify this in some way? By moving
>> filtering processing to the outside, or splitting it into anotehr
>> funciton.
> 
> offset should not be -1. I remove the PT_LOAD in the function memory_mapping_filter().
> In the previous patchset, Luiz said he wants to squash the filtering
> feature to this patch.
> 

I didn't noticed that the patch was moved... _I_ think it should be
presented in a single patch.

Looking at memory_mapping_filter(), PT_LOAD is configured so that
memory that is filtered doesn't exist. I think it better to keep such
mapping with p_filesz == 0 to indicate to users the mapping is
filtered.

Also, get_offset() loops on ram_list.blocks each time it is
called. Because dump_completed() loops memory_mapping list, offset can
be calculated incrementally.

Thanks.
HATAYAMA, Daisuke

  reply	other threads:[~2012-03-26  3:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-20  3:57 [Qemu-devel] [PATCH 11/11 v10] introduce a new monitor command 'dump-guest-memory' to dump guest's memory Wen Congyang
2012-03-23  8:06 ` HATAYAMA Daisuke
2012-03-23 17:07   ` Luiz Capitulino
2012-03-26  2:00     ` Wen Congyang
2012-03-23  9:00 ` HATAYAMA Daisuke
2012-03-26  1:43   ` Wen Congyang
2012-03-23  9:40 ` HATAYAMA Daisuke
2012-03-26  1:39   ` Wen Congyang
2012-03-26  3:22     ` HATAYAMA Daisuke [this message]
2012-03-23 17:19 ` Luiz Capitulino
2012-03-26  1:53   ` Wen Congyang

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=20120326.122231.39165724.d.hatayama@jp.fujitsu.com \
    --to=d.hatayama@jp.fujitsu.com \
    --cc=anderson@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=eblake@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wency@cn.fujitsu.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.