Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Nov 2015 20:10:36 -0500
From:      Ryan Stone <rysto32@gmail.com>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        Mark Johnston <markj@freebsd.org>,  "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   Re: zero-cost SDT probes
Message-ID:  <CAFMmRNzQAKmPyfjadTTyEW4LeAPRqqJVtHrNfjtna5JVPL=P%2BA@mail.gmail.com>
In-Reply-To: <20151122164446.GA22980@stack.nl>
References:  <20151122024542.GA44664@wkstn-mjohnston.west.isilon.com> <20151122164446.GA22980@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 22, 2015 at 11:44 AM, Jilles Tjoelker <jilles@stack.nl> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNzQAKmPyfjadTTyEW4LeAPRqqJVtHrNfjtna5JVPL=P%2BA>