<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/kernel/trace/ring_buffer.c, branch v2.6.31.12</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>ring-buffer: Fix memleak in ring_buffer_free()</title>
<updated>2009-08-07T16:46:39+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2009-08-07T10:49:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=bd3f02212d6a457267e0c9c02c426151c436d9d4'/>
<id>bd3f02212d6a457267e0c9c02c426151c436d9d4</id>
<content type='text'>
I noticed oprofile memleaked in linux-2.6 current tree,
and tracked this ring-buffer leak.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
LKML-Reference: &lt;4A7C06B9.2090302@gmail.com&gt;
Cc: stable@kernel.org
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed oprofile memleaked in linux-2.6 current tree,
and tracked this ring-buffer leak.

Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
LKML-Reference: &lt;4A7C06B9.2090302@gmail.com&gt;
Cc: stable@kernel.org
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: Fix advance of reader in rb_buffer_peek()</title>
<updated>2009-08-06T12:20:25+00:00</updated>
<author>
<name>Robert Richter</name>
<email>robert.richter@amd.com</email>
</author>
<published>2009-07-30T17:19:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=469535a598f28c13a2a42037e1b778f671af1d16'/>
<id>469535a598f28c13a2a42037e1b778f671af1d16</id>
<content type='text'>
When calling rb_buffer_peek() from ring_buffer_consume() and a
padding event is returned, the function rb_advance_reader() is
called twice. This may lead to missing samples or under high
workloads to the warning below. This patch fixes this. If a padding
event is returned by rb_buffer_peek() it will be consumed by the
calling function now.

Also, I simplified some code in ring_buffer_consume().

------------[ cut here ]------------
WARNING: at /dev/shm/.source/linux/kernel/trace/ring_buffer.c:2289 rb_advance_reader+0x2e/0xc5()
Hardware name: Anaheim
Modules linked in:
Pid: 29, comm: events/2 Tainted: G        W  2.6.31-rc3-oprofile-x86_64-standard-00059-g5050dc2 #1
Call Trace:
[&lt;ffffffff8106776f&gt;] ? rb_advance_reader+0x2e/0xc5
[&lt;ffffffff81039ffe&gt;] warn_slowpath_common+0x77/0x8f
[&lt;ffffffff8103a025&gt;] warn_slowpath_null+0xf/0x11
[&lt;ffffffff8106776f&gt;] rb_advance_reader+0x2e/0xc5
[&lt;ffffffff81068bda&gt;] ring_buffer_consume+0xa0/0xd2
[&lt;ffffffff81326933&gt;] op_cpu_buffer_read_entry+0x21/0x9e
[&lt;ffffffff810be3af&gt;] ? __find_get_block+0x4b/0x165
[&lt;ffffffff8132749b&gt;] sync_buffer+0xa5/0x401
[&lt;ffffffff810be3af&gt;] ? __find_get_block+0x4b/0x165
[&lt;ffffffff81326c1b&gt;] ? wq_sync_buffer+0x0/0x78
[&lt;ffffffff81326c76&gt;] wq_sync_buffer+0x5b/0x78
[&lt;ffffffff8104aa30&gt;] worker_thread+0x113/0x1ac
[&lt;ffffffff8104dd95&gt;] ? autoremove_wake_function+0x0/0x38
[&lt;ffffffff8104a91d&gt;] ? worker_thread+0x0/0x1ac
[&lt;ffffffff8104dc9a&gt;] kthread+0x88/0x92
[&lt;ffffffff8100bdba&gt;] child_rip+0xa/0x20
[&lt;ffffffff8104dc12&gt;] ? kthread+0x0/0x92
[&lt;ffffffff8100bdb0&gt;] ? child_rip+0x0/0x20
---[ end trace f561c0a58fcc89bd ]---

Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: &lt;stable@kernel.org&gt;
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When calling rb_buffer_peek() from ring_buffer_consume() and a
padding event is returned, the function rb_advance_reader() is
called twice. This may lead to missing samples or under high
workloads to the warning below. This patch fixes this. If a padding
event is returned by rb_buffer_peek() it will be consumed by the
calling function now.

Also, I simplified some code in ring_buffer_consume().

------------[ cut here ]------------
WARNING: at /dev/shm/.source/linux/kernel/trace/ring_buffer.c:2289 rb_advance_reader+0x2e/0xc5()
Hardware name: Anaheim
Modules linked in:
Pid: 29, comm: events/2 Tainted: G        W  2.6.31-rc3-oprofile-x86_64-standard-00059-g5050dc2 #1
Call Trace:
[&lt;ffffffff8106776f&gt;] ? rb_advance_reader+0x2e/0xc5
[&lt;ffffffff81039ffe&gt;] warn_slowpath_common+0x77/0x8f
[&lt;ffffffff8103a025&gt;] warn_slowpath_null+0xf/0x11
[&lt;ffffffff8106776f&gt;] rb_advance_reader+0x2e/0xc5
[&lt;ffffffff81068bda&gt;] ring_buffer_consume+0xa0/0xd2
[&lt;ffffffff81326933&gt;] op_cpu_buffer_read_entry+0x21/0x9e
[&lt;ffffffff810be3af&gt;] ? __find_get_block+0x4b/0x165
[&lt;ffffffff8132749b&gt;] sync_buffer+0xa5/0x401
[&lt;ffffffff810be3af&gt;] ? __find_get_block+0x4b/0x165
[&lt;ffffffff81326c1b&gt;] ? wq_sync_buffer+0x0/0x78
[&lt;ffffffff81326c76&gt;] wq_sync_buffer+0x5b/0x78
[&lt;ffffffff8104aa30&gt;] worker_thread+0x113/0x1ac
[&lt;ffffffff8104dd95&gt;] ? autoremove_wake_function+0x0/0x38
[&lt;ffffffff8104a91d&gt;] ? worker_thread+0x0/0x1ac
[&lt;ffffffff8104dc9a&gt;] kthread+0x88/0x92
[&lt;ffffffff8100bdba&gt;] child_rip+0xa/0x20
[&lt;ffffffff8104dc12&gt;] ? kthread+0x0/0x92
[&lt;ffffffff8100bdb0&gt;] ? child_rip+0x0/0x20
---[ end trace f561c0a58fcc89bd ]---

Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: &lt;stable@kernel.org&gt;
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: do not disable ring buffer on oops_in_progress</title>
<updated>2009-08-06T00:20:00+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-08-05T19:26:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=464e85eb0e63096bd52e4c3e2a6fb8357fb95828'/>
<id>464e85eb0e63096bd52e4c3e2a6fb8357fb95828</id>
<content type='text'>
The commit:

  commit e0fdace10e75dac67d906213b780ff1b1a4cc360
  Author: David Miller &lt;davem@davemloft.net&gt;
  Date:   Fri Aug 1 01:11:22 2008 -0700

    debug_locks: set oops_in_progress if we will log messages.

    Otherwise lock debugging messages on runqueue locks can deadlock the
    system due to the wakeups performed by printk().

    Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
    Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;

Will permanently set oops_in_progress on any lockdep failure.
When this triggers it will cause any read from the ring buffer to
permanently disable the ring buffer (not to mention no locking of
printk).

This patch removes the check. It keeps the print in NMI which makes
sense. This is probably OK, since the ring buffer should not cause
something to set oops_in_progress anyway.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The commit:

  commit e0fdace10e75dac67d906213b780ff1b1a4cc360
  Author: David Miller &lt;davem@davemloft.net&gt;
  Date:   Fri Aug 1 01:11:22 2008 -0700

    debug_locks: set oops_in_progress if we will log messages.

    Otherwise lock debugging messages on runqueue locks can deadlock the
    system due to the wakeups performed by printk().

    Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
    Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;

Will permanently set oops_in_progress on any lockdep failure.
When this triggers it will cause any read from the ring buffer to
permanently disable the ring buffer (not to mention no locking of
printk).

This patch removes the check. It keeps the print in NMI which makes
sense. This is probably OK, since the ring buffer should not cause
something to set oops_in_progress anyway.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: fix check of try_to_discard result</title>
<updated>2009-08-06T00:19:59+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-08-05T16:02:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0f2541d299d233eddddee4345795e0c46264fd56'/>
<id>0f2541d299d233eddddee4345795e0c46264fd56</id>
<content type='text'>
The function ring_buffer_discard_commit inversed the code path
of the result of try_to_discard. It should skip incrementing the
entry counter if try_to_discard succeeded. But instead, it increments
the entry conder if it succeeded to discard, and does not increment
it if it fails.

The result of this bug is that filtering will make the stat counters
incorrect.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function ring_buffer_discard_commit inversed the code path
of the result of try_to_discard. It should skip incrementing the
entry counter if try_to_discard succeeded. But instead, it increments
the entry conder if it succeeded to discard, and does not increment
it if it fails.

The result of this bug is that filtering will make the stat counters
incorrect.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: Make it generally available</title>
<updated>2009-06-25T08:31:30+00:00</updated>
<author>
<name>Paul Mundt</name>
<email>lethal@linux-sh.org</email>
</author>
<published>2009-06-25T05:30:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1155de47cd66d0c496d5a6fb2223e980ef1285b2'/>
<id>1155de47cd66d0c496d5a6fb2223e980ef1285b2</id>
<content type='text'>
In hunting down the cause for the hwlat_detector ring buffer spew in
my failed -next builds it became obvious that folks are now treating
ring_buffer as something that is generic independent of tracing and thus,
suitable for public driver consumption.

Given that there are only a few minor areas in ring_buffer that have any
reliance on CONFIG_TRACING or CONFIG_FUNCTION_TRACER, provide stubs for
those and make it generally available.

Signed-off-by: Paul Mundt &lt;lethal@linux-sh.org&gt;
Cc: Jon Masters &lt;jcm@jonmasters.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
LKML-Reference: &lt;20090625053012.GB19944@linux-sh.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In hunting down the cause for the hwlat_detector ring buffer spew in
my failed -next builds it became obvious that folks are now treating
ring_buffer as something that is generic independent of tracing and thus,
suitable for public driver consumption.

Given that there are only a few minor areas in ring_buffer that have any
reliance on CONFIG_TRACING or CONFIG_FUNCTION_TRACER, provide stubs for
those and make it generally available.

Signed-off-by: Paul Mundt &lt;lethal@linux-sh.org&gt;
Cc: Jon Masters &lt;jcm@jonmasters.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
LKML-Reference: &lt;20090625053012.GB19944@linux-sh.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2009-06-20T17:56:46+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-06-20T17:56:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b0b7065b64fe517b4a50915a1555e8ee98890d64'/>
<id>b0b7065b64fe517b4a50915a1555e8ee98890d64</id>
<content type='text'>
* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (24 commits)
  tracing/urgent: warn in case of ftrace_start_up inbalance
  tracing/urgent: fix unbalanced ftrace_start_up
  function-graph: add stack frame test
  function-graph: disable when both x86_32 and optimize for size are configured
  ring-buffer: have benchmark test print to trace buffer
  ring-buffer: do not grab locks in nmi
  ring-buffer: add locks around rb_per_cpu_empty
  ring-buffer: check for less than two in size allocation
  ring-buffer: remove useless compile check for buffer_page size
  ring-buffer: remove useless warn on check
  ring-buffer: use BUF_PAGE_HDR_SIZE in calculating index
  tracing: update sample event documentation
  tracing/filters: fix race between filter setting and module unload
  tracing/filters: free filter_string in destroy_preds()
  ring-buffer: use commit counters for commit pointer accounting
  ring-buffer: remove unused variable
  ring-buffer: have benchmark test handle discarded events
  ring-buffer: prevent adding write in discarded area
  tracing/filters: strloc should be unsigned short
  tracing/filters: operand can be negative
  ...

Fix up kmemcheck-induced conflict in kernel/trace/ring_buffer.c manually
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (24 commits)
  tracing/urgent: warn in case of ftrace_start_up inbalance
  tracing/urgent: fix unbalanced ftrace_start_up
  function-graph: add stack frame test
  function-graph: disable when both x86_32 and optimize for size are configured
  ring-buffer: have benchmark test print to trace buffer
  ring-buffer: do not grab locks in nmi
  ring-buffer: add locks around rb_per_cpu_empty
  ring-buffer: check for less than two in size allocation
  ring-buffer: remove useless compile check for buffer_page size
  ring-buffer: remove useless warn on check
  ring-buffer: use BUF_PAGE_HDR_SIZE in calculating index
  tracing: update sample event documentation
  tracing/filters: fix race between filter setting and module unload
  tracing/filters: free filter_string in destroy_preds()
  ring-buffer: use commit counters for commit pointer accounting
  ring-buffer: remove unused variable
  ring-buffer: have benchmark test handle discarded events
  ring-buffer: prevent adding write in discarded area
  tracing/filters: strloc should be unsigned short
  tracing/filters: operand can be negative
  ...

Fix up kmemcheck-induced conflict in kernel/trace/ring_buffer.c manually
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: do not grab locks in nmi</title>
<updated>2009-06-17T18:16:27+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-06-17T01:22:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8d707e8eb4de4b930573155ab4df4b3270ee25dd'/>
<id>8d707e8eb4de4b930573155ab4df4b3270ee25dd</id>
<content type='text'>
If ftrace_dump_on_oops is set, and an NMI detects a lockup, then it
will need to read from the ring buffer. But the read side of the
ring buffer still takes locks. This patch adds a check on the read
side that if it is in an NMI, then it will disable the ring buffer
and not take any locks.

Reads can still happen on a disabled ring buffer.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If ftrace_dump_on_oops is set, and an NMI detects a lockup, then it
will need to read from the ring buffer. But the read side of the
ring buffer still takes locks. This patch adds a check on the read
side that if it is in an NMI, then it will disable the ring buffer
and not take any locks.

Reads can still happen on a disabled ring buffer.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: add locks around rb_per_cpu_empty</title>
<updated>2009-06-17T18:16:23+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-06-17T04:39:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d47882078f05c2cb46b85f1e12a58ed9315b9d63'/>
<id>d47882078f05c2cb46b85f1e12a58ed9315b9d63</id>
<content type='text'>
The checking of whether the buffer is empty or not needs to be serialized
among the readers. Add the reader spin lock around it.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The checking of whether the buffer is empty or not needs to be serialized
among the readers. Add the reader spin lock around it.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: check for less than two in size allocation</title>
<updated>2009-06-17T18:16:20+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-06-17T18:11:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5f78abeebbf0a80975d719e11374535ca15396cb'/>
<id>5f78abeebbf0a80975d719e11374535ca15396cb</id>
<content type='text'>
The ring buffer must have at least two pages allocated for the
reader page swap to work.

The page count check will miss the case of a zero size passed in.
Even though a zero size ring buffer would probably fail an allocation,
making the min size check for less than two instead of equal to one makes
the code a bit more robust.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The ring buffer must have at least two pages allocated for the
reader page swap to work.

The page count check will miss the case of a zero size passed in.
Even though a zero size ring buffer would probably fail an allocation,
making the min size check for less than two instead of equal to one makes
the code a bit more robust.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: remove useless compile check for buffer_page size</title>
<updated>2009-06-17T18:16:07+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2009-06-17T18:03:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0dcd4d6c3e5b17ccf88d41cb354bb4d57cb18cbf'/>
<id>0dcd4d6c3e5b17ccf88d41cb354bb4d57cb18cbf</id>
<content type='text'>
The original version of the ring buffer had a hack to map the
page struct that held the pages of the buffer to also be the structure
that the ring buffer would keep the pages in a link list.

This overlap of the page struct was very dangerous and that hack was
removed a while ago.

But there was a check to make sure the buffer_page never became bigger
than the page struct, and would fail the compile if it did. The
check was only meaningful when we had the hack. Now that we have separate
allocated descriptors for the buffer pages, we can remove this check.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The original version of the ring buffer had a hack to map the
page struct that held the pages of the buffer to also be the structure
that the ring buffer would keep the pages in a link list.

This overlap of the page struct was very dangerous and that hack was
removed a while ago.

But there was a check to make sure the buffer_page never became bigger
than the page struct, and would fail the compile if it did. The
check was only meaningful when we had the hack. Now that we have separate
allocated descriptors for the buffer pages, we can remove this check.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
