Real-Time Preemption, -RT-2.6.10-rc2-mm3-V0.7.32-15
Quoted 7 lines · * [email protected] <[email protected]> wrote:
Quoted 3 lines
[1] I still do not get traces where
cpu_delayswitches CPU's. I only get trace output if it starts and ends on a single CPU. [...]lt001.18RT/lt.02 is such a trace. It starts on CPU#1:
Quoted 7 lines
<unknown-3556 1...1 0µs :
find_next_bit(user_trace_start)and ends on CPU#0:
<unknown-3556 1...1 247µs :
_raw_spin_lock_irqsave(user_trace_stop)the trace shows a typical migration of an RT task.
Hmm. Now I look at it more clearly like...
# grep '^<unknown-3556' lt001.18RT/lt.02 I can see what you mean. Though this time it moved from one [22 usec] to zero [189 usec] and back to one [238 usec] before it finally stopped the trace at 248 usec. [the attempt to reschedule on CPU zero was clearly ineffective]
This trace is also odd in that the duration of the trace in the header is listed as 99 usec (and the application confirmed that) but the trace ends at 248 usec.
Hmm. Now that I look at it, the duration in the header (99 usec) is the duration of lt.01 (as reported by the script) but the total duration of the trace (248 usec) is the duration from the script for lt.02.
--Mark H Johnson
<mailto:[email protected]>
Quoted 4 lines · * [email protected] <[email protected]> wrote:
Hmm. Now that I look at it, the duration in the header (99 usec) is the duration of lt.01 (as reported by the script) but the total duration of the trace (248 usec) is the duration from the script for lt.02.
how do your collection scripts access /proc/latency_trace? The output is only atomic if the file is read as a whole, i.e.:
cat /proc/latency_trace > wherever
or:
cp /proc/latency wherever
but i guess you are doing this already ...
obviously tracing goes on while the scripts are saving the latency trace, so the kernel goes to great lengths to try to guarantee atomicity. There are 3 levels of tracing buffers:
- 'current' trace buffers (per CPU)
- 'max' trace buffer
- 'output' trace buffer
the max trace is updated whenever a new max latency is detected. (not stricly true: if one CPU is already saving a trace and this CPU detects a new latency too then this CPU skips the trace, instead of spinning waiting for the other CPU. This makes the tracing code more atomic, but it opens up a window to 'lose' a latency - but statistically every _type_ of latency should be saved sooner or later, since the 'dropping' of traces is random, not systematic.)
the output trace is atomically filled in from the max trace, whenever userspace accesses offset 0 of /proc/latency_trace. It will stay the same until userspace finishes reading /proc/latency_trace (arrives to the maximum offset of the file). Hence userspace can take all time it wants to save a trace, it will stay the same. At least this is the theory.
Ingo