From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA675-0006ZG-3B for qemu-devel@nongnu.org; Mon, 06 Jun 2016 21:47:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bA670-0007OI-3y for qemu-devel@nongnu.org; Mon, 06 Jun 2016 21:47:26 -0400 Date: Tue, 7 Jun 2016 11:40:56 +1000 From: David Gibson Message-ID: <20160607014056.GN9226@voom.fritz.box> References: <1465206768.4274.46.camel@au1.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kUBUi7JBpjcBtem/" Content-Disposition: inline In-Reply-To: <1465206768.4274.46.camel@au1.ibm.com> Subject: Re: [Qemu-devel] [PATCH 2/2] ppc: Fix tlb invalidations on 6xx/7xx/7xxx 32-bit processors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, =?iso-8859-1?Q?C=E9dric?= Le Goater , Mark Cave-Ayland --kUBUi7JBpjcBtem/ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 06, 2016 at 07:52:48PM +1000, Benjamin Herrenschmidt wrote: > The processor only uses some bits of the address and invalidates an > entire congruence class. Some OSes such as Darwin and HelenOS take > advantage of this and occasionally invalidate the entire TLB by just > doing a series of 64 consecutive tlbie for example. >=20 > Our code tries to be too smart here only invalidating a segment > congruence class (ie, allowing more address bits to be relevant > in the invalidation), this fails miserably on those OSes. >=20 > Instead don't bother, do like ppc64 and blow the whole tlb when tlbie > is executed. >=20 > Signed-off-by: Benjamin Herrenschmidt Ugh, this patch too is showing as corrupt for me. I suspect the problem is on my end, but I have no idea what, yet. The concept looks good here, but I don't see much point to keeping the old broken code around under the #if 0. I'll rewite accordingly and merge. > --- > =A0target-ppc/mmu_helper.c | 8 ++++++++ > =A01 file changed, 8 insertions(+) >=20 > diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c > index f5c4e69..a5e3878 100644 > --- a/target-ppc/mmu_helper.c > +++ b/target-ppc/mmu_helper.c > @@ -1969,6 +1969,11 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, targ= et_ulong addr) > =A0=A0=A0=A0=A0=A0=A0=A0=A0/* XXX: this case should be optimized, > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0* giving a mask to tlb_flush_page > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0*/ > +=A0=A0=A0=A0=A0=A0=A0=A0/* This is broken, some CPUs invalidate a whole = congruence > +=A0=A0=A0=A0=A0=A0=A0=A0=A0* class on an even smaller subset of bits and= some OSes take > +=A0=A0=A0=A0=A0=A0=A0=A0=A0* advantage of this. Just blow the whole thin= g away. > +=A0=A0=A0=A0=A0=A0=A0=A0=A0*/ > +#if 0 > =A0=A0=A0=A0=A0=A0=A0=A0=A0tlb_flush_page(cs, addr | (0x0 << 28)); > =A0=A0=A0=A0=A0=A0=A0=A0=A0tlb_flush_page(cs, addr | (0x1 << 28)); > =A0=A0=A0=A0=A0=A0=A0=A0=A0tlb_flush_page(cs, addr | (0x2 << 28)); > @@ -1985,6 +1990,9 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, targe= t_ulong addr) > =A0=A0=A0=A0=A0=A0=A0=A0=A0tlb_flush_page(cs, addr | (0xD << 28)); > =A0=A0=A0=A0=A0=A0=A0=A0=A0tlb_flush_page(cs, addr | (0xE << 28)); > =A0=A0=A0=A0=A0=A0=A0=A0=A0tlb_flush_page(cs, addr | (0xF << 28)); > +#else > +=A0=A0=A0=A0=A0=A0=A0=A0tlb_flush(cs, 1); > +#endif > =A0=A0=A0=A0=A0=A0=A0=A0=A0break; > =A0#if defined(TARGET_PPC64) > =A0=A0=A0=A0=A0case POWERPC_MMU_64B: >=20 >=20 --=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 --kUBUi7JBpjcBtem/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXViYoAAoJEGw4ysog2bOSafsQAKLofbfXZpndBSLjqSNtReHa hHfR7OENIm028dguRBlH2e53qKdJQSPLFA5lywLbr4VPKbWK6eoORogN43uImwLx Vg8uQpVtunLOWWpP0comGP2gtvaIok9EXjmmmDFZaLUKL1cociQWZUAn96m3pR6I CukpLeMYeeaxwEgz9XdseKPWGlnSkB8zcNFBSEeAKXlPfnNzrHDtgaWlnJ24IDt/ /WooYJGNqAfHlbTjPpO6siWKOCdCCZqVVkzYNFPVui2TZYrv8Z2DLzFLwaXao5DX LwdSMsYCbjWsy5FCVdGyR9TcBD9zxC2bwOC9GJjpueJOJaY9r2sVA2N+RbnJPfSG Xr1OF5BJqBpggu/UPsgz47Akbx43W0rkjJ1fMSXrVpK7tqa1PVLymVGOsqpZwp4Z 6A+6zeNjbJNOp3M09Lo/qHG6aFcLENmoOQE+aHGfKk+agx9stVydFUTcAo7ds8sc 85+t9ZMzcck61qKkPW5AJTovFzrHRaSVTNptxwKyKnJTypfJg7ZjWgsMf9HxQKC4 gYQwRq1VaxunJ1ep6NghdvVI/nF2BBLDFlJuatYvXXbGY2qT4Wo/GsKezMfR3ASS P6pFdeA8mUJnxIznzUppCbq06WibQ6PbgWCcehIw/mhyc9y/a3DFS5RmubD/B7A0 ozvuQ0Ktfluqk+G5Ttvp =TOEG -----END PGP SIGNATURE----- --kUBUi7JBpjcBtem/--