From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SExqy-0004vX-Ky for qemu-devel@nongnu.org; Tue, 03 Apr 2012 03:08:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SExqr-0005Mt-5Q for qemu-devel@nongnu.org; Tue, 03 Apr 2012 03:08:32 -0400 Received: from fmmailgate06.web.de ([217.72.192.247]:60461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SExqq-0005Mb-SU for qemu-devel@nongnu.org; Tue, 03 Apr 2012 03:08:25 -0400 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate06.web.de (Postfix) with ESMTP id 7D46D10810C0 for ; Tue, 3 Apr 2012 09:08:22 +0200 (CEST) Message-ID: <4F7AA1E0.2070201@web.de> Date: Tue, 03 Apr 2012 09:08:16 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1333339457-13854-1-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1333339457-13854-1-git-send-email-david@gibson.dropbear.id.au> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig903CC6CC999E86C566E6FBD1" Subject: Re: [Qemu-devel] [PATCH, RESEND] kvm: Fix dirty tracking with large kernel page size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org, Avi Kivity This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig903CC6CC999E86C566E6FBD1 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2012-04-02 06:04, David Gibson wrote: > From: Ben Herrenschmidt >=20 > 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 Tosatti >=20 > Signed-off-by: Benjamin Herrenschmidt > Signed-off-by: David Gibson > --- > kvm-all.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) >=20 > I've sent this a number of times now, the last couple without comment. > It fixes a real bug, please apply. >=20 > 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(MemoryRegi= onSection *section, > unsigned long page_number, c; > target_phys_addr_t addr, addr1; > unsigned int len =3D ((section->size / TARGET_PAGE_SIZE) + HOST_LO= NG_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(MemoryRe= gionSection *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= _SIZE); > + memory_region_set_dirty(section->mr, addr, > + TARGET_PAGE_SIZE * hpratio); > } while (c !=3D 0); > } > } Ack for this, but - as proposed earlier - please add an assert(TARGET_PAGE_SIZE <=3D getpagesize()) + comment to kvm_init(). Also, what's about coalesced MMIO? I see that the ring definition depends on [TARGET_]PAGE_SIZE. What page size does the power kernel use for it, and does it make a relevant difference for space? Jan --------------enig903CC6CC999E86C566E6FBD1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk96oeEACgkQitSsb3rl5xRyzQCgrzi08tU02uvQZ8WKg6wqo4ZQ NJgAn08qbBxi9BlsMInrhavUjRYOoLbw =+uy8 -----END PGP SIGNATURE----- --------------enig903CC6CC999E86C566E6FBD1--