From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3oLS-0000vS-DS for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:36:50 -0400 Received: from [140.186.70.92] (port=54671 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3oLL-0000sN-IC for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3oLA-0000qF-R5 for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:36:43 -0400 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]:40757) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3oL8-0000pR-1W for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:36:31 -0400 Message-ID: <4BCC3226.20305@lab.ntt.co.jp> Date: Mon, 19 Apr 2010 19:36:22 +0900 From: Yoshiaki Tamura MIME-Version: 1.0 References: <1271670198-12793-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <1271670198-12793-3-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <4BCC2DBA.4000602@redhat.com> In-Reply-To: <4BCC2DBA.4000602@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org, ohmura.kei@lab.ntt.co.jp Avi Kivity wrote: > On 04/19/2010 12:43 PM, Yoshiaki Tamura wrote: >> Replaces byte-based phys_ram_dirty bitmap with four bit-based >> phys_ram_dirty >> bitmap. On allocation, it sets all bits in the bitmap. >> >> Signed-off-by: Yoshiaki Tamura >> --- >> exec.c | 16 +++++++++++----- >> qemu-common.h | 3 +++ >> 2 files changed, 14 insertions(+), 5 deletions(-) >> >> diff --git a/exec.c b/exec.c >> index c74b0a4..b85cb26 100644 >> --- a/exec.c >> +++ b/exec.c >> @@ -110,7 +110,7 @@ uint8_t *code_gen_ptr; >> >> #if !defined(CONFIG_USER_ONLY) >> int phys_ram_fd; >> -uint8_t *phys_ram_dirty; >> +unsigned long *phys_ram_dirty[NUM_DIRTY_IDX]; >> static int in_migration; >> >> typedef struct RAMBlock { >> @@ -2825,10 +2825,16 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size) >> new_block->next = ram_blocks; >> ram_blocks = new_block; >> >> - phys_ram_dirty = qemu_realloc(phys_ram_dirty, >> - (last_ram_offset + size)>> TARGET_PAGE_BITS); >> - memset(phys_ram_dirty + (last_ram_offset>> TARGET_PAGE_BITS), >> - 0xff, size>> TARGET_PAGE_BITS); >> + if (BITMAP_SIZE(last_ram_offset + size) != >> BITMAP_SIZE(last_ram_offset)) { > > This check is unneeded - the code will work fine even if the bitmap size > doesn't change. OK. I'll remove it. > >> + int i; >> + for (i = MASTER_DIRTY_IDX; i< NUM_DIRTY_IDX; i++) { >> + phys_ram_dirty[i] >> + = qemu_realloc(phys_ram_dirty[i], >> + BITMAP_SIZE(last_ram_offset + size)); >> + memset((uint8_t *)phys_ram_dirty[i] + >> + BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size)); >> + } >> + } >> >> last_ram_offset += size; >> >