[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA,
From: |
Yoshiaki Tamura |
Subject: |
[Qemu-devel] [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER. |
Date: |
Mon, 19 Apr 2010 18:43:14 +0900 |
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 <address@hidden>
---
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)) {
+ 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;
diff --git a/qemu-common.h b/qemu-common.h
index 4ba0cda..efe5b1f 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -285,6 +285,9 @@ static inline uint8_t from_bcd(uint8_t val)
return ((val >> 4) * 10) + (val & 0x0f);
}
+#define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1))
+#define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS) / 8)
+
#include "module.h"
#endif /* dyngen-exec.h hack */
--
1.7.0.31.g1df487
- [Qemu-devel] [PATCH v3 0/6] Introduce bit-based phys_ram_dirty, and bit-based dirty page checker., Yoshiaki Tamura, 2010/04/19
- [Qemu-devel] [PATCH v3 6/6] Use cpu_physical_memory_get_dirty_range() to check multiple dirty pages., Yoshiaki Tamura, 2010/04/19
- [Qemu-devel] [PATCH v3 3/6] Modifies wrapper functions for byte-based phys_ram_dirty bitmap to bit-based phys_ram_dirty bitmap., Yoshiaki Tamura, 2010/04/19
- [Qemu-devel] [PATCH v3 1/6] Modify DIRTY_FLAG value and DIRTY_IDX introduce to use as indexes of bit-based phys_ram_dirty., Yoshiaki Tamura, 2010/04/19
- [Qemu-devel] [PATCH v3 4/6] Introduce cpu_physical_memory_get_dirty_range()., Yoshiaki Tamura, 2010/04/19
- [Qemu-devel] [PATCH v3 5/6] Use cpu_physical_memory_set_dirty_range() to update phys_ram_dirty., Yoshiaki Tamura, 2010/04/19
- [Qemu-devel] [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER.,
Yoshiaki Tamura <=
- [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER., Avi Kivity, 2010/04/19
- [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER., Yoshiaki Tamura, 2010/04/19
- Re: [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER., Yoshiaki Tamura, 2010/04/19
- Re: [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER., Avi Kivity, 2010/04/19
- Re: [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER., Yoshiaki Tamura, 2010/04/19
- Re: [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER., Avi Kivity, 2010/04/19
- Re: [Qemu-devel] Re: [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER., Yoshiaki Tamura, 2010/04/19
[Qemu-devel] Re: [PATCH v3 0/6] Introduce bit-based phys_ram_dirty, and bit-based dirty page checker., Avi Kivity, 2010/04/19