Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304945
b: refs/heads/master
c: 659f451
h: refs/heads/master
i:
  304943: 28cd2c9
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 16, 2012
1 parent 42b353b commit b11dc02
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5040b4b7bcc26a311c799d46f67174bcb20d05dd
refs/heads/master: 659f451ff21315ebfeeb46b9adccee8ce1b52c25
29 changes: 29 additions & 0 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,29 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
}

out:
/*
* The ring buffer resize can happen with the ring buffer
* enabled, so that the update disturbs the tracing as little
* as possible. But if the buffer is disabled, we do not need
* to worry about that, and we can take the time to verify
* that the buffer is not corrupt.
*/
if (atomic_read(&buffer->record_disabled)) {
atomic_inc(&buffer->record_disabled);
/*
* Even though the buffer was disabled, we must make sure
* that it is truly disabled before calling rb_check_pages.
* There could have been a race between checking
* record_disable and incrementing it.
*/
synchronize_sched();
for_each_buffer_cpu(buffer, cpu) {
cpu_buffer = buffer->buffers[cpu];
rb_check_pages(cpu_buffer);
}
atomic_dec(&buffer->record_disabled);
}

mutex_unlock(&buffer->mutex);
return size;

Expand Down Expand Up @@ -3750,6 +3773,12 @@ ring_buffer_read_finish(struct ring_buffer_iter *iter)
{
struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer;

/*
* Ring buffer is disabled from recording, here's a good place
* to check the integrity of the ring buffer.
*/
rb_check_pages(cpu_buffer);

atomic_dec(&cpu_buffer->record_disabled);
atomic_dec(&cpu_buffer->buffer->resize_disabled);
kfree(iter);
Expand Down

0 comments on commit b11dc02

Please sign in to comment.