[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/34] add a version number to ram_list
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 09/34] add a version number to ram_list |
Date: |
Wed, 19 Dec 2012 13:33:32 +0100 |
From: Umesh Deshpande <address@hidden>
This will be used to detect if last_block might have become invalid
across different calls to ram_save_live.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Umesh Deshpande <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Orit Wasserman <address@hidden>
---
arch_init.c | 7 ++++++-
cpu-all.h | 1 +
exec.c | 4 ++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch_init.c b/arch_init.c
index 8b5980f..136d0e8 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -336,6 +336,7 @@ static RAMBlock *last_block;
static ram_addr_t last_offset;
static unsigned long *migration_bitmap;
static uint64_t migration_dirty_pages;
+static uint32_t last_version;
static inline bool migration_bitmap_test_and_reset_dirty(MemoryRegion *mr,
ram_addr_t offset)
@@ -406,7 +407,6 @@ static void migration_bitmap_sync(void)
}
}
-
/*
* ram_save_block: Writes a page of memory to the stream f
*
@@ -533,6 +533,7 @@ static void reset_ram_globals(void)
{
last_block = NULL;
last_offset = 0;
+ last_version = ram_list.version;
}
#define MAX_WAIT 50 /* ms, half buffered_file limit */
@@ -587,6 +588,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
uint64_t expected_downtime;
MigrationState *s = migrate_get_current();
+ if (ram_list.version != last_version) {
+ reset_ram_globals();
+ }
+
bytes_transferred_last = bytes_transferred;
bwidth = qemu_get_clock_ns(rt_clock);
diff --git a/cpu-all.h b/cpu-all.h
index cd61320..c69d602 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -497,6 +497,7 @@ typedef struct RAMList {
uint8_t *phys_dirty;
RAMBlock *mru_block;
QTAILQ_HEAD(, RAMBlock) blocks;
+ uint32_t version;
} RAMList;
extern RAMList ram_list;
diff --git a/exec.c b/exec.c
index 5f501d4..4474d60 100644
--- a/exec.c
+++ b/exec.c
@@ -1055,6 +1055,8 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void
*host,
}
ram_list.mru_block = NULL;
+ ram_list.version++;
+
ram_list.phys_dirty = g_realloc(ram_list.phys_dirty,
last_ram_offset() >> TARGET_PAGE_BITS);
memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS),
@@ -1083,6 +1085,7 @@ void qemu_ram_free_from_ptr(ram_addr_t addr)
if (addr == block->offset) {
QTAILQ_REMOVE(&ram_list.blocks, block, next);
ram_list.mru_block = NULL;
+ ram_list.version++;
g_free(block);
return;
}
@@ -1097,6 +1100,7 @@ void qemu_ram_free(ram_addr_t addr)
if (addr == block->offset) {
QTAILQ_REMOVE(&ram_list.blocks, block, next);
ram_list.mru_block = NULL;
+ ram_list.version++;
if (block->flags & RAM_PREALLOC_MASK) {
;
} else if (mem_path) {
--
1.7.11.7
- [Qemu-devel] [PATCH 00/34] migration thread and queue, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 01/34] migration: fix migration_bitmap leak, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 02/34] buffered_file: do not send more than s->bytes_xfer bytes per tick, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 03/34] migration: remove double call to migrate_fd_close, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 04/34] migration: include qemu-file.h, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 05/34] migration-fd: remove duplicate include, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 07/34] exec: change RAM list to a TAILQ, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 06/34] exec: change ramlist from MRU order to a 1-item cache, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 09/34] add a version number to ram_list,
Juan Quintela <=
- [Qemu-devel] [PATCH 08/34] exec: sort the memory from biggest to smallest, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 11/34] buffered_file: Move from using a timer to use a thread, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 10/34] protect the ramlist with a separate mutex, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 13/34] migration: move migration thread init code to migrate_fd_put_ready, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 16/34] migration: just lock migrate_fd_put_ready, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 15/34] migration: remove unfreeze logic, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 14/34] migration: make writes blocking, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 18/34] buffered_file: don't flush on put buffer, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 17/34] buffered_file: Unfold the trick to restart generating migration data, Juan Quintela, 2012/12/19
- [Qemu-devel] [PATCH 22/34] migration: add XFER_LIMIT_RATIO, Juan Quintela, 2012/12/19