<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/oprofile, branch v3.2.38</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/oprofile?h=v3.2.38</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/oprofile?h=v3.2.38'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-07-04T04:44:25Z</updated>
<entry>
<title>oprofile: perf: use NR_CPUS instead or nr_cpumask_bits for static array</title>
<updated>2012-07-04T04:44:25Z</updated>
<author>
<name>Will Deacon</name>
<email>will.deacon@arm.com</email>
</author>
<published>2012-06-08T15:16:04Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3b8a121217806b5fcc2127298c52c0b499cc687b'/>
<id>urn:sha1:3b8a121217806b5fcc2127298c52c0b499cc687b</id>
<content type='text'>
commit e734568b675c985db2026848fefaac01c22977a5 upstream.

The OProfile perf backend uses a static array to keep track of the
perf events on the system. When compiling with CONFIG_CPUMASK_OFFSTACK=y
&amp;&amp; SMP, nr_cpumask_bits is not a compile-time constant and the build
will fail with:

oprofile_perf.c:28: error: variably modified 'perf_events' at file scope

This patch uses NR_CPUs instead of nr_cpumask_bits for the array
initialisation. If this causes space problems in the future, we can
always move to dynamic allocation for the events array.

Cc: Matt Fleming &lt;matt@console-pimps.org&gt;
Reported-by: Russell King - ARM Linux &lt;linux@arm.linux.org.uk&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>oprofile: Fix uninitialized memory access when writing to writing to oprofilefs</title>
<updated>2011-12-19T16:18:43Z</updated>
<author>
<name>Robert Richter</name>
<email>robert.richter@amd.com</email>
</author>
<published>2011-12-19T15:38:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=913050b91eb94f194392dd797b1ff3779f606ac0'/>
<id>urn:sha1:913050b91eb94f194392dd797b1ff3779f606ac0</id>
<content type='text'>
If oprofilefs_ulong_from_user() is called with count equals
zero, *val remains unchanged. Depending on the implementation it
might be uninitialized.

Change oprofilefs_ulong_from_user()'s interface to return count
on success. Thus, we are able to return early if count equals
zero which avoids using *val uninitialized. Fixing all users of
oprofilefs_ulong_ from_user().

This follows write syscall implementation when count is zero:
"If count is zero ... [and if] no errors are detected, 0 will be
returned without causing any other effect." (man 2 write)

Reported-By: Mike Waychison &lt;mikew@google.com&gt;
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Cc: oprofile-list &lt;oprofile-list@lists.sourceforge.net&gt;
Link: http://lkml.kernel.org/r/20111219153830.GH16765@erda.amd.com
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>Merge branch 'urgent' of git://amd64.org/linux/rric into perf/urgent</title>
<updated>2011-11-15T10:03:30Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2011-11-15T10:03:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4a1dba72384193753e44e15d9d05a50be6587271'/>
<id>urn:sha1:4a1dba72384193753e44e15d9d05a50be6587271</id>
<content type='text'>
</content>
</entry>
<entry>
<title>oprofile: Fix crash when unloading module (hr timer mode)</title>
<updated>2011-11-04T14:04:33Z</updated>
<author>
<name>Robert Richter</name>
<email>robert.richter@amd.com</email>
</author>
<published>2011-10-07T14:31:46Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=87121ca504fd1d963a66b3fb0c72054b0fd9a177'/>
<id>urn:sha1:87121ca504fd1d963a66b3fb0c72054b0fd9a177</id>
<content type='text'>
Oprofile may crash in a KVM guest while unlaoding modules. This
happens if oprofile_arch_init() fails and oprofile switches to the hr
timer mode as a fallback. In this case oprofile_arch_exit() is called,
but it never was initialized properly which causes the crash. This
patch fixes this.

oprofile: using timer interrupt.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [&lt;ffffffff8123c226&gt;] unregister_syscore_ops+0x41/0x58
PGD 41da3f067 PUD 41d80e067 PMD 0
Oops: 0002 [#1] PREEMPT SMP
CPU 5
Modules linked in: oprofile(-)

Pid: 2382, comm: modprobe Not tainted 3.1.0-rc7-00018-g709a39d #18 Advanced Micro Device Anaheim/Anaheim
RIP: 0010:[&lt;ffffffff8123c226&gt;]  [&lt;ffffffff8123c226&gt;] unregister_syscore_ops+0x41/0x58
RSP: 0018:ffff88041de1de98  EFLAGS: 00010296
RAX: 0000000000000000 RBX: ffffffffa00060e0 RCX: dead000000200200
RDX: 0000000000000000 RSI: dead000000100100 RDI: ffffffff8178c620
RBP: ffff88041de1dea8 R08: 0000000000000001 R09: 0000000000000082
R10: 0000000000000000 R11: ffff88041de1dde8 R12: 0000000000000080
R13: fffffffffffffff5 R14: 0000000000000001 R15: 0000000000610210
FS:  00007f9ae5bef700(0000) GS:ffff88042fd40000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000008 CR3: 000000041ca44000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process modprobe (pid: 2382, threadinfo ffff88041de1c000, task ffff88042db6d040)
Stack:
 ffff88041de1deb8 ffffffffa0006770 ffff88041de1deb8 ffffffffa000251e
 ffff88041de1dec8 ffffffffa00022c2 ffff88041de1ded8 ffffffffa0004993
 ffff88041de1df78 ffffffff81073115 656c69666f72706f 0000000000610200
Call Trace:
 [&lt;ffffffffa000251e&gt;] op_nmi_exit+0x15/0x17 [oprofile]
 [&lt;ffffffffa00022c2&gt;] oprofile_arch_exit+0xe/0x10 [oprofile]
 [&lt;ffffffffa0004993&gt;] oprofile_exit+0x13/0x15 [oprofile]
 [&lt;ffffffff81073115&gt;] sys_delete_module+0x1c3/0x22f
 [&lt;ffffffff811bf09e&gt;] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [&lt;ffffffff8148070b&gt;] system_call_fastpath+0x16/0x1b
Code: 20 c6 78 81 e8 c5 cc 23 00 48 8b 13 48 8b 43 08 48 be 00 01 10 00 00 00 ad de 48 b9 00 02 20 00 00 00 ad de 48 c7 c7 20 c6 78 81
 89 42 08 48 89 10 48 89 33 48 89 4b 08 e8 a6 c0 23 00 5a 5b
RIP  [&lt;ffffffff8123c226&gt;] unregister_syscore_ops+0x41/0x58
 RSP &lt;ffff88041de1de98&gt;
CR2: 0000000000000008
---[ end trace 06d4e95b6aa3b437 ]---

CC: stable@kernel.org # 2.6.37+
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
<entry>
<title>locking, oprofile: Annotate oprofilefs lock as raw</title>
<updated>2011-09-13T09:12:05Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2009-07-25T14:18:34Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2d21a29fb62f142b8a62496700d8d82a6a8fd783'/>
<id>urn:sha1:2d21a29fb62f142b8a62496700d8d82a6a8fd783</id>
<content type='text'>
The oprofilefs_lock can be taken in atomic context (in profiling
interrupts) and therefore cannot cannot be preempted on -rt -
annotate it.

In mainline this change documents the low level nature of
the lock - otherwise there's no functional difference. Lockdep
and Sparse checking will work as usual.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>atomic: use &lt;linux/atomic.h&gt;</title>
<updated>2011-07-26T23:49:47Z</updated>
<author>
<name>Arun Sharma</name>
<email>asharma@fb.com</email>
</author>
<published>2011-07-26T23:09:06Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=60063497a95e716c9a689af3be2687d261f115b4'/>
<id>urn:sha1:60063497a95e716c9a689af3be2687d261f115b4</id>
<content type='text'>
This allows us to move duplicated code in &lt;asm/atomic.h&gt;
(atomic_inc_not_zero() for now) to &lt;linux/atomic.h&gt;

Signed-off-by: Arun Sharma &lt;asharma@fb.com&gt;
Reviewed-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Acked-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>perf: Remove the nmi parameter from the oprofile_perf backend</title>
<updated>2011-07-21T18:41:58Z</updated>
<author>
<name>Will Deacon</name>
<email>will.deacon@arm.com</email>
</author>
<published>2011-07-08T17:34:42Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7fcfd1abd6480d3b9ef17f5759c175e036e835cf'/>
<id>urn:sha1:7fcfd1abd6480d3b9ef17f5759c175e036e835cf</id>
<content type='text'>
In commit a8b0ca17b80e ("perf: Remove the nmi parameter from the
swevent and overflow interface") one site was overlooked.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/20110708173442.GB31972@e102144-lin.cambridge.arm.com
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf: Add context field to perf_event</title>
<updated>2011-07-01T09:06:38Z</updated>
<author>
<name>Avi Kivity</name>
<email>avi@redhat.com</email>
</author>
<published>2011-06-29T15:42:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=4dc0da86967d5463708631d02a70cfed5b104884'/>
<id>urn:sha1:4dc0da86967d5463708631d02a70cfed5b104884</id>
<content type='text'>
The perf_event overflow handler does not receive any caller-derived
argument, so many callers need to resort to looking up the perf_event
in their local data structure.  This is ugly and doesn't scale if a
single callback services many perf_events.

Fix by adding a context parameter to perf_event_create_kernel_counter()
(and derived hardware breakpoints APIs) and storing it in the perf_event.
The field can be accessed from the callback as event-&gt;overflow_handler_context.
All callers are updated.

Signed-off-by: Avi Kivity &lt;avi@redhat.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/1309362157-6596-2-git-send-email-avi@redhat.com
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>oprofile: Fix locking dependency in sync_start()</title>
<updated>2011-05-31T14:33:34Z</updated>
<author>
<name>Robert Richter</name>
<email>robert.richter@amd.com</email>
</author>
<published>2011-05-26T16:39:35Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=130c5ce716c9bfd1c2a2ec840a746eb7ff9ce1e6'/>
<id>urn:sha1:130c5ce716c9bfd1c2a2ec840a746eb7ff9ce1e6</id>
<content type='text'>
This fixes the A-&gt;B/B-&gt;A locking dependency, see the warning below.

The function task_exit_notify() is called with (task_exit_notifier)
.rwsem set and then calls sync_buffer() which locks buffer_mutex. In
sync_start() the buffer_mutex was set to prevent notifier functions to
be started before sync_start() is finished. But when registering the
notifier, (task_exit_notifier).rwsem is locked too, but now in
different order than in sync_buffer(). In theory this causes a locking
dependency, what does not occur in practice since task_exit_notify()
is always called after the notifier is registered which means the lock
is already released.

However, after checking the notifier functions it turned out the
buffer_mutex in sync_start() is unnecessary. This is because
sync_buffer() may be called from the notifiers even if sync_start()
did not finish yet, the buffers are already allocated but empty. No
need to protect this with the mutex.

So we fix this theoretical locking dependency by removing buffer_mutex
in sync_start(). This is similar to the implementation before commit:

 750d857 oprofile: fix crash when accessing freed task structs

which introduced the locking dependency.

Lockdep warning:

oprofiled/4447 is trying to acquire lock:
 (buffer_mutex){+.+...}, at: [&lt;ffffffffa0000e55&gt;] sync_buffer+0x31/0x3ec [oprofile]

but task is already holding lock:
 ((task_exit_notifier).rwsem){++++..}, at: [&lt;ffffffff81058026&gt;] __blocking_notifier_call_chain+0x39/0x67

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 ((task_exit_notifier).rwsem){++++..}:
       [&lt;ffffffff8106557f&gt;] lock_acquire+0xf8/0x11e
       [&lt;ffffffff81463a2b&gt;] down_write+0x44/0x67
       [&lt;ffffffff810581c0&gt;] blocking_notifier_chain_register+0x52/0x8b
       [&lt;ffffffff8105a6ac&gt;] profile_event_register+0x2d/0x2f
       [&lt;ffffffffa00013c1&gt;] sync_start+0x47/0xc6 [oprofile]
       [&lt;ffffffffa00001bb&gt;] oprofile_setup+0x60/0xa5 [oprofile]
       [&lt;ffffffffa00014e3&gt;] event_buffer_open+0x59/0x8c [oprofile]
       [&lt;ffffffff810cd3b9&gt;] __dentry_open+0x1eb/0x308
       [&lt;ffffffff810cd59d&gt;] nameidata_to_filp+0x60/0x67
       [&lt;ffffffff810daad6&gt;] do_last+0x5be/0x6b2
       [&lt;ffffffff810dbc33&gt;] path_openat+0xc7/0x360
       [&lt;ffffffff810dbfc5&gt;] do_filp_open+0x3d/0x8c
       [&lt;ffffffff810ccfd2&gt;] do_sys_open+0x110/0x1a9
       [&lt;ffffffff810cd09e&gt;] sys_open+0x20/0x22
       [&lt;ffffffff8146ad4b&gt;] system_call_fastpath+0x16/0x1b

-&gt; #0 (buffer_mutex){+.+...}:
       [&lt;ffffffff81064dfb&gt;] __lock_acquire+0x1085/0x1711
       [&lt;ffffffff8106557f&gt;] lock_acquire+0xf8/0x11e
       [&lt;ffffffff814634f0&gt;] mutex_lock_nested+0x63/0x309
       [&lt;ffffffffa0000e55&gt;] sync_buffer+0x31/0x3ec [oprofile]
       [&lt;ffffffffa0001226&gt;] task_exit_notify+0x16/0x1a [oprofile]
       [&lt;ffffffff81467b96&gt;] notifier_call_chain+0x37/0x63
       [&lt;ffffffff8105803d&gt;] __blocking_notifier_call_chain+0x50/0x67
       [&lt;ffffffff81058068&gt;] blocking_notifier_call_chain+0x14/0x16
       [&lt;ffffffff8105a718&gt;] profile_task_exit+0x1a/0x1c
       [&lt;ffffffff81039e8f&gt;] do_exit+0x2a/0x6fc
       [&lt;ffffffff8103a5e4&gt;] do_group_exit+0x83/0xae
       [&lt;ffffffff8103a626&gt;] sys_exit_group+0x17/0x1b
       [&lt;ffffffff8146ad4b&gt;] system_call_fastpath+0x16/0x1b

other info that might help us debug this:

1 lock held by oprofiled/4447:
 #0:  ((task_exit_notifier).rwsem){++++..}, at: [&lt;ffffffff81058026&gt;] __blocking_notifier_call_chain+0x39/0x67

stack backtrace:
Pid: 4447, comm: oprofiled Not tainted 2.6.39-00007-gcf4d8d4 #10
Call Trace:
 [&lt;ffffffff81063193&gt;] print_circular_bug+0xae/0xbc
 [&lt;ffffffff81064dfb&gt;] __lock_acquire+0x1085/0x1711
 [&lt;ffffffffa0000e55&gt;] ? sync_buffer+0x31/0x3ec [oprofile]
 [&lt;ffffffff8106557f&gt;] lock_acquire+0xf8/0x11e
 [&lt;ffffffffa0000e55&gt;] ? sync_buffer+0x31/0x3ec [oprofile]
 [&lt;ffffffff81062627&gt;] ? mark_lock+0x42f/0x552
 [&lt;ffffffffa0000e55&gt;] ? sync_buffer+0x31/0x3ec [oprofile]
 [&lt;ffffffff814634f0&gt;] mutex_lock_nested+0x63/0x309
 [&lt;ffffffffa0000e55&gt;] ? sync_buffer+0x31/0x3ec [oprofile]
 [&lt;ffffffffa0000e55&gt;] sync_buffer+0x31/0x3ec [oprofile]
 [&lt;ffffffff81058026&gt;] ? __blocking_notifier_call_chain+0x39/0x67
 [&lt;ffffffff81058026&gt;] ? __blocking_notifier_call_chain+0x39/0x67
 [&lt;ffffffffa0001226&gt;] task_exit_notify+0x16/0x1a [oprofile]
 [&lt;ffffffff81467b96&gt;] notifier_call_chain+0x37/0x63
 [&lt;ffffffff8105803d&gt;] __blocking_notifier_call_chain+0x50/0x67
 [&lt;ffffffff81058068&gt;] blocking_notifier_call_chain+0x14/0x16
 [&lt;ffffffff8105a718&gt;] profile_task_exit+0x1a/0x1c
 [&lt;ffffffff81039e8f&gt;] do_exit+0x2a/0x6fc
 [&lt;ffffffff81465031&gt;] ? retint_swapgs+0xe/0x13
 [&lt;ffffffff8103a5e4&gt;] do_group_exit+0x83/0xae
 [&lt;ffffffff8103a626&gt;] sys_exit_group+0x17/0x1b
 [&lt;ffffffff8146ad4b&gt;] system_call_fastpath+0x16/0x1b

Reported-by: Marcin Slusarz &lt;marcin.slusarz@gmail.com&gt;
Cc: Carl Love &lt;carll@us.ibm.com&gt;
Cc: &lt;stable@kernel.org&gt; # .36+
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
<entry>
<title>oprofile: Free potentially owned tasks in case of errors</title>
<updated>2011-05-31T14:33:33Z</updated>
<author>
<name>Robert Richter</name>
<email>robert.richter@amd.com</email>
</author>
<published>2011-05-26T16:22:54Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6ac6519b93065625119a347be1cbcc1b89edb773'/>
<id>urn:sha1:6ac6519b93065625119a347be1cbcc1b89edb773</id>
<content type='text'>
After registering the task free notifier we possibly have tasks in our
dying_tasks list. Free them after unregistering the notifier in case
of an error.

Cc: &lt;stable@kernel.org&gt; # .36+
Signed-off-by: Robert Richter &lt;robert.richter@amd.com&gt;
</content>
</entry>
</feed>
