From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SB0zJ-0001aj-L8 for qemu-devel@nongnu.org; Fri, 23 Mar 2012 05:40:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SB0z9-0007O1-Hv for qemu-devel@nongnu.org; Fri, 23 Mar 2012 05:40:49 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:38416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SB0z9-0007Nb-09 for qemu-devel@nongnu.org; Fri, 23 Mar 2012 05:40:39 -0400 Received: from m1.gw.fujitsu.co.jp (unknown [10.0.50.71]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id 3A3E83EE0BB for ; Fri, 23 Mar 2012 18:40:36 +0900 (JST) Received: from smail (m1 [127.0.0.1]) by outgoing.m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 933CA45DE5E for ; Fri, 23 Mar 2012 18:40:35 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (s1.gw.fujitsu.co.jp [10.0.50.91]) by m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 4D37E45DE60 for ; Fri, 23 Mar 2012 18:40:35 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 41E82E38006 for ; Fri, 23 Mar 2012 18:40:35 +0900 (JST) Received: from m105.s.css.fujitsu.com (m105.s.css.fujitsu.com [10.240.81.145]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id EBB00E38001 for ; Fri, 23 Mar 2012 18:40:34 +0900 (JST) Date: Fri, 23 Mar 2012 18:40:22 +0900 ( ) Message-Id: <20120323.184022.246504000.d.hatayama@jp.fujitsu.com> From: HATAYAMA Daisuke In-Reply-To: <4F680037.9090101@cn.fujitsu.com> References: <4F680037.9090101@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 11/11 v10] introduce a new monitor command 'dump-guest-memory' to dump guest's memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 From: Wen Congyang 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. Thanks. HATAYAMA, Daisuke