All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: avi@redhat.com, anthony@codemonkey.ws, aliguori@us.ibm.com,
	mtosatti@redhat.com, ohmura.kei@lab.ntt.co.jp,
	Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Subject: [PATCH v2 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER.
Date: Tue,  6 Apr 2010 09:51:20 +0900	[thread overview]
Message-ID: <1270515084-24120-3-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> (raw)
In-Reply-To: <1270515084-24120-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp>

Replaces byte-based phys_ram_dirty bitmap with three bit-based phys_ram_dirty
bitmap.  On allocation, it sets all bits in the bitmap.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
---
 exec.c |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index c74b0a4..9733892 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_FLAGS];
 static int in_migration;
 
 typedef struct RAMBlock {
@@ -2825,10 +2825,32 @@ 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);
+/* temporarily copy from qemu-kvm.git/qemu-kvm.h */
+#define ALIGN(x, y)  (((x)+(y)-1) & ~((y)-1))
+#define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS) / 8)
+
+    if (BITMAP_SIZE(last_ram_offset + size) != BITMAP_SIZE(last_ram_offset)) {
+        phys_ram_dirty[MASTER_DIRTY_FLAG] =
+            qemu_realloc(phys_ram_dirty[MASTER_DIRTY_FLAG],
+                         BITMAP_SIZE(last_ram_offset + size));
+        phys_ram_dirty[VGA_DIRTY_FLAG] 
+            = qemu_realloc(phys_ram_dirty[VGA_DIRTY_FLAG],
+                           BITMAP_SIZE(last_ram_offset + size));
+        phys_ram_dirty[CODE_DIRTY_FLAG] =
+            qemu_realloc(phys_ram_dirty[CODE_DIRTY_FLAG],
+                         BITMAP_SIZE(last_ram_offset + size));
+        phys_ram_dirty[MIGRATION_DIRTY_FLAG] =
+            qemu_realloc(phys_ram_dirty[MIGRATION_DIRTY_FLAG],
+                         BITMAP_SIZE(last_ram_offset + size));
+        memset((uint8_t *)phys_ram_dirty[MASTER_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+        memset((uint8_t *)phys_ram_dirty[VGA_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+        memset((uint8_t *)phys_ram_dirty[CODE_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+        memset((uint8_t *)phys_ram_dirty[MIGRATION_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+    }
 
     last_ram_offset += size;
 
-- 
1.7.0.31.g1df487


WARNING: multiple messages have this Message-ID (diff)
From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, ohmura.kei@lab.ntt.co.jp,
	mtosatti@redhat.com,
	Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>,
	avi@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER.
Date: Tue,  6 Apr 2010 09:51:20 +0900	[thread overview]
Message-ID: <1270515084-24120-3-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> (raw)
In-Reply-To: <1270515084-24120-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp>

Replaces byte-based phys_ram_dirty bitmap with three bit-based phys_ram_dirty
bitmap.  On allocation, it sets all bits in the bitmap.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
---
 exec.c |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index c74b0a4..9733892 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_FLAGS];
 static int in_migration;
 
 typedef struct RAMBlock {
@@ -2825,10 +2825,32 @@ 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);
+/* temporarily copy from qemu-kvm.git/qemu-kvm.h */
+#define ALIGN(x, y)  (((x)+(y)-1) & ~((y)-1))
+#define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS) / 8)
+
+    if (BITMAP_SIZE(last_ram_offset + size) != BITMAP_SIZE(last_ram_offset)) {
+        phys_ram_dirty[MASTER_DIRTY_FLAG] =
+            qemu_realloc(phys_ram_dirty[MASTER_DIRTY_FLAG],
+                         BITMAP_SIZE(last_ram_offset + size));
+        phys_ram_dirty[VGA_DIRTY_FLAG] 
+            = qemu_realloc(phys_ram_dirty[VGA_DIRTY_FLAG],
+                           BITMAP_SIZE(last_ram_offset + size));
+        phys_ram_dirty[CODE_DIRTY_FLAG] =
+            qemu_realloc(phys_ram_dirty[CODE_DIRTY_FLAG],
+                         BITMAP_SIZE(last_ram_offset + size));
+        phys_ram_dirty[MIGRATION_DIRTY_FLAG] =
+            qemu_realloc(phys_ram_dirty[MIGRATION_DIRTY_FLAG],
+                         BITMAP_SIZE(last_ram_offset + size));
+        memset((uint8_t *)phys_ram_dirty[MASTER_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+        memset((uint8_t *)phys_ram_dirty[VGA_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+        memset((uint8_t *)phys_ram_dirty[CODE_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+        memset((uint8_t *)phys_ram_dirty[MIGRATION_DIRTY_FLAG] +
+               BITMAP_SIZE(last_ram_offset), 0xff, BITMAP_SIZE(size));
+    }
 
     last_ram_offset += size;
 
-- 
1.7.0.31.g1df487

  parent reply	other threads:[~2010-04-06  0:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06  0:51 [PATCH v2 0/6] Introduce bit-based phys_ram_dirty, and bit-based dirty page checker Yoshiaki Tamura
2010-04-06  0:51 ` [Qemu-devel] " Yoshiaki Tamura
2010-04-06  0:51 ` [PATCH v2 1/6] Modify DIRTY_FLAG value to use as indexes of bit-based phys_ram_dirty Yoshiaki Tamura
2010-04-06  0:51   ` [Qemu-devel] " Yoshiaki Tamura
2010-04-06  0:51 ` Yoshiaki Tamura [this message]
2010-04-06  0:51   ` [Qemu-devel] [PATCH v2 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER Yoshiaki Tamura
2010-04-12  8:01   ` Avi Kivity
2010-04-12  8:01     ` [Qemu-devel] " Avi Kivity
2010-04-12  9:39     ` Yoshiaki Tamura
2010-04-12  9:39       ` [Qemu-devel] " Yoshiaki Tamura
2010-04-12 10:17       ` Avi Kivity
2010-04-12 10:17         ` [Qemu-devel] " Avi Kivity
2010-04-06  0:51 ` [PATCH v2 3/6] Modifies wrapper functions for byte-based phys_ram_dirty bitmap to bit-based phys_ram_dirty bitmap Yoshiaki Tamura
2010-04-06  0:51   ` [Qemu-devel] " Yoshiaki Tamura
2010-04-12  8:10   ` Avi Kivity
2010-04-12  8:10     ` [Qemu-devel] " Avi Kivity
2010-04-12 10:58     ` Yoshiaki Tamura
2010-04-12 10:58       ` [Qemu-devel] " Yoshiaki Tamura
2010-04-12 11:09       ` Avi Kivity
2010-04-12 11:09         ` [Qemu-devel] " Avi Kivity
2010-04-13  8:01         ` Yoshiaki Tamura
2010-04-13  8:01           ` [Qemu-devel] " Yoshiaki Tamura
2010-04-13  9:20           ` Avi Kivity
2010-04-13  9:20             ` [Qemu-devel] " Avi Kivity
2010-04-13 10:49             ` Yoshiaki Tamura
2010-04-13 10:49               ` [Qemu-devel] " Yoshiaki Tamura
2010-04-06  0:51 ` [PATCH v2 4/6] Introduce cpu_physical_memory_get_dirty_range() Yoshiaki Tamura
2010-04-06  0:51   ` [Qemu-devel] " Yoshiaki Tamura
2010-04-06  0:51 ` [PATCH v2 5/6] Use cpu_physical_memory_set_dirty_range() to update phys_ram_dirty Yoshiaki Tamura
2010-04-06  0:51   ` [Qemu-devel] " Yoshiaki Tamura
2010-04-06  0:51 ` [PATCH v2 6/6] Use cpu_physical_memory_get_dirty_range() to check multiple dirty pages Yoshiaki Tamura
2010-04-06  0:51   ` [Qemu-devel] " Yoshiaki Tamura

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=1270515084-24120-3-git-send-email-tamura.yoshiaki@lab.ntt.co.jp \
    --to=tamura.yoshiaki@lab.ntt.co.jp \
    --cc=aliguori@us.ibm.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=ohmura.kei@lab.ntt.co.jp \
    --cc=qemu-devel@nongnu.org \
    /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.