From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD16a-00053d-A3 for qemu-devel@nongnu.org; Tue, 14 Jun 2016 23:03:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bD16X-0003IN-SY for qemu-devel@nongnu.org; Tue, 14 Jun 2016 23:02:59 -0400 Date: Wed, 15 Jun 2016 11:57:48 +1000 From: David Gibson Message-ID: <20160615015748.GC4882@voom.fritz.box> References: <1465795496-15071-1-git-send-email-clg@kaod.org> <1465795496-15071-10-git-send-email-clg@kaod.org> <575E6443.5060005@redhat.com> <575E7088.9010900@kaod.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/+TVfO13bGamJ+u9" Content-Disposition: inline In-Reply-To: <575E7088.9010900@kaod.org> Subject: Re: [Qemu-devel] [PATCH 09/10] ppc: Move exception generation code out of line List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: Thomas Huth , qemu-ppc@nongnu.org, qemu-devel@nongnu.org --/+TVfO13bGamJ+u9 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 13, 2016 at 10:36:24AM +0200, C=E9dric Le Goater wrote: > On 06/13/2016 09:44 AM, Thomas Huth wrote: > > On 13.06.2016 07:24, C=E9dric Le Goater wrote: > >> From: Benjamin Herrenschmidt > >> > >> There's no point inlining this, if you hit the exception case you exit > >> anyway, and not inlining saves about 100K of code size (and cache > >> footprint). > >> > >> Signed-off-by: Benjamin Herrenschmidt > >> --- > >> target-ppc/translate.c | 9 ++++++--- > >> 1 file changed, 6 insertions(+), 3 deletions(-) > >> > >> diff --git a/target-ppc/translate.c b/target-ppc/translate.c > >> index f211d175c09c..600d5db2bb9a 100644 > >> --- a/target-ppc/translate.c > >> +++ b/target-ppc/translate.c > >> @@ -283,7 +283,8 @@ void gen_update_current_nip(void *opaque) > >> tcg_gen_movi_tl(cpu_nip, ctx->nip); > >> } > >> =20 > >> -static inline void gen_exception_err(DisasContext *ctx, uint32_t excp= , uint32_t error) > >> +static void __attribute__((noinline)) > >> +gen_exception_err(DisasContext *ctx, uint32_t excp, uint32_t error) > >> { > >> TCGv_i32 t0, t1; > >> if (ctx->exception =3D=3D POWERPC_EXCP_NONE) { > >> @@ -297,7 +298,8 @@ static inline void gen_exception_err(DisasContext = *ctx, uint32_t excp, uint32_t > >> ctx->exception =3D (excp); > >> } > >> =20 > >> -static inline void gen_exception(DisasContext *ctx, uint32_t excp) > >> +static void __attribute__((noinline)) > >> +gen_exception(DisasContext *ctx, uint32_t excp) > >> { > >> TCGv_i32 t0; > >> if (ctx->exception =3D=3D POWERPC_EXCP_NONE) { > >> @@ -309,7 +311,8 @@ static inline void gen_exception(DisasContext *ctx= , uint32_t excp) > >> ctx->exception =3D (excp); > >> } > >> =20 > >> -static inline void gen_debug_exception(DisasContext *ctx) > >> +static void __attribute__((noinline)) > >> +gen_debug_exception(DisasContext *ctx) > >> { > >> TCGv_i32 t0; > >=20 > > Do you get the same results if you just remove the "inline" keyword, > > without adding the "__attribute__((noinline))" ? If yes, I'd suggest to > > do this patch without the "__attribute__((noinline))" - that's easier to > > read, and the compiler can still decide to inline something in case it's > > better one a certain architecture. >=20 > Yes. They are no differences.=20 >=20 > The interesting part though is that the .text is about the same size.=20 > There is even a slight increase of ~2K with gcc 4.9.2 (intel host) and=20 > a slight decrease of ~1K with gcc 5.3.1 (ppc64le host). >=20 > I guess we can just drop that patch. It does not seem to bring much. I would prefer to see the inline keyword removed. Except in the case of tiny header functions, it's very rarely a good idea - usually the compiler will have better information on whether to inline or not. --=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 --/+TVfO13bGamJ+u9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXYLYcAAoJEGw4ysog2bOSMr4QAN64o+IU16gAnvfLsrUHX+UX +2Ic5uM82i/mxW1h9zrKb0DEMMGg1DbSD8dPcUe4scSyFXCIdN3pq+WERXABC4fw lrMAMS6U0EJx8oy4Lqbl7Qn1sHgdL+l0aHvLPMSfttxDfjU0EfIXohKPmGNzsFwv GoYgcBeboguPmDERp0CczXUgQ3t2MjjJfOBW+qfH/p3ZT/fQ0km8wHZieuH2bU1h 9eyCLuSzktCCLYPyDigbFjl6pykRxYqo3Zg8SzuJxaV88otVfJE0ZARNK0aKvkTm zbHYOGXPfLTttjYRG3ahZ9fslkt0U/Ysmi9dXih2RdmrWLWViBud5CoA8jyzI1Ms r2sZRt58kIPmH2Pnhq2wHWMELHyaiVe2k3OJ6/OSV8eUyG/kjRoBVsVg2kyYPTTq mDTbG9ep5h/J4hgaByjsAvsIXcpMqB/HhshLOQcQCML5xXxk4krjQ/E4LPC0HQ+K Z7V0M88UqIzpknF+g6eBaIYtZC8CIgHswiYkPp5p7nclG7NQIYGpPZVPBv9Q55AJ 2mCN96/xeDdS8v0ooQZPYZJQfG0mULAKl+LNnNR84TvHn8yfoEKvyaKvEWOBIs1S c/k9nKHoh+aTh8oRu+n6xbVT5gWzGF9a9iR9DlYn4fAtoYtmMA+YVdQHfoD2YaIb iIfbVS4qWTdO1m1P1wfP =RJ11 -----END PGP SIGNATURE----- --/+TVfO13bGamJ+u9--