Re: [PATCH v4 0/3] perf/sdt : Support for SDT markers

Masami Hiramatsu
2014-08-28T11:20:04Z

(2014/08/28 6:43), Hemant Kumar wrote:
> The v3 patchset had some spacing errors because of my editor messing up during
> sending the patches. Resending the patchset again.
> This patchset helps in listing dtrace style markers(SDT) present in user space
> applications through perf.
> Notes/markers are placed at important places by the
> developers. They have a negligible overhead when not enabled.
> We can enable them and probe at these places and find some important information
> like the arguments' values, etc.
>
> We have lots of applications which use SDT markers today, like:
> Postgresql, MySql, Mozilla, Perl, Python, Java, Ruby, libvirt, QEMU, glib
>
> To add SDT markers into user applications:
> We need to have this header sys/sdt.h present.
> sys/sdt.h used is version 3.
> If not present, install systemtap-sdt-devel package (for fedora-18).
>
> Please refer to the Documentation patch (3rd patch in this series) to see how the
> SDT markers are added into a program.
>
> With this patchset,
> - Use perf to list the markers in the app:
> # perf list sdt ./user_app
>
> ./user_app :
> %user_app:foo_start
> %user_app:fun_start
>
> This link shows an example of marker probing with Systemtap:
> https://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
>
> Also, this link provides important info regarding SDT notes:
> http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
>
> This patchset has undergone a lot of changes since it was first introduced.
> Hence, the patchset has now been subdivided for more simplicity and ease of
> review (thanks to the suggestion from Namhyung Kim). This contains the first 2
> of the 4 patches as suggested here:
> https://lkml.org/lkml/2014/7/20/284

BTW, does this series only contain list command support?

> - Markers in binaries :
> These SDT markers are present in the ELF in the section named
> ".note.stapsdt".
> Here, the name of the marker, its provider, type, location, base
> address, semaphore address.
> We can retrieve these values using the members name_off and desc_off in
> Nhdr structure. If these are not enabled, they are present in the ELF as nop.
>
> Changes since last series :
> - Subdivided the previous patchset into 4 patches to make it easier to review
> as suggested by Namhyung Kim. (This set includes first two of the four patches)
> - Made the required changes and some optimizations suggested by Masami, Namhyung
> and Andi.
>
> TODO:
> - Listing SDT events present in most of the binaries present in a system.
> - Maintaining a cache of the SDT events for faster lookup.
> - Add support to probe these SDT markers and integrate with a previous patch
> (support to perf to probe SDT markers) posted in lkml.
> https://lkml.org/lkml/2013/10/23/10

OK, I think we can postpone sdt-cache command, but this should go with
probe-side improvements, because if perf-list shows sdt markers, users
will be misled that the perf already supports sdt events.
I'm OK if we hold this on a non-released branch on acme's tree. But it
shouldn't be pushed to upstream without probe-side improvements.

Arnaldo, would you think that works on your tree?

Thank you,

--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com