[lkml]   [2018]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v9 1/4] Uprobes: Support SDT markers having reference count (semaphore)
* Ravi Bangoria <> [2018-08-20 10:12:47]:

> Userspace Statically Defined Tracepoints[1] are dtrace style markers
> inside userspace applications. Applications like PostgreSQL, MySQL,
> Pthread, Perl, Python, Java, Ruby, Node.js, libvirt, QEMU, glib etc
> have these markers embedded in them. These markers are added by developer
> at important places in the code. Each marker source expands to a single
> nop instruction in the compiled code but there may be additional
> overhead for computing the marker arguments which expands to couple of
> instructions. In case the overhead is more, execution of it can be
> omitted by runtime if() condition when no one is tracing on the marker:
> if (reference_counter > 0) {
> Execute marker instructions;
> }
> Default value of reference counter is 0. Tracer has to increment the
> reference counter before tracing on a marker and decrement it when
> done with the tracing.
> Implement the reference counter logic in core uprobe. User will be
> able to use it from trace_uprobe as well as from kernel module. New
> trace_uprobe definition with reference counter will now be:
> <path>:<offset>[(ref_ctr_offset)]
> where ref_ctr_offset is an optional field. For kernel module, new
> variant of uprobe_register() has been introduced:
> uprobe_register_refctr(inode, offset, ref_ctr_offset, consumer)
> No new variant for uprobe_unregister() because it's assumed to have
> only one reference counter for one uprobe.
> [1]
> Note: 'reference counter' is called as 'semaphore' in original Dtrace
> (or Systemtap, bcc and even in ELF) documentation and code. But the
> term 'semaphore' is misleading in this context. This is just a counter
> used to hold number of tracers tracing on a marker. This is not really
> used for any synchronization. So we are calling it a 'reference counter'
> in kernel / perf code.

Acked-by: Srikar Dronamraju <>

> Signed-off-by: Ravi Bangoria <>
> Reviewed-by: Masami Hiramatsu <>
> [Only trace_uprobe.c]
> Reviewed-by: Oleg Nesterov <>
> ---

 \ /
  Last update: 2018-08-22 14:41    [W:0.159 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site