<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/oprofile/cpu_buffer.c, branch linux-2.6.32.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.32.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.32.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2010-09-20T20:17:50Z</updated>
<entry>
<title>oprofile: fix crash when accessing freed task structs</title>
<updated>2010-09-20T20:17:50Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2010-08-13T14:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f4db115e77b11a8ff22bcd9a3900f03d396a7a53'/>
<id>urn:sha1:f4db115e77b11a8ff22bcd9a3900f03d396a7a53</id>
<content type='text'>
commit 750d857c682f4db60d14722d430c7ccc35070962 upstream.

This patch fixes a crash during shutdown reported below. The crash is
caused by accessing already freed task structs. The fix changes the
order for registering and unregistering notifier callbacks.

All notifiers must be initialized before buffers start working. To
stop buffer synchronization we cancel all workqueues, unregister the
notifier callback and then flush all buffers. After all of this we
finally can free all tasks listed.

This should avoid accessing freed tasks.

On 22.07.10 01:14:40, Benjamin Herrenschmidt wrote:

&gt; So the initial observation is a spinlock bad magic followed by a crash
&gt; in the spinlock debug code:
&gt;
&gt; [ 1541.586531] BUG: spinlock bad magic on CPU#5, events/5/136
&gt; [ 1541.597564] Unable to handle kernel paging request for data at address 0x6b6b6b6b6b6b6d03
&gt;
&gt; Backtrace looks like:
&gt;
&gt;       spin_bug+0x74/0xd4
&gt;       ._raw_spin_lock+0x48/0x184
&gt;       ._spin_lock+0x10/0x24
&gt;       .get_task_mm+0x28/0x8c
&gt;       .sync_buffer+0x1b4/0x598
&gt;       .wq_sync_buffer+0xa0/0xdc
&gt;       .worker_thread+0x1d8/0x2a8
&gt;       .kthread+0xa8/0xb4
&gt;       .kernel_thread+0x54/0x70
&gt;
&gt; So we are accessing a freed task struct in the work queue when
&gt; processing the samples.

Reported-by: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>oprofile: remove double ring buffering</title>
<updated>2010-07-05T18:10:27Z</updated>
<author>
<name>Andi Kleen</name>
</author>
<published>2010-04-01T01:17:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6f92c079c8a248a1b714f34c221356bbda97b585'/>
<id>urn:sha1:6f92c079c8a248a1b714f34c221356bbda97b585</id>
<content type='text'>
commit cb6e943ccf19ab6d3189147e9d625a992e016084 upstream.

oprofile used a double buffer scheme for its cpu event buffer
to avoid races on reading with the old locked ring buffer.

But that is obsolete now with the new ring buffer, so simply
use a single buffer. This greatly simplifies the code and avoids
a lot of sample drops on large runs, especially with call graph.

Based on suggestions from Steven Rostedt

For stable kernels from v2.6.32, but not earlier.

Signed-off-by: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>x86/oprofile: introduce oprofile_add_data64()</title>
<updated>2009-06-11T18:16:00Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2009-06-03T18:54:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=51563a0e5650d0d76539625388d72d62b34c726e'/>
<id>urn:sha1:51563a0e5650d0d76539625388d72d62b34c726e</id>
<content type='text'>
The IBS implemention writes 64 bit register values to the cpu buffer
by writing two 32 values using oprofile_add_data(). This patch
introduces oprofile_add_data64() to write a single 64 bit value to the
buffer.

Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
<entry>
<title>oprofile: remove obselete include headers</title>
<updated>2009-06-11T14:10:12Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2009-05-07T14:07:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fecfe6320ba71eed6d16849683298f0894aa60de'/>
<id>urn:sha1:fecfe6320ba71eed6d16849683298f0894aa60de</id>
<content type='text'>
This became obsolete with this commit:

 6dad828 oprofile: port to the new ring_buffer

Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
<entry>
<title>oprofile: fix cpu buffer size</title>
<updated>2009-05-07T15:28:59Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2009-05-07T15:28:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=54f2c841fa0007e5fee3b7d01a911c774f0a6cda'/>
<id>urn:sha1:54f2c841fa0007e5fee3b7d01a911c774f0a6cda</id>
<content type='text'>
The unit of oprofile_cpu_buffer_size is in samples, but was allocated
in bytes. This led to the allocation of too small cpu buffers. This
patch recalculates the buffer size in bytes taking also the
ring_buffer_event header size into account.

Reported-by: Suravee Suthikulpanit &lt;suravee.suthikulpanit@amd.com&gt;
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
<entry>
<title>ring_buffer: remove unused flags parameter, fix</title>
<updated>2009-02-06T00:14:05Z</updated>
<author>
<name>Ingo Molnar</name>
</author>
<published>2009-02-06T00:12:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=304cc6ae1bf7a8e6d00053fbe0b7e2b26cdddda2'/>
<id>urn:sha1:304cc6ae1bf7a8e6d00053fbe0b7e2b26cdddda2</id>
<content type='text'>
Oprofile's ring-buffer use was not considered.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>oprofile: fix uninitialized use of struct op_entry</title>
<updated>2009-01-17T16:26:39Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2009-01-17T16:13:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fdb6a8f4db813b4e50f4e975efe6be12ba5bf460'/>
<id>urn:sha1:fdb6a8f4db813b4e50f4e975efe6be12ba5bf460</id>
<content type='text'>
Impact: fix crash

In case of losing samples struct op_entry could have been used
uninitialized causing e.g. a wrong preemption count or NULL pointer
access. This patch fixes this.

Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>oprofile: make new cpu buffer functions part of the api</title>
<updated>2009-01-07T21:48:15Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2009-01-07T20:50:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=14f0ca8eaea42a5b5a69cfcb699665dd2618db5f'/>
<id>urn:sha1:14f0ca8eaea42a5b5a69cfcb699665dd2618db5f</id>
<content type='text'>
This patch creates the new functions

 oprofile_write_reserve()
 oprofile_add_data()
 oprofile_write_commit()

and makes them part of the oprofile api.

Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
<entry>
<title>oprofile: remove #ifdef CONFIG_OPROFILE_IBS in non-ibs code</title>
<updated>2009-01-07T21:47:56Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2009-01-06T23:20:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ebf8d974e298018f0b4ee02b1b097bf5500d3d27'/>
<id>urn:sha1:ebf8d974e298018f0b4ee02b1b097bf5500d3d27</id>
<content type='text'>
The ifdefs can be removed since the code is no longer ibs specific and
can be used for other purposes as well. IBS specific code is only in
op_model_amd.c.

Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
<entry>
<title>oprofile: use new data sample format for ibs</title>
<updated>2009-01-07T21:47:23Z</updated>
<author>
<name>Robert Richter</name>
</author>
<published>2009-01-05T09:35:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1acda878e20ea0cd3708ba66dca67d52eaafdd2b'/>
<id>urn:sha1:1acda878e20ea0cd3708ba66dca67d52eaafdd2b</id>
<content type='text'>
The new ring buffer implementation allows the storage of samples with
different size. This patch implements the usage of the new sample
format to store ibs samples in the cpu buffer. Until now, writing to
the cpu buffer could lead to incomplete sampling sequences since IBS
samples were transfered in multiple samples. Due to a full buffer,
data could be lost at any time. This can't happen any more since the
complete data is reserved in advance and then stored in a single
sample.

Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
</feed>
