RE: [PATCH v4] trace,x86: add x86 irq vector tracepoints
From: Seiji Aguchi
Date: Tue Oct 02 2012 - 15:11:05 EST
> >
> > If I misunderstand something, please let me know.
> >
>
> Quite.
>
> These functions are being invoked from the IDT, which is an indirect pointer structure. When not being traced, there is absolutely no
> reason why it should go through a thunk with tracepoints.
I agree that the cost can be absolutely zero by switching each interrupt hander when turning on/off the tracepoint.
But I would like to talk about a time penalty of a tracepoint more.
When not being traced, the tracepoint is just nop.
And it is described in the documentation below.
So, the tracepoint seems to be designed to add to performance critical paths.
Documentation/trace/tracepoints.txt
<snip>
* Purpose of tracepoints
A tracepoint placed in code provides a hook to call a function (probe) that you can provide at runtime. A tracepoint can be "on" (a probe is connected to it) or "off" (no probe is attached). When a tracepoint is "off" it has no effect, except for adding a tiny time penalty (checking a condition for a branch) and space penalty (adding a few bytes for the function call at the end of the instrumented function and adds a data structure in a separate section). When a tracepoint is "on", the function you provide is called each time the tracepoint is executed, in the execution context of the caller. When the function provided ends its execution, it returns to the caller (continuing from the tracepoint site).
You can put tracepoints at important locations in the code. They are lightweight hooks that can pass an arbitrary number of parameters, which prototypes are described in a tracepoint declaration placed in a header file.
<snip>
Also, as I submitted an actual latency measurement, the time penalty is almost zero.
<snip>
(1-1) local_timer_entry
- 3.6-rc6 original
<...>-2788 2dNh. 894834337us : exit_idle <-smp_apic_timer_interrupt
<...>-2788 2dNh. 894834337us : hrtimer_interrupt <-smp_apic_timer_interrupt
- 3.6-rc6 + this patch + trace off
<...>-1981 0d.h. 210538us : exit_idle <-smp_apic_timer_interrupt
<...>-1981 0d.h. 210538us : hrtimer_interrupt <-smp_apic_timer_interrupt
<snip>
When switching each interrupt handler, all cpus have to be interrupt-disable with smp_call_funciton() or something like that.
IMO, rather than doing such a complex thing, just adding a tracepoint is reasonable.
What do you think?
Seiji
¢éì®&Þ~º&¶¬+-±éÝ¥w®Ë±Êâmébìdz¹Þ)í
æèw*jg¬±¨¶Ýj/êäz¹Þà2Þ¨èÚ&¢)ß«a¶Úþø®G«éh®æj:+v¨wèÙ>W±êÞiÛaxPjØm¶ÿÃ-»+ùd_