public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Ingo Molnar <mingo@elte.hu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Problem with CREATE_TRACE_POINTS and recursion safety
Date: Wed, 15 Apr 2009 17:34:37 -0700	[thread overview]
Message-ID: <49E67D1D.8020704@goop.org> (raw)

I'm having a problem with CREATE_TRACE_POINTS being too indiscriminate.  
The trouble is that it not only creates tracepoint definitions for the 
intended tracepoints, but any other tracepoint definitions which get 
included incidentally.

For example, I'm seeing my paravirt tracepoints being instantiated in 
both kernel/sched.o and kernel/irq/manage.o as side-effects of the 
scheduler and irq tracepoints being instantiated.

I'm experimenting with a different scheme, wherein a subsystem defines 
CREATE_FOO_TRACE_POINTS in the .c file where it wants to instantiate the 
tracepoints - rather than CREATE_TRACE_POINTS - and its 
trace/events/foo.h does:

    #ifdef CREATE_FOO_TRACE_POINTS
    #undef CREATE_FOO_TRACE_POINTS	/* avoid infinite recursion */
    #include <trace/instantiate_trace.h>
    #else
    #include <trace/define_trace.h>
    #endif

where instantiate_trace.h is:

    #define CREATE_TRACE_POINTS
    #include <trace/define_trace.h>
    #undef CREATE_TRACE_POINTS

(Just to prevent a bit more repeated boilerplate in each events 
definition file.)

This seems to work.  (Update: no it doesn't.  WTF has paravirt-trace.o 
got duplicate kmem tracepoints?!)

A related problem is that the TRACE_INCLUDE_FILE mechanism doesn't work, 
because if any tracepoint definition header sets it, it overrides the 
setting for all others, so, for example, arch/x86/include/asm/paravirt.h 
ends up being included as the source of definitions for events/sched.h.  
I gave up and moved paravirt-trace.h to trace/events/pvops.h rather than 
try to deal with it.

Lucky for you Steven, none of this is getting any more pretty, so you 
may yet get your prize.

    J

             reply	other threads:[~2009-04-16  0:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-16  0:34 Jeremy Fitzhardinge [this message]
2009-04-16  0:56 ` Problem with CREATE_TRACE_POINTS and recursion safety Steven Rostedt
2009-04-16  1:06   ` Jeremy Fitzhardinge
2009-04-16  2:02     ` Steven Rostedt
2009-04-16  2:23       ` Mathieu Desnoyers
2009-04-16  2:50         ` Jeremy Fitzhardinge
2009-04-16  3:09           ` Steven Rostedt
2009-04-16 11:09             ` Christoph Hellwig
2009-04-16 13:42               ` Steven Rostedt
2009-04-16  2:45       ` Jeremy Fitzhardinge

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=49E67D1D.8020704@goop.org \
    --to=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --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