linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	mingo@goodmis.org, Frederic Weisbecker <fweisbec@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Masami Hiramatsu <mhiramat@redhat.com>
Subject: Re: [RFC] Stupid tracepoint ideas
Date: Mon, 20 Apr 2009 21:17:55 +0200	[thread overview]
Message-ID: <20090420191755.GA15571@elte.hu> (raw)
In-Reply-To: <alpine.DEB.2.00.0904201456470.26147@gandalf.stny.rr.com>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> Mathieu,
> 
> You may have tried this in your creation of tracepoints, but I figured I 
> would ask before wasting too much time on it.
> 
> I'm looking at ways to make tracepoints even lighter weight when disabled. 
> And I thought of doing section code. I'm playing with the following idea 
> (see below patch) but I'm afraid gcc is allowed to think that the code it 
> produces will not move to different sections.
> 
> Any thoughts on how we could do something similar to this.
> 
> Note, this patch is purely proof-of-concept. I'm fully aware that it is an 
> x86 solution only.
> 
> -- Steve
> 
> [ no Signed-off-by: because this patch is crap ]
> 
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 4353f3f..6953f78 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -65,9 +65,18 @@ struct tracepoint {
>  	extern struct tracepoint __tracepoint_##name;			\
>  	static inline void trace_##name(proto)				\
>  	{								\
> -		if (unlikely(__tracepoint_##name.state))		\
> +		if (unlikely(__tracepoint_##name.state)) {		\
> +			asm volatile ("jmp 43f\n"			\
> +				      "42:\n"				\
> +				      ".section .unlikely,\"ax\"\n"	\
> +				      "43:\n"				\
> +				      ::: "memory");			\
>  			__DO_TRACE(&__tracepoint_##name,		\
> -				TP_PROTO(proto), TP_ARGS(args));	\
> +				   TP_PROTO(proto), TP_ARGS(args));	\
> +			asm volatile ("jmp 42b\n"			\
> +			     ".previous\n"				\
> +			     ::: "memory");				\
> +		}							\
>  	}								\
>  	static inline int register_trace_##name(void (*probe)(proto))	\

does this boot fine? If yes then it would be nice to have a 
measurement.

	Ingo

  reply	other threads:[~2009-04-20 19:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 19:04 [RFC] Stupid tracepoint ideas Steven Rostedt
2009-04-20 19:17 ` Ingo Molnar [this message]
2009-04-20 19:23   ` Steven Rostedt
2009-04-20 20:54 ` Mathieu Desnoyers
2009-04-20 21:06   ` Steven Rostedt
2009-04-20 21:12     ` Mathieu Desnoyers
2009-04-21  7:21       ` Ingo Molnar
2009-04-21 15:46         ` 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=20090420191755.GA15571@elte.hu \
    --to=mingo@elte.hu \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mhiramat@redhat.com \
    --cc=mingo@goodmis.org \
    --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).