Commit efe6196a6bc5 ("ring-buffer: Allow ring_buffer_event_time_stamp() to
return time stamp of all events") make ring_buffer_event_time_stamp() have
the ability to return time stamp of all events. The hist trigger had
also switch to the new logic to get time_stamp. The absolute timestamp
logic had bocome useless, so it showed be removed.
Remove absolute timestamp from add_timestamp logic.
Signed-off-by: sunliming <[email protected]>
---
kernel/trace/ring_buffer.c | 49 +++++++++++++-------------------------
1 file changed, 17 insertions(+), 32 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 199759c73519..ab0aef15f82a 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -436,14 +436,12 @@ struct rb_event_info {
* Used for the add_timestamp
* NONE
* EXTEND - wants a time extend
- * ABSOLUTE - the buffer requests all events to have absolute time stamps
* FORCE - force a full time stamp.
*/
enum {
RB_ADD_STAMP_NONE = 0,
RB_ADD_STAMP_EXTEND = BIT(1),
- RB_ADD_STAMP_ABSOLUTE = BIT(2),
- RB_ADD_STAMP_FORCE = BIT(3)
+ RB_ADD_STAMP_FORCE = BIT(2)
};
/*
* Used for which event context the event is in.
@@ -2832,8 +2830,7 @@ static void rb_add_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
u64 *delta,
unsigned int *length)
{
- bool abs = info->add_timestamp &
- (RB_ADD_STAMP_FORCE | RB_ADD_STAMP_ABSOLUTE);
+ bool abs = info->add_timestamp & RB_ADD_STAMP_FORCE;
if (unlikely(info->delta > (1ULL << 59))) {
/*
@@ -3435,8 +3432,7 @@ static void check_buffer(struct ring_buffer_per_cpu *cpu_buffer,
if (tail == CHECK_FULL_PAGE) {
full = true;
tail = local_read(&bpage->commit);
- } else if (info->add_timestamp &
- (RB_ADD_STAMP_FORCE | RB_ADD_STAMP_ABSOLUTE)) {
+ } else if (info->add_timestamp & RB_ADD_STAMP_FORCE) {
/* Ignore events with absolute time stamps */
return;
}
@@ -3535,23 +3531,19 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
barrier();
info->ts = rb_time_stamp(cpu_buffer->buffer);
- if ((info->add_timestamp & RB_ADD_STAMP_ABSOLUTE)) {
- info->delta = info->ts;
+ /*
+ * If interrupting an event time update, we may need an
+ * absolute timestamp.
+ * Don't bother if this is the start of a new page (w == 0).
+ */
+ if (unlikely(!a_ok || !b_ok || (info->before != info->after && w))) {
+ info->add_timestamp |= RB_ADD_STAMP_FORCE | RB_ADD_STAMP_EXTEND;
+ info->length += RB_LEN_TIME_EXTEND;
} else {
- /*
- * If interrupting an event time update, we may need an
- * absolute timestamp.
- * Don't bother if this is the start of a new page (w == 0).
- */
- if (unlikely(!a_ok || !b_ok || (info->before != info->after && w))) {
- info->add_timestamp |= RB_ADD_STAMP_FORCE | RB_ADD_STAMP_EXTEND;
+ info->delta = info->ts - info->after;
+ if (unlikely(test_time_stamp(info->delta))) {
+ info->add_timestamp |= RB_ADD_STAMP_EXTEND;
info->length += RB_LEN_TIME_EXTEND;
- } else {
- info->delta = info->ts - info->after;
- if (unlikely(test_time_stamp(info->delta))) {
- info->add_timestamp |= RB_ADD_STAMP_EXTEND;
- info->length += RB_LEN_TIME_EXTEND;
- }
}
}
@@ -3586,8 +3578,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
barrier();
/*E*/ s_ok = rb_time_read(&cpu_buffer->before_stamp, &save_before);
RB_WARN_ON(cpu_buffer, !s_ok);
- if (likely(!(info->add_timestamp &
- (RB_ADD_STAMP_FORCE | RB_ADD_STAMP_ABSOLUTE))))
+ if (likely(!(info->add_timestamp & RB_ADD_STAMP_FORCE)))
/* This did not interrupt any time update */
info->delta = info->ts - info->after;
else
@@ -3644,8 +3635,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
* If this is the first commit on the page, then it has the same
* timestamp as the page itself.
*/
- if (unlikely(!tail && !(info->add_timestamp &
- (RB_ADD_STAMP_FORCE | RB_ADD_STAMP_ABSOLUTE))))
+ if (unlikely(!tail && !(info->add_timestamp & RB_ADD_STAMP_FORCE)))
info->delta = 0;
/* We reserved something on the buffer */
@@ -3698,12 +3688,7 @@ rb_reserve_next_event(struct trace_buffer *buffer,
info.length = rb_calculate_event_length(length);
- if (ring_buffer_time_stamp_abs(cpu_buffer->buffer)) {
- add_ts_default = RB_ADD_STAMP_ABSOLUTE;
- info.length += RB_LEN_TIME_EXTEND;
- } else {
- add_ts_default = RB_ADD_STAMP_NONE;
- }
+ add_ts_default = RB_ADD_STAMP_NONE;
again:
info.add_timestamp = add_ts_default;
--
2.25.1
Commit b94bc80df648 ("tracing: Use a no_filter_buffering_ref to stop using the
filter buffer") switch the hist trigger to not use absolute time stamps but
left the documents incorrect, fix it.
Signed-off-by: sunliming <[email protected]>
---
Documentation/trace/histogram.rst | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst
index c1b685a38f6b..5eecf2e1c2cc 100644
--- a/Documentation/trace/histogram.rst
+++ b/Documentation/trace/histogram.rst
@@ -1667,12 +1667,11 @@ features have been added to the hist trigger support:
A note on inter-event timestamps: If common_timestamp is used in a
histogram, the trace buffer is automatically switched over to using
-absolute timestamps and the "global" trace clock, in order to avoid
-bogus timestamp differences with other clocks that aren't coherent
-across CPUs. This can be overridden by specifying one of the other
-trace clocks instead, using the "clock=XXX" hist trigger attribute,
-where XXX is any of the clocks listed in the tracing/trace_clock
-pseudo-file.
+the "global" trace clock, in order to avoid bogus timestamp differences
+with other clocks that aren't coherent across CPUs. This can be overridden
+by specifying one of the other trace clocks instead, using the "clock=XXX"
+hist trigger attribute, where XXX is any of the clocks listed in the
+tracing/trace_clock pseudo-file.
These features are described in more detail in the following sections.
--
2.25.1