Messages in this thread | | | Date | Fri, 26 Jun 2020 15:39:10 -0400 | From | Steven Rostedt <> | Subject | Re: [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
| |