linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Frederic Weisbecker <fweisbec@gmail.com>, Avi Kivity <avi@redhat.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] tracing/markers: make markers select tracepoints
Date: Fri, 20 Feb 2009 18:48:11 +0100	[thread overview]
Message-ID: <20090220174811.GL24538@elte.hu> (raw)
In-Reply-To: <20090220173107.GH5732@nowhere>


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> > > >  config MARKERS
> > > >  	bool "Activate markers"
> > > > -	depends on TRACEPOINTS
> > > > +	select TRACEPOINTS
> > > >  	help
> > > >  	  Place an empty function call at each marker site. Can be
> > > >  	  dynamically changed for a probe function.
> > > 
> > > but using "select" instead of "depends on" just causes the 
> > > kind of problem that you described, whereas using "depends on" 
> > > does follow dependency chains.
> > 
> > Well, as long as the secondary selects are 'expanded' along the 
> > line of dependencies, it should still be fine. With an 
> > increasing number of dependencies it quickly becomes ugly 
> > though. This might be one of the cases where it works.
> > 
> > Eventually we should eliminate markers, their uses can either be 
> > converted to new-style tracepoints, or to ftrace_printk().
> > 
> > 	Ingo
> 
> ftrace_printk adds more overhead if not used since it 
> inconditionally send the trace, unless the related 
> TRACE_ITER_PRINTK flag on ftrace is unset.
> 
> I don't know how markers work, but the documentation describes 
> that a single branch check is done in case the probe is 
> disabled.
> 
> With ftrace_printk, even if TRACE_ITER_PRINTK is unset, this 
> is still one call and one branch check. So for hot callsite 
> it's unappropriate.
> 
> IMHO, tracepoints are more suited to replace markers if they 
> have to.

there's i think the KVM usecase where markers are used 
essentially a printk()-alike flexible tracing facility.

This is how KVMTRACE looks like at the moment:

./vmx.c:	KVMTRACE_3D(MSR_READ, vcpu, ecx, (u32)data, (u32)(data >> 32),
./vmx.c:	KVMTRACE_3D(MSR_WRITE, vcpu, ecx, (u32)data, (u32)(data >> 32),
./vmx.c:	KVMTRACE_0D(PEND_INTR, vcpu, handler);
./vmx.c:	KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)kvm_rip_read(vcpu),
./vmx.c:		KVMTRACE_0D(NMI, vcpu, handler);
./lapic.c:	KVMTRACE_1D(APIC_ACCESS, apic->vcpu, (u32)offset, handler);
./lapic.c:	KVMTRACE_1D(APIC_ACCESS, apic->vcpu, (u32)offset, handler);
./svm.c:	KVMTRACE_2D(DR_READ, vcpu, (u32)dr, (u32)val, handler);
./svm.c:		KVMTRACE_3D(PAGE_FAULT, &svm->vcpu, error_code,
./svm.c:		KVMTRACE_3D(TDP_FAULT, &svm->vcpu, error_code,
./svm.c:	KVMTRACE_0D(NMI, &svm->vcpu, handler);

I think this could easily be converted to a wrapper around 
ftrace_printk() plus a "kvmtrace" ftrace plugin which activates 
those wrapped ftrace_printk() sites via a single global 
__read_mostly flag.

This means KVM tracing is activated via:

 echo kvmtrace > /debug/tracing/current_tracer

that's all.

Basically the conversion would look like this:

before:

        KVMTRACE_3D(MSR_READ, &svm->vcpu, ecx, (u32)data,
                    (u32)(data >> 32), handler);

after:

	kvm_trace("MSR_READ: %p, %08lx, %016Lx\n", &svm->vcpu, ecx, data);

As a result all these traces would become a lot more readable 
(and a lot more flexible) both in the source code, and in the 
trace output stage.

And any ad-hoc tracepoint can be added, without worrying about 
the name of the macro or the number of type of arguments. Note 
that in this specific example we didnt need to split up the u64 
'data' into two 32-bit values, nor do we have to pass in the 
'handler' name, nor do we have to provide a MSR_READ 
enumeration.

The tracing-disabled case would still be as fast - a single 
branch check.

Avi, what do you think, any objections against an RFC patchset 
that shows this off?

	Ingo

  reply	other threads:[~2009-02-20 17:48 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 16:34 [PATCH] tracing/markers: make markers select tracepoints Frederic Weisbecker
2009-02-20 16:59 ` Randy Dunlap
2009-02-20 17:20   ` Frederic Weisbecker
2009-02-20 17:22   ` Ingo Molnar
2009-02-20 17:29     ` Randy Dunlap
2009-02-20 17:31     ` Frederic Weisbecker
2009-02-20 17:48       ` Ingo Molnar [this message]
2009-02-20 18:56         ` Jason Baron
2009-02-21  3:15         ` Frederic Weisbecker
2009-02-21 22:04         ` Frank Ch. Eigler
2009-02-22 17:13           ` Ingo Molnar
2009-02-22 17:38             ` Frank Ch. Eigler
2009-02-23 10:13         ` Avi Kivity
2009-02-22  3:23     ` KOSAKI Motohiro
2009-02-22 11:37       ` Peter Zijlstra
2009-02-22 16:04         ` Mathieu Desnoyers
2009-02-22 19:17           ` Ingo Molnar
2009-02-23  2:47             ` Mathieu Desnoyers
2009-02-23  8:52               ` Ingo Molnar
2009-02-22 11:43     ` Peter Zijlstra
2009-02-22 12:08       ` Frank Ch. Eigler
2009-02-22 12:14         ` Peter Zijlstra
2009-02-22 12:24           ` Frank Ch. Eigler
2009-02-23 11:11             ` Peter Zijlstra
2009-02-23 15:44               ` Frank Ch. Eigler
2009-02-23 16:22                 ` Peter Zijlstra
2009-02-23 17:10                   ` Frank Ch. Eigler
2009-02-23 17:23                     ` Ingo Molnar
2009-02-24 13:01                       ` Frank Ch. Eigler
2009-02-23 17:31                     ` Steven Rostedt
2009-02-23 18:32                       ` Theodore Tso
2009-02-23 22:16                         ` Peter Zijlstra
2009-02-23 22:41                           ` Theodore Tso
2009-02-24  8:55                             ` Peter Zijlstra
2009-02-23  0:23       ` Steven Rostedt
2009-02-21  5:24   ` [PATCH][RFC] check for select dependency errors on config load Steven Rostedt
2009-02-21  5:58     ` Andrew Morton
2009-02-21  6:08     ` Andrew Morton
2009-02-21  6:20       ` Randy Dunlap
2009-02-21 20:07         ` Steven Rostedt
2009-02-21 20:46           ` [PATCH v2] kconfig: " Steven Rostedt
2009-02-21 20:48             ` Steven Rostedt
2009-02-21 21:51             ` Sam Ravnborg
2009-02-21 21:53               ` Steven Rostedt
2009-02-22 16:23     ` [PATCH][RFC] " Ingo Molnar

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=20090220174811.GL24538@elte.hu \
    --to=mingo@elte.hu \
    --cc=avi@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).