From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFEpw-0005Q7-6J for qemu-devel@nongnu.org; Tue, 03 Apr 2012 21:16:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SFEpu-0007AW-1n for qemu-devel@nongnu.org; Tue, 03 Apr 2012 21:16:35 -0400 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:54672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFEpt-0007A5-GD for qemu-devel@nongnu.org; Tue, 03 Apr 2012 21:16:33 -0400 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Apr 2012 01:11:51 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3419iU43596342 for ; Wed, 4 Apr 2012 11:09:51 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q341G1ws027697 for ; Wed, 4 Apr 2012 11:16:01 +1000 Date: Wed, 4 Apr 2012 11:12:38 +1000 From: David Gibson Message-ID: <20120404011238.GC17423@truffala.fritz.box> References: <1333339457-13854-1-git-send-email-david@gibson.dropbear.id.au> <4F7AA1E0.2070201@web.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: <4F7AA1E0.2070201@web.de> 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: Jan Kiszka Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org, Avi Kivity --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 03, 2012 at 09:08:16AM +0200, Jan Kiszka wrote: > 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); > > } > > } >=20 > Ack for this, but - as proposed earlier - please add an > assert(TARGET_PAGE_SIZE <=3D getpagesize()) + comment to kvm_init(). Ok. > 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? Hr, so the HV variant of Power KVM doesn't do coalesced mmio. The PR variant does, but I don't know enough about it to easily answer that. If there's a bug there, it hasn't bitten yet, so how about we fix that another day. --=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 --huq684BweRXVnRxX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAk97oAYACgkQaILKxv3ab8ZTUwCdFlFtq1mUIgw2IL0ZeOGvK/qT RiYAnA3+5nw7nmoeGuUSdRbMHduMLJpY =s1kU -----END PGP SIGNATURE----- --huq684BweRXVnRxX--