public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: mingo@elte.hu, LKML <linux-kernel@vger.kernel.org>,
	Zhaolei <zhaolei@cn.fujitsu.com>,
	kosaki.motohiro@jp.fujitsu.com,
	Steven Rostedt <rostedt@goodmis.org>,
	fweisbec@gmail.com
Subject: Re: [PATCH 1/3] ftrace: add tracepoint for timer
Date: Wed, 27 May 2009 15:36:06 +0800	[thread overview]
Message-ID: <4A1CED66.7030805@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.LFD.2.00.0905262334030.1762@localhost.localdomain>



Thomas Gleixner wrote:
> On Fri, 22 May 2009, Xiao Guangrong wrote:
> 
>> This patch is modify from Mathieu's patch base on ingo's suggestion, the original patch
>> can be found here: 
>> 	http://marc.info/?l=linux-kernel&m=123791201816247&w=2
> 
>   I have a hard time to connect this patch to the original one.
>  

There are some timer hook in Mathieu's patch, I just modify the tracepoint name and
add the tracepoint in other suitable place.

>> +TRACE_EVENT(timer_start,
>> +
>> +	TP_PROTO(struct timer_list *timer, int cpu),
>> +
>> +	TP_ARGS(timer, cpu),
>> +
>> +	TP_STRUCT__entry(
>> +		__field( void *,	timer		)
>> +		__field( void *,	function	)
>> +		__field( unsigned long,	expires		)
>> +		__field( int,		cpu		)
>> +	),
>> +
>> +	TP_fast_assign(
>> +		__entry->timer		= timer;
>> +		__entry->function	= timer->function;
>> +		__entry->expires	= timer->expires;
>> +		__entry->cpu		= cpu;
>> +	),
>> +
>> +	TP_printk("timer=%p func=%pf expires=%lu cpu=%d", __entry->timer,
>> +		  __entry->function, __entry->expires, __entry->cpu)
>> +);
> 
>   How do we connect the trace to the jiffies value when the timer
>   was started ?
> 

ftrace already have time information in trace event's output, we can use it instead

>> +
>> +TRACE_EVENT(timer_expire,
>> +
>> +	TP_PROTO(struct timer_list *timer),
>> +
>> +	TP_ARGS(timer),
>> +
>> +	TP_STRUCT__entry(
>> +		__field( void *,	timer		)
>> +		__field( void *,        function	)
>> +	),
>> +
>> +	TP_fast_assign(
>> +		__entry->timer		= timer;
>> +		__entry->function       = timer->function;
>> +	),
>> +
>> +	TP_printk("timer=%p func=%pf", __entry->timer, __entry->function)
>> +);
> 
>   Ditto.
> 

Yes, you are right, I'll remove __entry->function in v2 patch

>> +TRACE_EVENT(timer_cancel,
>> +
>> +	TP_PROTO(struct timer_list *timer),
>> +
>> +	TP_ARGS(timer),
>> +
>> +	TP_STRUCT__entry(
>> +		__field( void *,	timer		)
>> +		__field( void *,        function        )
>> +	),
>> +
>> +	TP_fast_assign(
>> +		__entry->timer		= timer;
>> +		__entry->function	= timer->function;
>> +	),
>> +
>> +	TP_printk("timer=%p func=%pf", __entry->timer, __entry->function)
>> +);
> 
>   Same here.
> 
>> @@ -547,6 +550,7 @@ void init_timer_key(struct timer_list *timer,
>>  {
>>  	debug_timer_init(timer);
>>  	__init_timer(timer, name, key);
>> +	trace_timer_init(timer);
> 
>   Can we please avoid to have two debug calls in one 2 line function ?
> 

debug_timer_init() must call before object's init, but tracepoint have to call
after object's init beacuse if we move the tracepoint to before object init, the
object has no data yet.

>>  }
>>  EXPORT_SYMBOL(init_timer_key);
>>  
>> @@ -565,6 +569,7 @@ static inline void detach_timer(struct timer_list *timer,
>>  	struct list_head *entry = &timer->entry;
>>  
>>  	debug_timer_deactivate(timer);
>> +	trace_timer_cancel(timer);
> 
>   Ditto. Please create one debug entity which covers both.
>

IMHO, we can't create one entity for init event, so we do better detach other event.

for example:  

in init event:
void init_timer_key(...)
{
	debug_timer_init(timer); 
	__init_timer(timer, name, key);
	trace_timer_init(timer); 
}
 
but in detach event ():
void detach_timer(...)
{
	......
	trace_timer_deactivate()
}

void trace_timer_deactivate()
{
	debug_timer_deactivate(timer);
	trace_timer_cancel(timer);
}
 
it's  disunity for us.

Thanks,
Xiao Guangrong
 
>   ....
> 
> Thanks,
> 
> 	tglx
> 
> 

  reply	other threads:[~2009-05-27  7:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22  9:53 [PATCH 1/3] ftrace: add tracepoint for timer Xiao Guangrong
2009-05-26 21:40 ` Thomas Gleixner
2009-05-27  7:36   ` Xiao Guangrong [this message]
2009-05-27 10:10     ` Thomas Gleixner
2009-05-29  2:00       ` Zhaolei
2009-05-29  9:55         ` Thomas Gleixner
2009-06-01  9:08           ` Zhaolei
2009-06-03  2:52           ` Xiao Guangrong
2009-06-03 16:39             ` Thomas Gleixner
2009-06-04  5:38               ` Xiao Guangrong
2009-06-04  8:44                 ` Thomas Gleixner
2009-06-10  9:42                   ` Xiao Guangrong
2009-06-10 10:58                     ` Thomas Gleixner
2009-06-03  2:50       ` Xiao Guangrong

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=4A1CED66.7030805@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=zhaolei@cn.fujitsu.com \
    /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