diff options
-rw-r--r-- | kernel/trace/ring_buffer.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 503b630e0bda..8c1b2d290718 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -3064,9 +3064,6 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) | |||
3064 | struct ring_buffer_event *event; | 3064 | struct ring_buffer_event *event; |
3065 | int nr_loops = 0; | 3065 | int nr_loops = 0; |
3066 | 3066 | ||
3067 | if (ring_buffer_iter_empty(iter)) | ||
3068 | return NULL; | ||
3069 | |||
3070 | cpu_buffer = iter->cpu_buffer; | 3067 | cpu_buffer = iter->cpu_buffer; |
3071 | buffer = cpu_buffer->buffer; | 3068 | buffer = cpu_buffer->buffer; |
3072 | 3069 | ||
@@ -3080,6 +3077,9 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) | |||
3080 | rb_iter_reset(iter); | 3077 | rb_iter_reset(iter); |
3081 | 3078 | ||
3082 | again: | 3079 | again: |
3080 | if (ring_buffer_iter_empty(iter)) | ||
3081 | return NULL; | ||
3082 | |||
3083 | /* | 3083 | /* |
3084 | * We repeat when a timestamp is encountered. | 3084 | * We repeat when a timestamp is encountered. |
3085 | * We can get multiple timestamps by nested interrupts or also | 3085 | * We can get multiple timestamps by nested interrupts or also |
@@ -3094,6 +3094,11 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts) | |||
3094 | if (rb_per_cpu_empty(cpu_buffer)) | 3094 | if (rb_per_cpu_empty(cpu_buffer)) |
3095 | return NULL; | 3095 | return NULL; |
3096 | 3096 | ||
3097 | if (iter->head >= local_read(&iter->head_page->page->commit)) { | ||
3098 | rb_inc_iter(iter); | ||
3099 | goto again; | ||
3100 | } | ||
3101 | |||
3097 | event = rb_iter_head_event(iter); | 3102 | event = rb_iter_head_event(iter); |
3098 | 3103 | ||
3099 | switch (event->type_len) { | 3104 | switch (event->type_len) { |