public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [patch 06/16] Markers auto enable tracepoints (new API : trace_mark_tp())
Date: Mon, 17 Nov 2008 23:44:03 -0500	[thread overview]
Message-ID: <20081118044403.GA32759@Krystal> (raw)
In-Reply-To: <20081116075928.GB530@elte.hu>

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> 
> > Add a new API trace_mark_tp(), which declares a marker within a 
> > tracepoint probe. When the marker is activated, the tracepoint is 
> > automatically enabled.
> > 
> > No branch test is used at the marker site, because it would be a 
> > duplicate of the branch already present in the tracepoint.
> > 
> > Impact: new API.
> 
> i dont know.
> 
> I was actually hoping for markers (the in-kernel API) to go away 
> completely - and be replaced with tracepoints.
> 
> Markers are the wrong design on several levels. They couple the kernel 
> dynamically with unknown (to the kernel) entities - and that is 
> causing complexity all around the place, clearly expressed in these 
> patches of yours.
> 
> Tracepoints are much more specific - typed and enumerated function 
> call callback points in essence - with some politeness that allows 
> external instrumentation entities to attach to those callbacks.
> 
> Is there any usecase of markers that should not be converted to either 
> tracepoints or to ftrace_printk() ?
> 
> 	Ingo

I'll try to explain the common use-case I have in mind. I think starting
from that we'll be able to better understand what pieces of tracepoints
and markers are useful, and which purpose they fulfill. I have other
use-cases in mind too, but for sake of clarity, let's begin with this
subset.

Tracepoints instrument the kernel. They identify code locations and
extract the state of pre-identified interesting variables at these
locations. They are built into the kernel. They are closely tied to
kernel internals, and hence only provide an in-kernel API.

Markers identify the name (and therefore numeric ID) to attach to an
"event" and the data types to export into trace buffers for this
specific event type. These data types are fully expressed in a marker
format-string table recorded in a "metadata" channel. The size of the
various basic types and the endianness is recorded in the buffer header.
Therefore, the binary trace buffers are self-described.

Data is exported through binary trace buffers out of kernel-space,
either by writing directly to disk, sending data over the network, crash
dump extraction, etc.

User-space applications, which run on an architecture with potentially
different endianness and different type sizes, reads the binary buffers.
Therefore, those buffers must be fully self-described so the application
can read them portably (or just on 32-bits userspace running under a
64-bits kernel).

In debug-mode tracing (where the developer wants to add
ftrace_printk()-like statements in its kernel and recompile), the
extracted information should be made available through the same binary
buffers where the information extracted from the tracepoints is saved.
Adding printk-like statements to the kernel should not suffer from the
time and buffer space penality of expanding the raw data to text.
However, ftrace_printk() requires to pretty-print the data in text.
It would be too cumbersome to ask developer to deploy their own
tracepoints whenever they want to create ad-hoc debug-style tracing
statements. This is where trace_mark() statements do better than
ftrace_printk() by allowing to dump the information to trace buffers in
binary format through a simple to use format-string based macro. Note
that each marker format string is dumped in the metadata table to
identify the new event types.

So that was my use-case which I think cannot be converted to tracepoints
nor ftrace_print(). If things are not as clear as they should be, don't
hesitate to ask for clarifications.

I also think we might consider removing the "multiple callback support"
from markers if we tie them more closely to the data extraction code,
given this multiple-callback role is already fulfilled by tracepoints.
OTOH, given my use-case can use markers as information source, thus
bypassing tracepoints for debug-style tracing, we may still need to
connect more than a single probe to the markers. I becomes very useful
for use-cases such as : dumping the kernel or userspace stack, reading
the performance counters and activating/de-activating the function
tracer at specific instrumentation sites.

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

  reply	other threads:[~2008-11-18  4:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-14 22:47 [patch 00/16] Markers and Tracepoints Updates for -tip Mathieu Desnoyers
2008-11-14 22:47 ` [patch 01/16] RCU read sched notrace Mathieu Desnoyers
2008-11-16  4:00   ` Paul E. McKenney
2008-11-14 22:47 ` [patch 02/16] Marker fix unregister Mathieu Desnoyers
2008-11-14 22:47 ` [patch 03/16] markers: Add missing stdargs.h include, needed due to va_list usage Mathieu Desnoyers
2008-11-14 22:47 ` [patch 04/16] Markers use rcu_*_sched_notrace and notrace Mathieu Desnoyers
2008-11-14 22:47 ` [patch 05/16] Markers use module notifier Mathieu Desnoyers
2008-11-16  8:52   ` [PATCH] markers/tracpoints: fix non-modular build Ingo Molnar
2008-11-17  5:39     ` Mathieu Desnoyers
2008-11-14 22:47 ` [patch 06/16] Markers auto enable tracepoints (new API : trace_mark_tp()) Mathieu Desnoyers
2008-11-16  7:59   ` Ingo Molnar
2008-11-18  4:44     ` Mathieu Desnoyers [this message]
2008-11-18 16:30       ` Ingo Molnar
2008-11-23 16:40         ` Mathieu Desnoyers
2008-11-23 16:49           ` Ingo Molnar
2008-11-24  8:05             ` Mathieu Desnoyers
2008-11-25 12:23     ` KOSAKI Motohiro
2008-11-25 17:24       ` Frank Ch. Eigler
2008-11-14 22:47 ` [patch 07/16] Markers : create DEFINE_MARKER and GET_MARKER (new API) Mathieu Desnoyers
2008-11-14 22:47 ` [patch 08/16] Tracepoints : Samples fix teardown Mathieu Desnoyers
2008-11-14 22:47 ` [patch 09/16] Tracepoint fix disable Mathieu Desnoyers
2008-11-14 22:47 ` [patch 10/16] Tracepoints use rcu_*_sched_notrace Mathieu Desnoyers
2008-11-14 22:47 ` [patch 11/16] Tracepoint Use Unregister Return Value Mathieu Desnoyers
2008-11-14 22:47 ` [patch 12/16] Tracepoint do not put arguments in name Mathieu Desnoyers
2008-11-14 22:47 ` [patch 13/16] Tracepoints : use modules notifiers Mathieu Desnoyers
2008-11-14 22:47 ` [patch 14/16] Tracepoints : add DECLARE_TRACE() and DEFINE_TRACE() Mathieu Desnoyers
2008-11-14 22:47 ` [patch 15/16] Tracepoints : documentation fix teardown Mathieu Desnoyers
2008-11-14 22:47 ` [patch 16/16] marker_synchronize_unregister->tracepoint_synchronize_unregister Mathieu Desnoyers
2008-11-16  7:48   ` Ingo Molnar
2008-11-17  5:36     ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081118044403.GA32759@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox