lkml.org 
[lkml]   [2020]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] ring-buffer: Have nested events still record running time stamp
On Fri, 26 Jun 2020 14:58:19 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> Second usage:
>
> /* SLOW PATH - Interrupted between A and C */
> a_ok = rb_time_read(&cpu_buffer->write_stamp, &after);
> ts = rb_time_stamp(cpu_buffer->buffer);
> barrier();
> /*E*/ if (write == (local_read(&tail_page->write) & RB_WRITE_MASK) &&
> a_ok && after < ts) {
> /* Nothing came after this event between C and E */
> info->delta = ts - after;
> (void)rb_time_cmpxchg(&cpu_buffer->write_stamp, after, info->ts);
> info->ts = ts;
> } else {
> info->delta = 0;

Actually, I don't think a_ok can every be false here. An uninterrupted
event will leave with both before_stamp and write_stamp valid. As an
uninterrupted event will write to both (and a rb_time_t is only invalid
from reading an interrupted event).

To get to this path we have:

w = local_read(write_tail);

<--- Interrupt event (makes write_stamp valid!)

write = local_add_return(write_tail, length);

w != write - length;


[..]

a_ok = rb_time_read(write_stamp);

Must always be valid!

-- Steve

\
 
 \ /
  Last update: 2020-06-26 21:40    [W:0.058 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site