From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 10 18:17:11 2012 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26ACE106566C for ; Sun, 10 Jun 2012 18:17:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 6EB6B8FC0C for ; Sun, 10 Jun 2012 18:17:10 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id VAA20547; Sun, 10 Jun 2012 21:17:08 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1SdmhH-00005M-Nd; Sun, 10 Jun 2012 21:17:07 +0300 Message-ID: <4FD4E4A1.8080605@FreeBSD.org> Date: Sun, 10 Jun 2012 21:17:05 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120503 Thunderbird/12.0.1 MIME-Version: 1.0 To: Fabian Keil References: <4FD490D5.1070207@FreeBSD.org> <20120610152721.3b627896@fabiankeil.de> <4FD4CD8B.1080803@FreeBSD.org> <20120610195611.5a8eeaec@fabiankeil.de> In-Reply-To: <20120610195611.5a8eeaec@fabiankeil.de> X-Enigmail-Version: 1.5pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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:17:11 -0000 on 10/06/2012 20:56 Fabian Keil said the following: > Andriy Gapon wrote: > >> 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? > > Yes, I kept the default -O2. > >> I use only -O1. > > With -O1 (and your patch) I get: > > fk@r500 ~ $sudo dtrace -ln fbt::: | grep -c entry > 23421 > fk@r500 ~ $sudo dtrace -ln fbt::: | grep -c return > 22621 > >> 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. Either 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. > > 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. > > 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. 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 at -O1. Perhaps you use a module that was built with -O2. -- Andriy Gapon