From: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH 1/6] split dirty bitmap into four for dumping the bitmaps
Date: Tue, 20 May 2014 23:17:50 +0530 [thread overview]
Message-ID: <1400608075-19917-2-git-send-email-sanidhya.iiith@gmail.com> (raw)
In-Reply-To: <1400608075-19917-1-git-send-email-sanidhya.iiith@gmail.com>
Added another flag - DIRTY_MEMORY_LOG_BITMAP for the purpose of logging
the dirty bitmap. The dumping bitmap process will utilize this flag for
dumping the data in the file.
Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
exec.c | 4 ++++
include/exec/memory.h | 3 ++-
include/exec/ram_addr.h | 16 +++++++++++++++-
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/exec.c b/exec.c
index 4e179a6..658196c 100644
--- a/exec.c
+++ b/exec.c
@@ -1551,6 +1551,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
}
cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_MIGRATION);
cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_VGA);
+ cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_LOG_BITMAP);
/* we remove the notdirty callback only if the code has been
flushed */
if (!cpu_physical_memory_is_clean(ram_addr)) {
@@ -1959,6 +1960,7 @@ static void invalidate_and_set_dirty(hwaddr addr,
/* set dirty bit */
cpu_physical_memory_set_dirty_flag(addr, DIRTY_MEMORY_VGA);
cpu_physical_memory_set_dirty_flag(addr, DIRTY_MEMORY_MIGRATION);
+ cpu_physical_memory_set_dirty_flag(addr, DIRTY_MEMORY_LOG_BITMAP);
}
xen_modified_memory(addr, length);
}
@@ -2563,6 +2565,8 @@ void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val)
cpu_physical_memory_set_dirty_flag(addr1,
DIRTY_MEMORY_MIGRATION);
cpu_physical_memory_set_dirty_flag(addr1, DIRTY_MEMORY_VGA);
+ cpu_physical_memory_set_dirty_flag(addr1,
+ DIRTY_MEMORY_LOG_BITMAP);
}
}
}
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 1d55ad9..3f24563 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -19,7 +19,8 @@
#define DIRTY_MEMORY_VGA 0
#define DIRTY_MEMORY_CODE 1
#define DIRTY_MEMORY_MIGRATION 2
-#define DIRTY_MEMORY_NUM 3 /* num of dirty bits */
+#define DIRTY_MEMORY_LOG_BITMAP 3
+#define DIRTY_MEMORY_NUM 4 /* num of dirty bits */
#include <stdint.h>
#include <stdbool.h>
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index 2edfa96..f1ca86f 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -56,7 +56,10 @@ static inline bool cpu_physical_memory_is_clean(ram_addr_t addr)
bool code = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_CODE);
bool migration =
cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_MIGRATION);
- return !(vga && code && migration);
+ bool bitmap_log =
+ cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_LOG_BITMAP);
+
+ return !(vga && code && migration && bitmap_log);
}
static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr,
@@ -66,6 +69,13 @@ static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr,
set_bit(addr >> TARGET_PAGE_BITS, ram_list.dirty_memory[client]);
}
+static inline void cpu_physical_memory_clear_dirty_flag(ram_addr_t addr,
+ unsigned client)
+{
+ assert(client < DIRTY_MEMORY_NUM);
+ clear_bit(addr >> TARGET_PAGE_BITS, ram_list.dirty_memory[client]);
+}
+
static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
ram_addr_t length)
{
@@ -76,6 +86,8 @@ static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
bitmap_set(ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION], page, end - page);
bitmap_set(ram_list.dirty_memory[DIRTY_MEMORY_VGA], page, end - page);
bitmap_set(ram_list.dirty_memory[DIRTY_MEMORY_CODE], page, end - page);
+ bitmap_set(ram_list.dirty_memory[DIRTY_MEMORY_LOG_BITMAP], page,
+ end - page);
xen_modified_memory(start, length);
}
@@ -105,6 +117,8 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION][page + k] |= temp;
ram_list.dirty_memory[DIRTY_MEMORY_VGA][page + k] |= temp;
ram_list.dirty_memory[DIRTY_MEMORY_CODE][page + k] |= temp;
+ ram_list.dirty_memory[DIRTY_MEMORY_LOG_BITMAP][page + k] |=
+ temp;
}
}
xen_modified_memory(start, pages);
--
1.8.3.1
next prev parent reply other threads:[~2014-05-20 17:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 17:47 [Qemu-devel] [PATCH 0/6] Obtain dirty bitmap via VM logging Sanidhya Kashyap
2014-05-20 17:47 ` Sanidhya Kashyap [this message]
2014-05-20 17:47 ` [Qemu-devel] [PATCH 2/6] bitmap dump code via QAPI framework Sanidhya Kashyap
2014-05-20 19:03 ` Eric Blake
2014-05-20 19:25 ` Sanidhya Kashyap
2014-05-20 17:47 ` [Qemu-devel] [PATCH 3/6] hmp interface for dirty bitmap dump Sanidhya Kashyap
2014-05-20 17:47 ` [Qemu-devel] [PATCH 4/6] cancel mechanism for an already running dump bitmap process Sanidhya Kashyap
2014-05-20 19:34 ` Eric Blake
2014-05-20 17:47 ` [Qemu-devel] [PATCH 5/6] set the frequency of the " Sanidhya Kashyap
2014-05-20 19:36 ` Eric Blake
2014-05-20 17:47 ` [Qemu-devel] [PATCH 6/6] python script for extracting bitmap from a binary file Sanidhya Kashyap
2014-05-20 19:38 ` Eric Blake
2014-05-20 19:39 ` Eric Blake
2014-05-21 0:43 ` Sanidhya Kashyap
2014-05-21 4:13 ` [Qemu-devel] [PATCH 0/6] Obtain dirty bitmap via VM logging ChenLiang
2014-05-21 4:56 ` Sanidhya Kashyap
2014-05-21 6:45 ` ChenLiang
2014-05-21 6:55 ` Sanidhya Kashyap
2014-05-22 11:21 ` Sanidhya Kashyap
2014-05-22 12:57 ` ChenLiang
2014-05-23 2:30 ` Sanidhya Kashyap
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=1400608075-19917-2-git-send-email-sanidhya.iiith@gmail.com \
--to=sanidhya.iiith@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).