]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
ring-buffer: make reentrant
authorSteven Rostedt <rostedt@goodmis.org>
Sat, 4 Oct 2008 06:00:59 +0000 (02:00 -0400)
committerIngo Molnar <mingo@elte.hu>
Tue, 14 Oct 2008 08:39:19 +0000 (10:39 +0200)
commitbf41a158cacba6ca5fc6407a54e7ad8ce1567e2e
treee9424b4927f99cfb3acce3cfab2635ae8f8c8ba1
parent6f807acd27734197b11d42829d3cbb9c0937b572
ring-buffer: make reentrant

This patch replaces the local_irq_save/restore with preempt_disable/
enable. This allows for interrupts to enter while recording.
To write to the ring buffer, you must reserve data, and then
commit it. During this time, an interrupt may call a trace function
that will also record into the buffer before the commit is made.

The interrupt will reserve its entry after the first entry, even
though the first entry did not finish yet.

The time stamp delta of the interrupt entry will be zero, since
in the view of the trace, the interrupt happened during the
first field anyway.

Locking still takes place when the tail/write moves from one page
to the next. The reader always takes the locks.

A new page pointer is added, called the commit. The write/tail will
always point to the end of all entries. The commit field will
point to the last committed entry. Only this commit entry may
update the write time stamp.

The reader can only go up to the commit. It cannot go past it.

If a lot of interrupts come in during a commit that fills up the
buffer, and it happens to make it all the way around the buffer
back to the commit, then a warning is printed and new events will
be dropped.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/ring_buffer.c