Re: [RFC patch 15/15] LTTng timestamp x86

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mathieu Desnoyers
Date: Wednesday, October 22, 2008 - 9:51 am

* Luck, Tony (tony.luck@intel.com) wrote:

This is exactly what I do in this patchset actually :) The common case,
when a synchronized TSC is detected, is to do a plain TSC read. However,
if a non-synchronized TSC is detected, a warning message is written to
the console (pointing to some documentation to get precise timestamping)
and the heavyweight cmpxchg-based workaround is enabled.



Yes, I could. When I detect that the TSC value is too far apart from the
previous one, I reserve extra space for the header (this could include
an extra 64-bits for the HPET). At that moment, I could also sample the
HPET, given this happens relatively rarely.

Given the frequency is expected to go at about 1GHz, the 27 bits would
overflow 7-8 times per second. The only thing is that I only need this
extended field when there are absolutely no events in the stream for
an whole overflow period, which is the only case that makes the overflow
impossible to detect without having more TSC bits. In the common case
where there is a steady flow of event, we would never have such "large
TSC header" event.

However, I could do something slightly different from the large TSC
header detection. I could make sure there would be a HPET sampling done
"periodically", or at least periodically when there are events saved to
the buffer by saving, for each buffer, the last TSC value at which the
HPET sampling has been done. When we log following events, we do a HPET
sampling (and write an extended event header) if we are too far apart
from the previous sample.

We would probably need to sample the HPET at subbuffer switch too to
allow fast time-based seek on the trace when we read it.

We could then do a pre-processing on the trace buffers which would
calculate the linear interpolation of cycles counters between the
per-buffer HPET values. The nice thing is that we know the _next_ value
coming _after_ an event (which is not the case for a standard kernel
time-base), so we can be a bit more precise and we do not suffer from
things like "the TSC of a given cpu accelerates and times appears to go
backwards when the next HPET sample is taken".

But I am not sure this would be sufficient to insure generally correct
event order; the maximum interpolation error can become quite large on
systems with different clock speeds in halt states and which would
happen to have a non-steady flow of events.


As Linus said, there is probably some contention at the IO hub level.
But it implies that we have to be careful about the frequency at which
we sample the HPET, otherwise it wouldn't scale.

Mathieu


-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Thu Oct 16, 4:27 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Linus Torvalds, (Thu Oct 16, 5:08 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Linus Torvalds, (Thu Oct 16, 5:12 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Thu Oct 16, 6:28 pm)
RE: [RFC patch 15/15] LTTng timestamp x86, Luck, Tony, (Thu Oct 16, 7:19 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Steven Rostedt, (Fri Oct 17, 10:25 am)
RE: [RFC patch 15/15] LTTng timestamp x86, Luck, Tony, (Fri Oct 17, 11:08 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Fri Oct 17, 11:42 am)
RE: [RFC patch 15/15] LTTng timestamp x86, Luck, Tony, (Fri Oct 17, 11:58 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Steven Rostedt, (Fri Oct 17, 12:17 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Christoph Lameter, (Fri Oct 17, 12:36 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Fri Oct 17, 1:23 pm)
RE: [RFC patch 15/15] LTTng timestamp x86, Luck, Tony, (Fri Oct 17, 4:52 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Sat Oct 18, 10:01 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Linus Torvalds, (Sat Oct 18, 10:35 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Ingo Molnar, (Sat Oct 18, 10:50 am)
RE: [RFC patch 15/15] LTTng timestamp x86, Luck, Tony, (Mon Oct 20, 11:07 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Linus Torvalds, (Mon Oct 20, 1:10 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, john stultz, (Mon Oct 20, 2:38 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Linus Torvalds, (Mon Oct 20, 3:06 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Ingo Molnar, (Mon Oct 20, 3:17 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, H. Peter Anvin, (Mon Oct 20, 3:29 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, john stultz, (Mon Oct 20, 4:47 pm)
Re: [RFC patch 15/15] LTTng timestamp x86, Bjorn Helgaas, (Tue Oct 21, 11:10 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Wed Oct 22, 8:53 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Wed Oct 22, 9:19 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Wed Oct 22, 9:51 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Mathieu Desnoyers, (Wed Oct 22, 10:05 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Linus Torvalds, (Thu Oct 23, 8:47 am)
Re: [RFC patch 15/15] LTTng timestamp x86, H. Peter Anvin, (Thu Oct 23, 9:39 am)
Re: [RFC patch 15/15] LTTng timestamp x86, Paul Mackerras, (Thu Oct 23, 2:54 pm)