Re: [RFC PATCH 1/3] Unified trace buffer

From: Jeremy Fitzhardinge
Date: Thu Sep 25 2008 - 21:27:54 EST


Steven Rostedt wrote:
> How do you get this GTOD read in the ring buffer? If the ring buffer does
> it without any knowledge from the tracer, it may be doing it a
> inappropriate times. This would also imply that the GTOD infrastructure
> itself is reentrent safe. Imagine tracing the GTOD code when the buffer
> decides it is about time to add the GTOD timestamp into the buffer. Can
> the GTOD handle this recursion. If the GTOD has spinlocks, probably not.
>

It doesn't need to read the GTOD synchronously when writing the trace
record. When a tsc event occurs, it needs to store the
GTOD/tsc/frequency somewhere at that point. When you next write a trace
record, if that structure has been updated, you write it into the trace
before emitting the next delta timestamp.

In fact you can read the GTOD at almost any time between tsc frequency
updates, so you can defer it to whenever is convenient. At the time the
tsc changes frequency, you emit: (tsc,frequency), and a bit later
(before it changes again) you emit (tsc,GTOD). That allows you to
retroactively compute GTODs for all timestamps. Obviously it would be
good to get them as close as possible together.

J
--
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/