[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/35] memory: introduce memory_region_test_and_clea
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 26/35] memory: introduce memory_region_test_and_clear_dirty |
Date: |
Tue, 11 Dec 2012 13:47:02 +0100 |
This function avoids having to do two calls, one to test the dirty bit, and
other to reset it.
Signed-off-by: Juan Quintela <address@hidden>
---
memory.c | 16 ++++++++++++++++
memory.h | 16 ++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/memory.c b/memory.c
index 7419853..c72a5e2 100644
--- a/memory.c
+++ b/memory.c
@@ -1081,6 +1081,22 @@ void memory_region_set_dirty(MemoryRegion *mr, hwaddr
addr,
return cpu_physical_memory_set_dirty_range(mr->ram_addr + addr, size, -1);
}
+bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
+ hwaddr size, unsigned client)
+{
+ bool ret;
+ assert(mr->terminates);
+ ret = cpu_physical_memory_get_dirty(mr->ram_addr + addr, size,
+ 1 << client);
+ if (ret) {
+ cpu_physical_memory_reset_dirty(mr->ram_addr + addr,
+ mr->ram_addr + addr + size,
+ 1 << client);
+ }
+ return ret;
+}
+
+
void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
{
AddressSpace *as;
diff --git a/memory.h b/memory.h
index 9462bfd..bc63a87 100644
--- a/memory.h
+++ b/memory.h
@@ -454,6 +454,22 @@ void memory_region_set_dirty(MemoryRegion *mr, hwaddr addr,
hwaddr size);
/**
+ * memory_region_test_and_clear_dirty: Check whether a range of bytes is dirty
+ * for a specified client. It clears them.
+ *
+ * Checks whether a range of bytes has been written to since the last
+ * call to memory_region_reset_dirty() with the same @client. Dirty logging
+ * must be enabled.
+ *
+ * @mr: the memory region being queried.
+ * @addr: the address (relative to the start of the region) being queried.
+ * @size: the size of the range being queried.
+ * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
+ * %DIRTY_MEMORY_VGA.
+ */
+bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
+ hwaddr size, unsigned client);
+/**
* memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
* any external TLBs (e.g. kvm)
*
--
1.7.11.7
- [Qemu-devel] [PATCH 23/35] migration: unfold rest of migrate_fd_put_ready() into thread, (continued)
- [Qemu-devel] [PATCH 23/35] migration: unfold rest of migrate_fd_put_ready() into thread, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 17/35] migration: move migration_fd_put_ready(), Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 16/35] migration: move buffered_file.c code into migration.c, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 22/35] migration: move exit condition to migration thread, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 28/35] migration: Only go to the iterate stage if there is anything to send, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 20/35] migration: move begining stage to the migration thread, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 19/35] migration: move migration notifier, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 25/35] ram: Add last_sent_block, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 21/35] migration: Add buffered_flush error handling, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 27/35] ram: Use memory_region_test_and_clear_dirty, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 26/35] memory: introduce memory_region_test_and_clear_dirty,
Juan Quintela <=
- [Qemu-devel] [PATCH 24/35] ram: rename last_block to last_seen_block, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 35/35] migration: print times for end phase, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 32/35] ram: add free_space parameter to save_live functions, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 30/35] ram: account the amount of transferred ram better, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 29/35] ram: optimize migration bitmap walking, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 31/35] ram: refactor ram_save_block() return value, Juan Quintela, 2012/12/11
- [Qemu-devel] [PATCH 34/35] ram: reuse ram_save_iterate() for the complete stage, Juan Quintela, 2012/12/11
- Re: [Qemu-devel] [PATCH 00/35] Migration thread (20121211), Paolo Bonzini, 2012/12/11
- [Qemu-devel] [PATCH 33/35] ram: remove xbrle last_stage optimization, Juan Quintela, 2012/12/11