From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9oKt-0002He-98 for qemu-devel@nongnu.org; Mon, 19 Mar 2012 21:58:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9oKp-0008PT-3F for qemu-devel@nongnu.org; Mon, 19 Mar 2012 21:58:06 -0400 Received: from ozlabs.org ([203.10.76.45]:39942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9oKo-0008P9-Fh for qemu-devel@nongnu.org; Mon, 19 Mar 2012 21:58:03 -0400 Date: Tue, 20 Mar 2012 11:26:52 +1100 From: David Gibson Message-ID: <20120320002652.GA22089@truffala.fritz.box> References: <1332133047-7672-1-git-send-email-david@gibson.dropbear.id.au> <4F671001.7010909@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <4F671001.7010909@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] kvm: Fix dirty tracking with large kernel page size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Marcelo Tossatti , avi@redhat.com, qemu-devel@nongnu.org On Mon, Mar 19, 2012 at 11:52:49AM +0100, Andreas F=E4rber 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. > >=20 > > Cc: Avi Kivity > > Cc: Marcelo Tossatti > >=20 > > Signed-off-by: Benjamin Herrenschmidt > > Signed-off-by: David Gibson > > --- > > kvm-all.c | 8 +++++--- > > 1 files changed, 5 insertions(+), 3 deletions(-) > >=20 > > 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 *sectio= n, > > unsigned long *bitmap) > > { > > - unsigned int i, j; > > + unsigned int i, j; >=20 > Unintentional change? Gah, yes, oops. Corrected version below. >>From 55bd7c4811415c3b1a4825c4907f56117243836b Mon Sep 17 00:00:00 2001 From: Ben Herrenschmidt 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 Cc: Marcelo Tossatti Signed-off-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- 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(MemoryRegion= Section *section, unsigned long page_number, c; target_phys_addr_t addr, addr1; unsigned int len =3D ((section->size / TARGET_PAGE_SIZE) + HOST_LONG= _BITS - 1) / HOST_LONG_BITS; + unsigned long hpratio =3D getpagesize() / TARGET_PAGE_SIZE; =20 /* * bitmap-traveling is faster than memory-traveling (for addr...) @@ -365,10 +366,11 @@ static int kvm_get_dirty_pages_log_range(MemoryRegi= onSection *section, do { j =3D ffsl(c) - 1; c &=3D ~(1ul << j); - page_number =3D i * HOST_LONG_BITS + j; + page_number =3D (i * HOST_LONG_BITS + j) * hpratio; addr1 =3D page_number * TARGET_PAGE_SIZE; addr =3D section->offset_within_region + addr1; - memory_region_set_dirty(section->mr, addr, TARGET_PAGE_S= IZE); + memory_region_set_dirty(section->mr, addr, + TARGET_PAGE_SIZE * hpratio); } while (c !=3D 0); } } --=20 1.7.9.1 --=20 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