lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100225234806.GD5592@nowhere>
Date:	Fri, 26 Feb 2010 00:48:10 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Mathieu Desnoyers <compudj@...stal.dyndns.org>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Li Zefan <lizf@...fujitsu.com>, Christoph Hellwig <hch@....de>,
	Wu Fengguang <fengguang.wu@...el.com>
Subject: Re: [PATCH 2/2][RFC] tracing: Add extract out softirq names used
	by irq trace events

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).

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ