Re: Pin-pointing the root of unusual application latencies

From: Ingo Molnar
Date: Mon Jul 23 2007 - 12:08:13 EST



* John Sigler <linux.kernel@xxxxxxx> wrote:

> > ./trace-it 1 > trace.txt
> >
> > does it produce lots of trace entries? If not then
> > CONFIG_FUNCTION_TRACING is not enabled. Once you see lots of output
> > in the file, the tracer is up and running and you can start tracing
> > the latency in your app.
>
> # ./trace-it 1 >/tmp/trace.txt
> # wc /tmp/trace.txt
> 65555 393277 4096317 /tmp/trace.txt
>
> preemption latency trace v1.1.5 on 2.6.20.7-rt8

> <...>-939 0D... 0us : read_tsc (get_monotonic_cycles)

add 'notrace' to the definition of read_tsc in arch/i386/kernel/tsc.c.
(check recent -rt's read_tsc() definition) (or do echo 1 >
/proc/sys/kernel/trace_use_raw_cycles - if you are using recent enough
-rt)

> >To track it down, use the method that trace-it.c uses to start/stop
> >tracing, i.e. put the prctl(0,1); / prctl(0,0); calls into your app
> >to start/stop tracing and the kernel will do the rest once you've set
> >/proc/sys/kernel/preempt_max_latency back to 0: /proc/latency_trace
> >will always contain the longest latency that your app triggered, of
> >the critical path you programmed into it.
>
> Here's what I came up with:
> http://linux.kernel.free.fr/latency/check_dektec_input3.cxx
> (I enable tracing only 1% of the time.)
>
> The output looks very much like the one I got when I ran trace-it

> 1. Again, shouldn't there be other functions in the output?

there should be, once you fix read_tsc().

> 2. How much overhead do the prctl calls incur? Is it possible that
> they are somehow masking my problem? (I'll let the program run all
> night to maximize the chances of capturing the anomalous latency.)

it's not the prctl calls that matter but the fact that every kernel
function will be traced if you have FUNCTION_TRACING on. It mask any
races - but latencies are usually not masked (they are enlarged).

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/