From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 10 18:42:45 2012 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1AD06106566C; Sun, 10 Jun 2012 18:42:45 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.31.25]) by mx1.freebsd.org (Postfix) with ESMTP id 9F4248FC14; Sun, 10 Jun 2012 18:42:44 +0000 (UTC) Received: from [78.35.164.130] (helo=fabiankeil.de) by smtprelay02.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1Sdn63-0002VJ-En; Sun, 10 Jun 2012 20:42:43 +0200 Date: Sun, 10 Jun 2012 20:42:39 +0200 From: Fabian Keil To: Andriy Gapon Message-ID: <20120610204239.19b93559@fabiankeil.de> In-Reply-To: <4FD4E4A1.8080605@FreeBSD.org> References: <4FD490D5.1070207@FreeBSD.org> <20120610152721.3b627896@fabiankeil.de> <4FD4CD8B.1080803@FreeBSD.org> <20120610195611.5a8eeaec@fabiankeil.de> <4FD4E4A1.8080605@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/lOMqGUv1mGD5grVSoty8jcr"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 Cc: freebsd-hackers@FreeBSD.org Subject: Re: decoding of multi-byte nops in dtrace X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 18:42:45 -0000 --Sig_/lOMqGUv1mGD5grVSoty8jcr Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Andriy Gapon wrote: > on 10/06/2012 20:56 Fabian Keil said the following: > > Andriy Gapon wrote: > >=20 > >> on 10/06/2012 16:27 Fabian Keil said the following: > >>> Andriy Gapon wrote: > >>> > >>>> It seems that the $subj is missing :-) > >>>> In my environment that causes many functions to not have fbt return = probe, > >>>> because function body decoding fails before 'ret' is found. > >>>> > >>>> Here is my attempt at fixing the problem: > >>>> http://people.freebsd.org/~avg/fbt-nop.patch > >>>> Reviews and suggestions are welcome. > >>> > >>> The patch seems to reduce the number of missing > >>> fbt return probes by about 50% for me. > >>> > >>> Without the patch: > >>> > >>> fk@r500 /usr/src $sudo dtrace -ln fbt::: | grep -c entry > >>> 23395 > >>> fk@r500 /usr/src $sudo dtrace -ln fbt::: | grep -c return > >>> 16739 > >>> > >>> With the patch (and updated kernel sources): > >>> > >>> fk@r500 ~ $sudo dtrace -ln fbt::: | grep -c entry > >>> 23409 > >>> fk@r500 ~ $sudo dtrace -ln fbt::: | grep -c return > >>> 19879 > >> > >> Interesting observations, thank you. > >> Do you use -O2 or higher optimization for kernel/modules build? > >=20 > > Yes, I kept the default -O2. > >=20 > >> I use only -O1. > >=20 > > With -O1 (and your patch) I get: > >=20 > > fk@r500 ~ $sudo dtrace -ln fbt::: | grep -c entry > > 23421 > > fk@r500 ~ $sudo dtrace -ln fbt::: | grep -c return > > 22621 > >=20 > >> Here are some stats from my system: > >> $ dtrace -ln fbt::: | fgrep -c entry > >> 16876 > >> $ dtrace -ln fbt::: | fgrep -c return > >> 16729 > >> > >> So, 147 functions without return probe. > >> >From a quick look at them they all seem to really never return. Eith= er they are > >> noreturn type such panic, or functions that always call the functions = of the > >> first type, or functions with endless loops in them such as top level = functions > >> of many system threads. > >=20 > > I looked at a couple of the functions that still lack return > > probes and the ones I looked at don't seem to belong into these > > categories. > >=20 > > For example I get no return probes for g_eli_crypto_decrypt() > > and g_eli_crypto_encrypt(). Both return the return code of > > g_eli_crypto_cipher() for which I get a return probe. >=20 > I don't have GELI in kernel, but it looks like an instance of well-known = tail > call optimization issue. Although I assumed that GCC wouldn't apply it a= t -O1. > Perhaps you use a module that was built with -O2. That was it. I missed that COPTFLAGS aren't applied to the modules. After recompiling geom_eli manually with CFLAGS=3D-O1 the return codes show up as expected How did you set your -O1? Fabian --Sig_/lOMqGUv1mGD5grVSoty8jcr Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/U6qIACgkQBYqIVf93VJ3k9gCeOiFTwHsmihoEkb8A3AKHc4Zx m6YAnjt/h2UBKGkYggIEzcX7/pcbpa+B =Vp7f -----END PGP SIGNATURE----- --Sig_/lOMqGUv1mGD5grVSoty8jcr--