From owner-freebsd-dtrace@freebsd.org Fri Aug 10 18:34:27 2018 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E0511071B0F; Fri, 10 Aug 2018 18:34:27 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F12D2757E4; Fri, 10 Aug 2018 18:34:26 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pg1-x541.google.com with SMTP id y4-v6so4777372pgp.9; Fri, 10 Aug 2018 11:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0RUxShoM3hxcoMLqb+5lX6nklcLFUux1MTjzSYdpkU0=; b=QpKznk/Wa6IcIh+ysJY26Wcpz0a8hShgCFSAQ/ODpQk3aZF7pJP3jvUUNBMYGowSf3 RMlxGJoAJgBu4k7DI2C61rrxrvyJhC9Is2u9BpjYjt02xhvcGh+aIP+6inWjfyP+3zWV pSgfxTWbWotPWIGfMQ3ziRoXgvIpll84yjs1hHzneWMqkGGx9U0dP4um+Zt0Xs4FbH2g txXQwN6kPczbMhp0+C85krIRXuyS0Uf0biAlb9KUP1xO9v6sKc8YmPFqBMN5FSERcmNj Jy5Nl3A0BbQBlv7rxQMmczk2LmqS4uQID9Kwd+YyImHvKbt4X+g/6gOiG7fbQf3+Xnt9 c+7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=0RUxShoM3hxcoMLqb+5lX6nklcLFUux1MTjzSYdpkU0=; b=SWohSPUhyxsCHTIgUStpsoaEjGEF48rIQ5Q4TFume6faaUkUsvwnbLS0qTSKPwaZi4 tqSYMC/s8ueSHdfpE0+ERFEdBORAmasUnILqIXfkWpvAaqUXPiwlmWDkIT/xLAftUA2z NOm9wDBsZC6D3bK3BERPdGFaGFDP3SXPSyxdmrTWoGv8tLGBEaPd7Kph6JiLCuTN4D4P 8joQp58oz6fiDuYfKn0YeFBNImJJqhC8Hxiley4TyQF/wCe8FvchcwBon2cZTmXpKYbc NwOT8aMR2DvWAqAd5Jeo+g4sgn/hsaLD8e2cGYLQmv4Hon0Gy+pKIvsvL8l8cVlNvjtU BcZg== X-Gm-Message-State: AOUpUlF/UCS/jqGEaNC5ZwPLP2MdAIM6J89fNXYe2ZqAhVZPyceSYE3S TIhwywJc3e8/uicyrl2lki8/6Le5 X-Google-Smtp-Source: AA+uWPwOjP2xZo2kneakP4hcXzedPf/SjpeBXgacySlys/yvoKLpIgoxMnDiw/Zpe108aLppgQSm6w== X-Received: by 2002:a63:6b03:: with SMTP id g3-v6mr7548584pgc.57.1533926065845; Fri, 10 Aug 2018 11:34:25 -0700 (PDT) Received: from raichu (toroon0560w-lp130-09-70-52-224-239.dsl.bell.ca. [70.52.224.239]) by smtp.gmail.com with ESMTPSA id v23-v6sm12373331pfm.80.2018.08.10.11.34.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 11:34:24 -0700 (PDT) Sender: Mark Johnston Date: Fri, 10 Aug 2018 14:34:19 -0400 From: Mark Johnston To: "Patrick M. Hausen" Cc: freebsd-virtualization@freebsd.org, freebsd-dtrace@freebsd.org Subject: Re: Why can't I dtrace processes running in a jail from the host? Message-ID: <20180810183419.GA52302@raichu> References: <20180809145258.GA68459@raichu> <8B1BDE9F-BDAD-4CEB-B7A2-8052497F50EA@punkt.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8B1BDE9F-BDAD-4CEB-B7A2-8052497F50EA@punkt.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Aug 2018 18:34:27 -0000 On Fri, Aug 10, 2018 at 09:15:22AM +0200, Patrick M. Hausen wrote: > Hi! > > > Am 09.08.2018 um 16:52 schrieb Mark Johnston : > > For userland static probes to be globally visible, the process needs to > > register them with the kernel when it starts. This is done > > automatically using a constructor which issues ioctls to > > /dev/dtrace/helper, hence the requirement for /dev/dtrace/* in the jail. > > I figured as much. Enabling /dev/dtrace/* in the jail and restarting > the jail made the probes visible in the host system > > I'm still somewhat stuck. What I'm trying to do is track down some > performance problems in a large complex PHP web application. > I have done this in the past on "regular" setups without jails > and with PHP 5.6 compiled with dtrace support using > /usr/local/share/dtrace-toolkit/Php/* ... > > This setup is jailed with PHP 7.2, dtrace support seems to be the > default for the port. > > I'm specifically after > > php-fpm dtrace_execute_ex function-entry > php-fpm dtrace_execute_ex function-return > > of course, to see where the application spends it's CPU cycles. > > But regardless if I'm doing this on the host or in the jail, I only get > these results: > > dtrace -m php\* > ZEND_CATCH_SPEC_CONST_CV_HANDLER:exception-caught > php_request_shutdown:request-shutdown > php_request_startup:request-startup > zend_error:error > zend_throw_exception_internal:exception-thrown > > Nothing else. Still `dtrace -m php\* -l` does show all the probes. Indeed, I can reproduce this. Peering at the zend source code, it seems that there's a difference in how the dtrace_execute_ex hook gets installed: with 5.6, it's unconditional so long as zend is compiled with HAVE_DTRACE. In 7.2, the php process needs to have USE_ZEND_DTRACE=1 set in its environment for the dtrace function execution hook to be installed.