public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mathieu Desnoyers <compudj@krystal.dyndns.org>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Li Zefan <lizf@cn.fujitsu.com>, Christoph Hellwig <hch@lst.de>,
	Wu Fengguang <fengguang.wu@intel.com>
Subject: Re: [PATCH 2/2][RFC] tracing: Add extract out softirq names used by irq trace events
Date: Fri, 26 Feb 2010 00:48:10 +0100	[thread overview]
Message-ID: <20100225234806.GD5592@nowhere> (raw)
In-Reply-To: <1266059470.24271.116.camel@gandalf.stny.rr.com>

On Sat, Feb 13, 2010 at 06:11:09AM -0500, Steven Rostedt wrote:
> We don't care about adding them near the definition site. We care about
> what is used. In this same file we have:
> 
> #define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
> #define show_softirq_name(val)                          \
>         __print_symbolic(val,                           \
>                          softirq_name(HI),              \
>                          softirq_name(TIMER),           \
>                          softirq_name(NET_TX),          \
>                          softirq_name(NET_RX),          \
>                          softirq_name(BLOCK),           \
>                          softirq_name(BLOCK_IOPOLL),    \
>                          softirq_name(TASKLET),         \
>                          softirq_name(SCHED),           \
>                          softirq_name(HRTIMER),         \
>                          softirq_name(RCU))
> 
> Which uses the variables. If another softirq name is added, the
> TRACE_EVENT already misses it. That's not the point of the EXTRACT
> macro. The point is, if a TRACE_EVENT uses a name that is not a macro,
> this gives a way for it to display that value.


And what about a kind of macro that could have two effects:

- define the enum
- define the nr -> name pairs for resolution

This could be something like:

define_trace_enum(softirq)
	enum_entry(TASKLET, 4), //don't know if it's 4, just an example
	enum_entry(HRTIMER, 5),
end_trace_enum()

(My naming sucks, as usual).

In normal headers, it would define an enum:

enum softirq {
	TASKLET = 4,
	HRTIMER = 5,
};

And in the file that has DEFINE_TRACEPOINT:

/* can be in ftrace_event.h */
struct resolve_enum {
	const char *name;
	int val;
};

struct resolve_enum softirq = { //come from define_trace_enum()
	{"TASKLET", 4}, //come from enum_entry()
	{"HRTIMER", 5},
	{ NULL, 0}, /* end */
};

/* This can be used from the trace_event macro */
const char *softirq_name(int nr)
{
	return resolve_enum[nr];
}


And then you can get back the struct resolve_enum softirq
to export the values to debugfs, may be by storing such
structures in a section (and adding the name of the enum)

This has the advantage of beeing sync with core header
changes, but this has the drawback of beeing less readable
to define an enum usable from a TRACE_EVENT (especially
if I define the naming personally).


  reply	other threads:[~2010-02-25 23:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 19:09 [PATCH 0/2][RFC] tracing: Showing symbols for TRACE_EVENT Steven Rostedt
2010-02-12 19:09 ` [PATCH 1/2][RFC] tracing: Add EXTRACT_TRACE_SYMBOL() macro Steven Rostedt
2010-02-12 19:09 ` [PATCH 2/2][RFC] tracing: Add extract out softirq names used by irq trace events Steven Rostedt
2010-02-13 10:39   ` Peter Zijlstra
2010-02-13 11:11     ` Steven Rostedt
2010-02-25 23:48       ` Frederic Weisbecker [this message]
2010-02-26  2:26         ` Steven Rostedt
2010-02-27 10:39           ` Frederic Weisbecker

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=20100225234806.GD5592@nowhere \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=compudj@krystal.dyndns.org \
    --cc=fengguang.wu@intel.com \
    --cc=hch@lst.de \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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