From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Theodore Tso <tytso@mit.edu>,
Arjan van de Ven <arjan@infradead.org>,
Pekka Paalanen <pq@iki.fi>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jason Baron <jbaron@redhat.com>, Martin Bligh <mbligh@google.com>,
Mathieu Desnoyers <compudj@krystal.dyndns.org>,
"Frank Ch. Eigler" <fche@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Jens Axboe <jens.axboe@oracle.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 2/4] tracing: add event trace infrastructure
Date: Wed, 25 Feb 2009 17:07:02 +0800 [thread overview]
Message-ID: <49A50A36.8000305@cn.fujitsu.com> (raw)
In-Reply-To: <20090225025753.798204550@goodmis.org>
a very nice infrastructure!
Two comments about format:
Steven Rostedt 写道:
> From: Steven Rostedt <srostedt@redhat.com>
> +#undef TPFMT
> +#define TPFMT(fmt, args...) fmt "\n", ##args
Where is other TPFMT's definition?
I think TPFMT should be defined in tracepoint.h, because trace/<type>.h
uses it.
> +#define DEFINE_TRACE_FMT(call, proto, args, fmt) \
> +static void ftrace_event_##call(proto) \
> +{ \
> + event_trace_printk(_RET_IP_, "(" #call ") " fmt); \
> +} \
> + \
> +static int ftrace_reg_event_##call(void) \
> +{ \
> + int ret; \
> + \
> + ret = register_trace_##call(ftrace_event_##call); \
> + if (!ret) \
> + pr_info("event trace: Could not activate trace point " \
> + "probe to " #call); \
> + return ret; \
> +} \
> + \
> +static void ftrace_unreg_event_##call(void) \
> +{ \
> + unregister_trace_##call(ftrace_event_##call); \
> +} \
> + \
> +static struct ftrace_event_call __used \
> +__attribute__((section("_ftrace_events"))) event_##call = { \
> + .name = #call, \
> + .regfunc = ftrace_reg_event_##call, \
> + .unregfunc = ftrace_unreg_event_##call, \
> +}
> +
> +void event_trace_printk(unsigned long ip, const char *fmt, ...);
add format checking here:
__attribute__ ((format (printf, 2, 3)))
If user does not use this infrastructure(he uses trace/<type>.h only),
this checking is not work, so I think we can add format checking
in DEFINE_TRACE_FMT in tracepoint.h
--------example:
static inline void __tp_check_format(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
static inline void __tp_check_format(const char *fmt, ...) {}
#define DECLARE_TRACE_FORMAT_CHECK(name, proto, fmt, fmt_args...) \
static inline void ftrace_event_check_format_##name(proto) \
{ \
__tp_check_format(fmt, ##fmt_args); \
}
#define DEFINE_TRACE_FMT(name, proto, args, fmt) \
DECLARE_TRACE_FORMAT_CHECK(name, TPPROTO(proto), fmt) \
DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))
---------
Thanks, Lai
next prev parent reply other threads:[~2009-02-25 9:08 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 2:56 [PATCH 0/4] [git pull] tip/tracing/ftrace Steven Rostedt
2009-02-25 2:56 ` [PATCH 1/4] tracing: add DEFINE_TRACE_FMT to tracepoint.h Steven Rostedt
2009-02-25 6:27 ` Peter Zijlstra
2009-02-25 13:01 ` Steven Rostedt
2009-02-25 16:09 ` Mathieu Desnoyers
2009-02-25 16:13 ` Mathieu Desnoyers
2009-02-25 16:28 ` Steven Rostedt
2009-02-25 16:33 ` Ingo Molnar
2009-02-25 2:56 ` [PATCH 2/4] tracing: add event trace infrastructure Steven Rostedt
2009-02-25 3:45 ` Andrew Morton
2009-02-25 4:08 ` Steven Rostedt
2009-02-25 4:24 ` Nick Piggin
2009-02-25 4:33 ` Andrew Morton
2009-02-25 5:16 ` Mathieu Desnoyers
2009-02-25 8:11 ` Ingo Molnar
2009-02-25 8:28 ` Andrew Morton
2009-02-25 8:40 ` Ingo Molnar
2009-02-25 9:15 ` Andrew Morton
2009-02-25 9:00 ` Pekka Enberg
2009-02-25 9:10 ` Ingo Molnar
2009-02-25 9:22 ` Andrew Morton
2009-02-25 9:26 ` Peter Zijlstra
2009-02-25 10:31 ` Ingo Molnar
2009-02-25 9:33 ` Pekka Enberg
2009-02-25 9:44 ` Andrew Morton
2009-02-25 9:56 ` Ingo Molnar
2009-02-25 10:02 ` Andrew Morton
2009-02-25 10:24 ` Pekka Enberg
2009-02-25 10:27 ` Ingo Molnar
2009-02-25 16:21 ` Frederic Weisbecker
2009-02-25 9:57 ` Pekka Enberg
2009-02-25 10:07 ` [PATCH] tracing: remove /debug/tracing/latency_trace Ingo Molnar
2009-02-25 14:41 ` [PATCH 2/4] tracing: add event trace infrastructure Steven Rostedt
2009-02-25 15:57 ` Ingo Molnar
2009-02-25 16:09 ` Steven Rostedt
2009-02-25 22:48 ` Steven Rostedt
2009-02-26 3:19 ` Ingo Molnar
2009-02-25 13:54 ` Theodore Tso
2009-02-26 21:08 ` Frank Ch. Eigler
2009-03-01 10:37 ` KOSAKI Motohiro
2009-02-25 13:37 ` Theodore Tso
2009-02-25 14:10 ` Steven Rostedt
2009-02-25 9:07 ` Lai Jiangshan [this message]
2009-02-25 13:50 ` Steven Rostedt
2009-02-25 9:21 ` Lai Jiangshan
2009-02-25 13:54 ` Steven Rostedt
2009-02-25 2:56 ` [PATCH 3/4] tracing: add schedule events to event trace Steven Rostedt
2009-02-25 6:29 ` Peter Zijlstra
2009-02-25 2:56 ` [PATCH 4/4] tracing: make event directory structure Steven Rostedt
2009-02-25 6:59 ` Frederic Weisbecker
2009-02-25 13:07 ` Steven Rostedt
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=49A50A36.8000305@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=compudj@krystal.dyndns.org \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jbaron@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@google.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=pq@iki.fi \
--cc=rostedt@goodmis.org \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
--cc=tytso@mit.edu \
/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