tracing: add trace_bprintk()
Impact: add a generic printk() for tracing, like trace_printk() trace_bprintk() uses the infrastructure to record events on ring_buffer. [ fweisbec@gmail.com: ported to latest -tip, made it work if !CONFIG_MODULES, never free the format strings from modules because we can't keep track of them and conditionnaly create the ftrace format strings section (reported by Steven Rostedt) ] Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <1236356510-8381-4-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
1427cdf059
commit
1ba28e02a1
@@ -225,6 +225,27 @@ extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
|
||||
|
||||
#ifdef CONFIG_TRACE_BPRINTK
|
||||
extern int trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
|
||||
extern int __trace_bprintk(unsigned long ip, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
static inline void ____trace_bprintk_check_format(const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
static inline void ____trace_bprintk_check_format(const char *fmt, ...) {}
|
||||
#define __trace_bprintk_check_format(fmt, args...) \
|
||||
do { \
|
||||
if (0) \
|
||||
____trace_bprintk_check_format(fmt, ##args); \
|
||||
} while (0)
|
||||
|
||||
#define trace_bprintk(fmt, args...) \
|
||||
do { \
|
||||
static char *__attribute__((section("__trace_bprintk_fmt"))) \
|
||||
trace_bprintk_fmt = fmt; \
|
||||
__trace_bprintk_check_format(fmt, ##args); \
|
||||
__trace_bprintk(_THIS_IP_, trace_bprintk_fmt, ##args); \
|
||||
} while (0)
|
||||
#else
|
||||
#define trace_bprintk trace_printk
|
||||
#endif
|
||||
|
||||
/* May be defined in arch */
|
||||
|
Reference in New Issue
Block a user