From owner-freebsd-arch@freebsd.org Mon Nov 23 01:10:37 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D68C9A3527A for ; Mon, 23 Nov 2015 01:10:37 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A228F1611; Mon, 23 Nov 2015 01:10:37 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by iouu10 with SMTP id u10so176052604iou.0; Sun, 22 Nov 2015 17:10:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=VjglKUsjv5OxswawE8V1XRh/e80nmsv5K8vvTSD8zPg=; b=k44tCh1X/sgG6oKdf9hzgBPT21eoK1flTsR+7X/3Z5bCy9Nacdv7gc2I3/4D/3ufvo 5cnvTc81lfhQmHhtuNacCCofvtud7ub9j1ND9WTlCU1APIWk+OF/c4FgJ0wqJPonL2X1 +g6aeqHRlh5aklHlbVIc3yk7hJlUcLm5TU1l1F0XTIwpdBZRT5GtvM9XNm4woCQgVxX/ WeUwFZ1XMMBS2S7wy9xPGAyLka0U6zYYgubVAdPeX63T5XnGndYnO+tZBpUcmcPug6iD Uixa9bt6o1OSfnvbdOuiM04oFZf4AxABk0uhCdQcnPlwTLmvTMbJYR9GR5D7OyeJ8GS7 VR8Q== MIME-Version: 1.0 X-Received: by 10.107.159.199 with SMTP id i190mr21631986ioe.29.1448241037049; Sun, 22 Nov 2015 17:10:37 -0800 (PST) Received: by 10.107.170.102 with HTTP; Sun, 22 Nov 2015 17:10:36 -0800 (PST) In-Reply-To: <20151122164446.GA22980@stack.nl> References: <20151122024542.GA44664@wkstn-mjohnston.west.isilon.com> <20151122164446.GA22980@stack.nl> Date: Sun, 22 Nov 2015 20:10:36 -0500 Message-ID: Subject: Re: zero-cost SDT probes From: Ryan Stone To: Jilles Tjoelker Cc: Mark Johnston , "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 01:10:37 -0000 On Sun, Nov 22, 2015 at 11:44 AM, Jilles Tjoelker wrote: > I have not run any benchmarks but I expect that this removes only a > small part of the overhead of disabled probes. Saving and restoring > caller-save registers and setting up parameters certainly increases code > size and I-cache use. On the other hand, a branch that is always or > never taken will generally cost at most 2 cycles. > The original Solaris implementation side-stepped this by trying to place SDT probes next to existing function calls to minimize this overhead. I don't think that we in FreeBSD has been nearly as careful about this. It would be a good project for somebody to go through the existing SDT probes and see if they could be relocated slightly to produce the same semantics but less overhead. Avoiding this overhead would require not generating an ABI function call > but a point where the probe parameters can be calculated from the > registers and stack frame (like how a debugger prints local variables, > but with a guarantee that "optimized out" will not happen). This > requires compiler changes, though, and DTrace has generally not used > DWARF-like debug information. > Compiler support would be nice but is obviously a lot more complicated. I've long thought that a DTrace probe that expanded to something like the following would be ideal: jmp skip_dtrace # load arguments int 3 skip_dtrace: But in order to implement something like that, you'd need support from both the compiler and the linker.