public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Make __stringify support variable argument macro
@ 2009-04-08  8:58 Zhaolei
  2009-04-08  9:00 ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format Zhaolei
  2009-04-10 14:06 ` [tip:tracing/urgent] Make __stringify support variable argument macros too Zhaolei
  0 siblings, 2 replies; 9+ messages in thread
From: Zhaolei @ 2009-04-08  8:58 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Frederic Weisbecker, linux-kernel

For example:
__stringify(__entry->irq, __entry->ret) will convert it to:
"REC->irq, REC->ret"

It also support single argument as old macro.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 include/linux/stringify.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/stringify.h b/include/linux/stringify.h
index 0b43883..841cec8 100644
--- a/include/linux/stringify.h
+++ b/include/linux/stringify.h
@@ -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 */
-- 
1.5.5.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format
  2009-04-08  8:58 [PATCH 1/2] Make __stringify support variable argument macro Zhaolei
@ 2009-04-08  9:00 ` Zhaolei
  2009-04-08 11:29   ` Frederic Weisbecker
                     ` (3 more replies)
  2009-04-10 14:06 ` [tip:tracing/urgent] Make __stringify support variable argument macros too Zhaolei
  1 sibling, 4 replies; 9+ messages in thread
From: Zhaolei @ 2009-04-08  9:00 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Frederic Weisbecker, linux-kernel

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 <zhaolei@cn.fujitsu.com>
---
 kernel/trace/trace_events_stage_2.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
index 9e47c39..d694a8a 100644
--- a/kernel/trace/trace_events_stage_2.h
+++ b/kernel/trace/trace_events_stage_2.h
@@ -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)		\
-- 
1.5.5.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format
  2009-04-08  9:00 ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format Zhaolei
@ 2009-04-08 11:29   ` Frederic Weisbecker
  2009-04-08 11:31   ` Frederic Weisbecker
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Frederic Weisbecker @ 2009-04-08 11:29 UTC (permalink / raw)
  To: Zhaolei; +Cc: Steven Rostedt, linux-kernel

On Wed, Apr 08, 2009 at 05:00:13PM +0800, Zhaolei wrote:
> 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 <zhaolei@cn.fujitsu.com>
> ---
>  kernel/trace/trace_events_stage_2.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
> index 9e47c39..d694a8a 100644
> --- a/kernel/trace/trace_events_stage_2.h
> +++ b/kernel/trace/trace_events_stage_2.h
> @@ -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)		\
> -- 
> 1.5.5.3
> 
> 


Ah indeed nice catch.
The patch that expands stringify to multiple args looks good too.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format
  2009-04-08  9:00 ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format Zhaolei
  2009-04-08 11:29   ` Frederic Weisbecker
@ 2009-04-08 11:31   ` Frederic Weisbecker
  2009-04-08 12:06   ` Ingo Molnar
  2009-04-10 14:06   ` [tip:tracing/urgent] ftrace: Output REC->var instead of __entry->var for " Zhaolei
  3 siblings, 0 replies; 9+ messages in thread
From: Frederic Weisbecker @ 2009-04-08 11:31 UTC (permalink / raw)
  To: Zhaolei; +Cc: Steven Rostedt, linux-kernel

On Wed, Apr 08, 2009 at 05:00:13PM +0800, Zhaolei wrote:
> 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 <zhaolei@cn.fujitsu.com>
> ---
>  kernel/trace/trace_events_stage_2.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
> index 9e47c39..d694a8a 100644
> --- a/kernel/trace/trace_events_stage_2.h
> +++ b/kernel/trace/trace_events_stage_2.h
> @@ -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)		\
> -- 
> 1.5.5.3
> 
> 

Nice catch!
The other patch that expands stringify to multiple args looks good too.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format
  2009-04-08  9:00 ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format Zhaolei
  2009-04-08 11:29   ` Frederic Weisbecker
  2009-04-08 11:31   ` Frederic Weisbecker
@ 2009-04-08 12:06   ` Ingo Molnar
  2009-04-09  0:45     ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->varfor " Zhaolei
  2009-04-10 14:06   ` [tip:tracing/urgent] ftrace: Output REC->var instead of __entry->var for " Zhaolei
  3 siblings, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2009-04-08 12:06 UTC (permalink / raw)
  To: Zhaolei; +Cc: Steven Rostedt, Frederic Weisbecker, linux-kernel


* Zhaolei <zhaolei@cn.fujitsu.com> wrote:

> 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 <zhaolei@cn.fujitsu.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->varfor trace format
  2009-04-08 12:06   ` Ingo Molnar
@ 2009-04-09  0:45     ` Zhaolei
  2009-04-10 13:46       ` Ingo Molnar
  0 siblings, 1 reply; 9+ messages in thread
From: Zhaolei @ 2009-04-09  0:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Frederic Weisbecker, linux-kernel

* From: "Ingo Molnar" <mingo@elte.hu>
> 
> * Zhaolei <zhaolei@cn.fujitsu.com> wrote:
> 
>> 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 <zhaolei@cn.fujitsu.com>
>> ---
>>  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
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

> 
> see: http://people.redhat.com/mingo/tip.git/README
> 
> Ingo
> 
>ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ftrace: Output REC->var instead of __entry->varfor trace format
  2009-04-09  0:45     ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->varfor " Zhaolei
@ 2009-04-10 13:46       ` Ingo Molnar
  0 siblings, 0 replies; 9+ messages in thread
From: Ingo Molnar @ 2009-04-10 13:46 UTC (permalink / raw)
  To: Zhaolei; +Cc: Steven Rostedt, Frederic Weisbecker, linux-kernel


* Zhaolei <zhaolei@cn.fujitsu.com> wrote:

> * From: "Ingo Molnar" <mingo@elte.hu>
> > 
> > * Zhaolei <zhaolei@cn.fujitsu.com> wrote:
> > 
> >> 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 <zhaolei@cn.fujitsu.com>
> >> ---
> >>  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
> 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.

ah, indeed - i missed the 1/2 patch. I'll have another look.

	Ingo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [tip:tracing/urgent] Make __stringify support variable argument macros too
  2009-04-08  8:58 [PATCH 1/2] Make __stringify support variable argument macro Zhaolei
  2009-04-08  9:00 ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format Zhaolei
@ 2009-04-10 14:06 ` Zhaolei
  1 sibling, 0 replies; 9+ messages in thread
From: Zhaolei @ 2009-04-10 14:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, rostedt, zhaolei, tglx, mingo

Commit-ID:  8f7c2c37319a81ef4c2bfdec67b1ccd5744d97e4
Gitweb:     http://git.kernel.org/tip/8f7c2c37319a81ef4c2bfdec67b1ccd5744d97e4
Author:     Zhaolei <zhaolei@cn.fujitsu.com>
AuthorDate: Wed, 8 Apr 2009 16:58:57 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
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.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <49DC6751.30308@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/stringify.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/stringify.h b/include/linux/stringify.h
index 0b43883..841cec8 100644
--- a/include/linux/stringify.h
+++ b/include/linux/stringify.h
@@ -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 */

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:tracing/urgent] ftrace: Output REC->var instead of __entry->var for trace format
  2009-04-08  9:00 ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format Zhaolei
                     ` (2 preceding siblings ...)
  2009-04-08 12:06   ` Ingo Molnar
@ 2009-04-10 14:06   ` Zhaolei
  3 siblings, 0 replies; 9+ messages in thread
From: Zhaolei @ 2009-04-10 14:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, fweisbec, rostedt, zhaolei, tglx, mingo

Commit-ID:  0462b5664b2bda5a18fef7efb5bb32ce36590c1a
Gitweb:     http://git.kernel.org/tip/0462b5664b2bda5a18fef7efb5bb32ce36590c1a
Author:     Zhaolei <zhaolei@cn.fujitsu.com>
AuthorDate: Wed, 8 Apr 2009 17:00:13 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
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.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <49DC679D.2090901@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace_events_stage_2.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
index 30743f7..d363c66 100644
--- a/kernel/trace/trace_events_stage_2.h
+++ b/kernel/trace/trace_events_stage_2.h
@@ -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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-04-10 14:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08  8:58 [PATCH 1/2] Make __stringify support variable argument macro Zhaolei
2009-04-08  9:00 ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->var for trace format Zhaolei
2009-04-08 11:29   ` Frederic Weisbecker
2009-04-08 11:31   ` Frederic Weisbecker
2009-04-08 12:06   ` Ingo Molnar
2009-04-09  0:45     ` [PATCH 2/2] ftrace: Output REC->var instead of __entry->varfor " Zhaolei
2009-04-10 13:46       ` Ingo Molnar
2009-04-10 14:06   ` [tip:tracing/urgent] ftrace: Output REC->var instead of __entry->var for " Zhaolei
2009-04-10 14:06 ` [tip:tracing/urgent] Make __stringify support variable argument macros too Zhaolei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox