lkml.org 
[lkml]   [2009]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Re: [PATCH 1/3] ftrace: add tracepoint for timer
On Fri, 29 May 2009, Zhaolei wrote:
> But, for trace_timer_start() in __mod_timer(), we need to put it after
> timer->* changed.

Why ?

>> + TP_fast_assign(
>> + __entry->timer = timer;
>> + __entry->function = timer->function;
>> + __entry->expires = timer->expires;
>> + __entry->cpu = cpu;

Again, neither timer nor function nor expires will change when the
timer is added, right ?

The only unknown at this point is cpu. See below.

> Nevertheless, it don't means we need separate trace_timer_start() and
> debug_timer_activate(), because we can put move debug_timer_activate() below,
> as:
> - debug_timer_activate(timer);
> ...
> timer->expires = expires;
> internal_add_timer(base, timer);
> + debug_timer_activate(timer);

No, you can not call it with the base->lock held.

> + trace_timer_start(timer, smp_processor_id());

Also using smp_processor_id() here is wrong. We do not necessarily add
the timer to the current CPUs timer wheel. See the code which selects
the timer base. So this information is rather useless, because the
tracer knows anyway on which CPU we are running.

Unfortunately we do not have an easy way to figure out to which CPU
the base belongs (except if it's the base of the current CPU). There
is not much we can do about that. But OTOH, this is not a problem
because we see when the timer expires on which CPU it was enqueued. So
scrapping the cpu entry in the trace completely is not a big loss.

The same applies to hrtimers as well.

Thanks,

tglx


\
 
 \ /
  Last update: 2009-05-29 11:59    [W:0.076 / U:1.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site