From: Glauber Costa <glommer@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>, aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH] RFC: use logging count for individual regions
Date: Fri, 24 Jul 2009 16:40:05 -0400 [thread overview]
Message-ID: <1248468005-13907-1-git-send-email-glommer@redhat.com> (raw)
qemu-kvm use this scheme of logging count of individual regions,
which is, IMHO, more flexible which the one we have right now.
I'm proposing we use it.
Anthony, please don't apply this patch yet, as I would want it
to receive proper testing, and FYI, current migration broken ;(
- and I don't really have time to go debug it now.
Jan: Please let me know what you think of it.
Thanks!
Signed-off-by: Glauber Costa <glommer@redhat.com>
CC: Jan Kiszka <jan.kiszka@siemens.com>
---
kvm-all.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 8567ac9..7d942c8 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -46,6 +46,7 @@ typedef struct KVMSlot
ram_addr_t phys_offset;
int slot;
int flags;
+ uint32_t logging_count;
} KVMSlot;
typedef struct kvm_dirty_log KVMDirtyLog;
@@ -59,7 +60,6 @@ struct KVMState
int vmfd;
int coalesced_mmio;
int broken_set_mem_region;
- int migration_log;
#ifdef KVM_CAP_SET_GUEST_DEBUG
struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
#endif
@@ -137,9 +137,7 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
mem.memory_size = slot->memory_size;
mem.userspace_addr = (unsigned long)qemu_get_ram_ptr(slot->phys_offset);
mem.flags = slot->flags;
- if (s->migration_log) {
- mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
- }
+
return kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem);
}
@@ -230,15 +228,22 @@ static int kvm_dirty_pages_log_change(target_phys_addr_t phys_addr,
return -EINVAL;
}
+ if (flags & KVM_MEM_LOG_DIRTY_PAGES) {
+ if (mem->logging_count++) {
+ return 0;
+ }
+ } else {
+ if (--mem->logging_count) {
+ return 0;
+ }
+ }
+
old_flags = mem->flags;
flags = (mem->flags & ~mask) | flags;
mem->flags = flags;
/* If nothing changed effectively, no need to issue ioctl */
- if (s->migration_log) {
- flags |= KVM_MEM_LOG_DIRTY_PAGES;
- }
if (flags == old_flags) {
return 0;
}
@@ -266,8 +271,6 @@ int kvm_set_migration_log(int enable)
KVMSlot *mem;
int i, err;
- s->migration_log = enable;
-
for (i = 0; i < ARRAY_SIZE(s->slots); i++) {
mem = &s->slots[i];
--
1.6.2.2
next reply other threads:[~2009-07-24 20:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-24 20:40 Glauber Costa [this message]
2009-07-25 9:28 ` [Qemu-devel] Re: [PATCH] RFC: use logging count for individual regions Jan Kiszka
2009-07-28 1:08 ` Glauber Costa
2009-07-28 6:36 ` Avi Kivity
2009-07-28 6:50 ` Jan Kiszka
2009-07-28 6:59 ` Avi Kivity
2009-07-28 7:01 ` Jan Kiszka
2009-07-28 6:48 ` Jan Kiszka
2009-07-27 13:17 ` Anthony Liguori
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=1248468005-13907-1-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=jan.kiszka@siemens.com \
--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 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).