From: David Gibson <david@gibson.dropbear.id.au>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Marcelo Tossatti <mtosatti@redhat.com>,
avi@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] kvm: Fix dirty tracking with large kernel page size
Date: Tue, 20 Mar 2012 11:26:52 +1100 [thread overview]
Message-ID: <20120320002652.GA22089@truffala.fritz.box> (raw)
In-Reply-To: <4F671001.7010909@suse.de>
On Mon, Mar 19, 2012 at 11:52:49AM +0100, Andreas Färber wrote:
> Am 19.03.2012 05:57, schrieb David Gibson:
> > If the kernel page size is larger than TARGET_PAGE_SIZE, which
> > happens for example on ppc64 with kernels compiled for 64K pages,
> > the dirty tracking doesn't work.
> >
> > Cc: Avi Kivity <avi@redhat.com>
> > Cc: Marcelo Tossatti <mtosatti@redhat.com>
> >
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > kvm-all.c | 8 +++++---
> > 1 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/kvm-all.c b/kvm-all.c
> > index ba2cee1..47adc97 100644
> > --- a/kvm-all.c
> > +++ b/kvm-all.c
> > @@ -350,10 +350,11 @@ static int kvm_set_migration_log(int enable)
> > static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
> > unsigned long *bitmap)
> > {
> > - unsigned int i, j;
> > + unsigned int i, j;
>
> Unintentional change?
Gah, yes, oops. Corrected version below.
>From 55bd7c4811415c3b1a4825c4907f56117243836b Mon Sep 17 00:00:00 2001
From: Ben Herrenschmidt <benh@kernel.crashing.org>
Date: Tue, 20 Mar 2012 11:22:16 +1100
Subject: [PATCH] kvm: Fix dirty tracking with large kernel page size
If the kernel page size is larger than TARGET_PAGE_SIZE, which
happens for example on ppc64 with kernels compiled for 64K pages,
the dirty tracking doesn't work.
Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tossatti <mtosatti@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
kvm-all.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index ba2cee1..7e44429 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -354,6 +354,7 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
unsigned long page_number, c;
target_phys_addr_t addr, addr1;
unsigned int len = ((section->size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
+ unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
/*
* bitmap-traveling is faster than memory-traveling (for addr...)
@@ -365,10 +366,11 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
do {
j = ffsl(c) - 1;
c &= ~(1ul << j);
- page_number = i * HOST_LONG_BITS + j;
+ page_number = (i * HOST_LONG_BITS + j) * hpratio;
addr1 = page_number * TARGET_PAGE_SIZE;
addr = section->offset_within_region + addr1;
- memory_region_set_dirty(section->mr, addr, TARGET_PAGE_SIZE);
+ memory_region_set_dirty(section->mr, addr,
+ TARGET_PAGE_SIZE * hpratio);
} while (c != 0);
}
}
--
1.7.9.1
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
prev parent reply other threads:[~2012-03-20 1:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 4:57 [Qemu-devel] [PATCH] kvm: Fix dirty tracking with large kernel page size David Gibson
2012-03-19 10:52 ` Andreas Färber
2012-03-20 0:26 ` David Gibson [this message]
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=20120320002652.GA22089@truffala.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=afaerber@suse.de \
--cc=avi@redhat.com \
--cc=mtosatti@redhat.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).