Make __stringify support variable argument macro
PATCH 1/2 Make __stringify support variable argument macro
For example:__stringify(__entry->irq, __entry->ret) will convert it to:
"REC->irq, REC->ret"
It also support single argument as old macro.
--- include/linux/stringify.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/linux/stringify.h +2 -2
@@ -6,7 +6,7 @@* converts to "bar". */ -#define __stringify_1 (x) #x -#define __stringify (x) __stringify_1(x) +#define __stringify_1(x...) #x +#define __stringify(x...) __stringify_1(x)#endif /* !__LINUX_STRINGIFY_H */
Signature · 1 line
1.5.5.3
PATCH 2/2 ftrace: Output REC->var instead of __entry->var for trace format
print fmt: "irq=%d return=%s", __entry->irq, __entry->ret ? \"handled\" : \"unhandled\"
"__entry" should be convert to "REC" by __stringify() macro.
--- kernel/trace/trace_events_stage_2.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_events_stage_2.h +2 -2
@@ -108,10 +108,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \return 0 ;#undef __entry -#define __entry "REC" +#define __entry REC#undef TP_printk -#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args +#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)#undef TRACE_EVENT#define TRACE_EVENT (call, proto, args, tstruct, assign, print) \
Signature · 1 line
1.5.5.3
Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format
Quoted 30 lines · Zhaolei
print fmt: "irq=%d return=%s",
__entry->irq,__entry->ret? \"handled\" : \"unhandled\""
__entry" should be convert to "REC" by__stringify()macro.Signed-off-by Zhao Lei <[email protected]>--- kernel/trace/trace_events_stage_2.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)kernel/trace/trace_events_stage_2.h +2
-2@@ -108,10 +108,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \return 0 ;#undef __entry -#define __entry "REC" +#define __entry REC#undef TP_printk -#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args +#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)#undef TRACE_EVENT#define TRACE_EVENT (call, proto, args, tstruct, assign, print) \Signature · 1 line
1.5.5.3
Ah indeed nice catch.
The patch that expands stringify to multiple args looks good too.
Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format
In reply to ZhaoleiQuoted 30 lines · Zhaolei
print fmt: "irq=%d return=%s",
__entry->irq,__entry->ret? \"handled\" : \"unhandled\""
__entry" should be convert to "REC" by__stringify()macro.Signed-off-by Zhao Lei <[email protected]>--- kernel/trace/trace_events_stage_2.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)kernel/trace/trace_events_stage_2.h +2
-2@@ -108,10 +108,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \return 0 ;#undef __entry -#define __entry "REC" +#define __entry REC#undef TP_printk -#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args +#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)#undef TRACE_EVENT#define TRACE_EVENT (call, proto, args, tstruct, assign, print) \Signature · 1 line
1.5.5.3
Nice catch!
The other patch that expands stringify to multiple args looks good too.
Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format
In reply to ZhaoleiQuoted 8 lines · Zhaolei
print fmt: "irq=%d return=%s",
__entry->irq,__entry->ret? \"handled\" : \"unhandled\""
__entry" should be convert to "REC" by__stringify()macro.Signed-off-by Zhao Lei <[email protected]>--- kernel/trace/trace_events_stage_2.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
good fix, but it is causing build trouble when applied to latest tip/master:
include/trace/sched_event_types.h:257:1: error: macro "__stringify" passed 3 arguments, but takes just 1
see: http://people.redhat.com/mingo/tip.git/README
Ingo
Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->varfor trace format
* From: "Ingo Molnar" <[email protected]>
Quoted 12 lines · Zhaolei
Quoted 9 lines
print fmt: "irq=%d return=%s",
__entry->irq,__entry->ret? \"handled\" : \"unhandled\""
__entry" should be convert to "REC" by__stringify()macro.Signed-off-by Zhao Lei <[email protected]>--- kernel/trace/trace_events_stage_2.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines
good fix, but it is causing build trouble when applied to latest tip/master:
include/trace/sched_event_types.h:257:1: error: macro "__stringify" passed 3 arguments, but takes just 1
Hello, Ingo
I tested this patch before send, but haven't see this error. env is: gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)
This patch need on top of my previous one:
[PATCH 1/2] Make __stringify support variable argument macro Maybe this is the reason.
Thanks
Zhaolei
Quoted 6 lines
see: http://people.redhat.com/mingo/tip.git/README
Ingo
ÿôèº{.nÇ+‰·Ÿ®‰†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºÊ‡Ú™ë,j¢f£¢·hš�ï�êÿ‘êçz_è®(階ŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨èÚ&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿÃÿ¶ìÿ¢¸?–I¥
Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->varfor trace format
Quoted 18 lines · Zhaolei
* From: "Ingo Molnar" <[email protected]>
Quoted 12 lines · Zhaolei
Quoted 9 lines
print fmt: "irq=%d return=%s",
__entry->irq,__entry->ret? \"handled\" : \"unhandled\""
__entry" should be convert to "REC" by__stringify()macro.Signed-off-by Zhao Lei <[email protected]>--- kernel/trace/trace_events_stage_2.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)Quoted 5 lines
good fix, but it is causing build trouble when applied to latest tip/master:
include/trace/sched_event_types.h:257:1: error: macro "__stringify" passed 3 arguments, but takes just 1
Quoted 8 lines
Hello, Ingo
I tested this patch before send, but haven't see this error. env
is: gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)This patch need on top of my previous one: [PATCH 1/2] Make
__stringifysupport variable argument macro Maybe this is the reason.
ah, indeed - i missed the 1/2 patch. I'll have another look.
Ingo
[tip:tracing/urgent] ftrace: Output REC->var instead of __entry->var for trace format
In reply to ZhaoleiCommit-ID: 0462b5664b2bda5a18fef7efb5bb32ce36590c1a Gitweb: http://git.kernel.org/tip/0462b5664b2bda5a18fef7efb5bb32ce36590c1a Author: Zhaolei <[email protected]> AuthorDate: Wed, 8 Apr 2009 17:00:13 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 10 Apr 2009 15:48:53 +0200
ftrace: Output REC->var instead of __entry->var for trace format
print fmt: "irq=%d return=%s", __entry->irq, __entry->ret ? \"handled\" : \"unhandled\"
"__entry" should be convert to "REC" by __stringify() macro.
LKML-Reference: <[email protected]>
--- kernel/trace/trace_events_stage_2.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace_events_stage_2.h +2 -2
@@ -105,10 +105,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \return 0 ;#undef __entry -#define __entry "REC" +#define __entry REC#undef TP_printk -#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args +#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)#undef TP_fast_assign #define TP_fast_assign(args...) args
[tip:tracing/urgent] Make __stringify support variable argument macros too
In reply to ZhaoleiCommit-ID: 8f7c2c37319a81ef4c2bfdec67b1ccd5744d97e4 Gitweb: http://git.kernel.org/tip/8f7c2c37319a81ef4c2bfdec67b1ccd5744d97e4 Author: Zhaolei <[email protected]> AuthorDate: Wed, 8 Apr 2009 16:58:57 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 10 Apr 2009 15:48:52 +0200
Make __stringify support variable argument macros too
For example:
__stringify(__entry->irq, __entry->ret)
will now convert it to:
"REC->irq, REC->ret"
It also still supports single arguments as the old macro did.
LKML-Reference: <[email protected]>
--- include/linux/stringify.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/linux/stringify.h +2 -2
@@ -6,7 +6,7 @@* converts to "bar". */ -#define __stringify_1 (x) #x -#define __stringify (x) __stringify_1(x) +#define __stringify_1(x...) #x +#define __stringify(x...) __stringify_1(x)#endif /* !__LINUX_STRINGIFY_H */