From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyCYi-0007mb-Cg for qemu-devel@nongnu.org; Mon, 16 Nov 2015 00:42:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyCYg-0007sB-II for qemu-devel@nongnu.org; Mon, 16 Nov 2015 00:42:32 -0500 Date: Mon, 16 Nov 2015 16:40:18 +1100 From: David Gibson Message-ID: <20151116054018.GI2747@voom.fritz.box> References: <1447201710-10229-1-git-send-email-benh@kernel.crashing.org> <1447201710-10229-17-git-send-email-benh@kernel.crashing.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nO3oAMapP4dBpMZi" Content-Disposition: inline In-Reply-To: <1447201710-10229-17-git-send-email-benh@kernel.crashing.org> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 16/77] ppc: Get out of emulation on SMT "OR" ops List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --nO3oAMapP4dBpMZi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 11, 2015 at 11:27:29AM +1100, Benjamin Herrenschmidt wrote: > Otherwise tight loops at smt_low for example, which OPAL does, > eat so much CPU that we can't boot a kernel anymore. With that, > I can boot 8 CPUs just fine with powernv. >=20 > Signed-off-by: Benjamin Herrenschmidt Reviewed-by: David Gibson > --- > target-ppc/translate.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) >=20 > diff --git a/target-ppc/translate.c b/target-ppc/translate.c > index 3974cd2..e8bbd59 100644 > --- a/target-ppc/translate.c > +++ b/target-ppc/translate.c > @@ -1396,6 +1396,19 @@ GEN_LOGICAL2(nand, tcg_gen_nand_tl, 0x0E, PPC_INTE= GER); > /* nor & nor. */ > GEN_LOGICAL2(nor, tcg_gen_nor_tl, 0x03, PPC_INTEGER); > =20 > +#if defined(TARGET_PPC64) > +static void gen_pause(DisasContext *ctx) > +{ > + TCGv_i32 t0 =3D tcg_const_i32(0); > + tcg_gen_st_i32(t0, cpu_env, > + -offsetof(PowerPCCPU, env) + offsetof(CPUState, halte= d)); > + tcg_temp_free_i32(t0); > + > + /* Stop translation, this gives other CPUs a chance to run */ > + gen_exception_err(ctx, EXCP_HLT, 1); > +} > +#endif /* defined(TARGET_PPC64) */ > + > /* or & or. */ > static void gen_or(DisasContext *ctx) > { > @@ -1468,6 +1481,10 @@ static void gen_or(DisasContext *ctx) > tcg_gen_ori_tl(t0, t0, ((uint64_t)prio) << 50); > gen_store_spr(SPR_PPR, t0); > tcg_temp_free(t0); > + /* Pause us out of TCG otherwise spin loops with smt_low > + * eat too much CPU and the kernel hangs > + */ > + gen_pause(ctx); > } > #endif > } > @@ -1493,8 +1510,6 @@ static void gen_ori(DisasContext *ctx) > target_ulong uimm =3D UIMM(ctx->opcode); > =20 > if (rS(ctx->opcode) =3D=3D rA(ctx->opcode) && uimm =3D=3D 0) { > - /* NOP */ > - /* XXX: should handle special NOPs for POWER series */ > return; > } > tcg_gen_ori_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], u= imm); --=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 --nO3oAMapP4dBpMZi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWSWxCAAoJEGw4ysog2bOSb+QP/RgVenoiSxh6iDkFAbCfPH8d rpbj09O5CUxEzLi2i2CP1TrN+REBm/3WAtfKS6XH0fkji9hS8v4UeqnMjZD4ixFa RR0ufNI9pfnFuxPOtmm+qzYV7pHifXWuyZSfrEMAgYe2KtI25SWmBiZwMvElertb SDPq85dafRi6SxbXWZkTXhmtqUNt3iwjbOmB1w/uANRFzbYDJAnndW1/vuiuRxia y7ELSedPVY1beqNX5ABjNYPNzG/4JoJT+KzVBPKY/fbkmp8S/F1YzEIBPnvLaf27 D3+CUhX3AIFduqJTjU703ajpYjfUlGDr6Zb3CtNgZfO7NT+4F12ysbB1KZqhtJY4 q4tOJXotU1AyGsTLnbdsVormj6EUx5FCVM4IdyETOsGjrjROIOJLOWOksja2UKY+ RRNC9lxemuu0IrJNh9tBssBO9HUcq/Da9lCgIVbDugHu2+PpV6SmWkxUAXsUaITJ +fa3rgTFZ2ymcVG4eApi+9clCEBmEdXkuYNjxYC5X71j3kBtF6CeD5G5FG+QmQsC Xfmnz8dq8NiIlEDD/nGIS10MrYWOfgKnMybJDxIFTB6pp0XQvwonJwKRQqib4gQM LAqVoie4JP+bPA7njQ+NiWk7OZUVXooa/+PYKI6mOB/IdQsgYrL8T/gDKHEqjHrf Ni8QgxjQfbTS3PtIosMs =TCu1 -----END PGP SIGNATURE----- --nO3oAMapP4dBpMZi--