• Steven Rostedt (Google)'s avatar
    ring-buffer: Have absolute time stamps handle large numbers · 6695da58
    Steven Rostedt (Google) authored
    There's an absolute timestamp event in the ring buffer, but this only
    saves 59 bits of the timestamp, as the 5 MSB is used for meta data
    (stating it is an absolute time stamp). This was never an issue as all the
    clocks currently in use never used those 5 MSB. But now there's a new
    clock (TAI) that does.
    
    To handle this case, when reading an absolute timestamp, a previous full
    timestamp is passed in, and the 5 MSB of that timestamp is OR'd to the
    absolute timestamp (if any of the 5 MSB are set), and then to test for
    overflow, if the new result is smaller than the passed in previous
    timestamp, then 1 << 59 is added to it.
    
    All the extra processing is done on the reader "slow" path, with the
    exception of the "too big delta" check, and the reading of timestamps
    for histograms.
    
    Note, libtraceevent will need to be updated to handle this case as well.
    But this is not a user space regression, as user space was never able to
    handle any timestamps that used more than 59 bits.
    
    Link: https://lore.kernel.org/all/20220426175338.3807ca4f@gandalf.local.home/
    Link: https://lkml.kernel.org/r/20220427153339.16c33f75@gandalf.local.home
    
    Cc: Tom Zanussi <zanussi@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Kurt Kanzenbach <kurt@linutronix.de>
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    6695da58
ring_buffer.c 161 KB