<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/events/core.c, branch v3.17</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.17</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.17'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-10-02T23:28:44Z</updated>
<entry>
<title>perf: fix perf bug in fork()</title>
<updated>2014-10-02T23:28:44Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2014-10-02T23:17:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6c72e3501d0d62fc064d3680e5234f3463ec5a86'/>
<id>urn:sha1:6c72e3501d0d62fc064d3680e5234f3463ec5a86</id>
<content type='text'>
Oleg noticed that a cleanup by Sylvain actually uncovered a bug; by
calling perf_event_free_task() when failing sched_fork() we will not yet
have done the memset() on -&gt;perf_event_ctxp[] and will therefore try and
'free' the inherited contexts, which are still in use by the parent
process.  This is bad..

Suggested-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Reported-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Reported-by: Sylvain 'ythier' Hitier &lt;sylvain.hitier@gmail.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: &lt;stable@vger.kernel.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: Fix a race condition in perf_remove_from_context()</title>
<updated>2014-09-09T04:53:42Z</updated>
<author>
<name>Cong Wang</name>
<email>cwang@twopensource.com</email>
</author>
<published>2014-09-02T22:27:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3577af70a2ce4853d58e57d832e687d739281479'/>
<id>urn:sha1:3577af70a2ce4853d58e57d832e687d739281479</id>
<content type='text'>
We saw a kernel soft lockup in perf_remove_from_context(),
it looks like the `perf` process, when exiting, could not go
out of the retry loop. Meanwhile, the target process was forking
a child. So either the target process should execute the smp
function call to deactive the event (if it was running) or it should
do a context switch which deactives the event.

It seems we optimize out a context switch in perf_event_context_sched_out(),
and what's more important, we still test an obsolete task pointer when
retrying, so no one actually would deactive that event in this situation.
Fix it directly by reloading the task pointer in perf_remove_from_context().

This should cure the above soft lockup.

Signed-off-by: Cong Wang &lt;cwang@twopensource.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: http://lkml.kernel.org/r/1409696840-843-1-git-send-email-xiyou.wangcong@gmail.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Handle compat ioctl</title>
<updated>2014-08-20T07:42:13Z</updated>
<author>
<name>Pawel Moll</name>
<email>pawel.moll@arm.com</email>
</author>
<published>2014-06-13T15:03:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b3f207855f57b9c8f43a547a801340bb5cbc59e5'/>
<id>urn:sha1:b3f207855f57b9c8f43a547a801340bb5cbc59e5</id>
<content type='text'>
When running a 32-bit userspace on a 64-bit kernel (eg. i386
application on x86_64 kernel or 32-bit arm userspace on arm64
kernel) some of the perf ioctls must be treated with special
care, as they have a pointer size encoded in the command.

For example, PERF_EVENT_IOC_ID in 32-bit world will be encoded
as 0x80042407, but 64-bit kernel will expect 0x80082407. In
result the ioctl will fail returning -ENOTTY.

This patch solves the problem by adding code fixing up the
size as compat_ioctl file operation.

Reported-by: Drew Richardson &lt;drew.richardson@arm.com&gt;
Signed-off-by: Pawel Moll &lt;pawel.moll@arm.com&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Link: http://lkml.kernel.org/r/1402671812-9078-1-git-send-email-pawel.moll@arm.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'v3.16-rc7' into perf/core, to merge in the latest fixes before applying new changes</title>
<updated>2014-07-28T08:00:33Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@kernel.org</email>
</author>
<published>2014-07-28T08:00:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5030c69755416d19516c0a61cd988a0e0062e041'/>
<id>urn:sha1:5030c69755416d19516c0a61cd988a0e0062e041</id>
<content type='text'>
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Add vm_ops-&gt;name call for mmap event name retrieval</title>
<updated>2014-07-16T11:31:22Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2014-07-14T15:57:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fbe26abe118ee1262b4ab0d12fefd42647eaea35'/>
<id>urn:sha1:fbe26abe118ee1262b4ab0d12fefd42647eaea35</id>
<content type='text'>
The following patch added another way to get mmap name: 78d683e838a6
("mm, fs: Add vm_ops-&gt;name as an alternative to arch_vma_name")

The vdso vma mapping already switch to this and we no longer get vdso
name via arch_vma_name function. Adding this way to the perf mmap
event name retrieval code.

Caught this via perf test:

  $ sudo ./perf test -v 7
   7: Validate PERF_RECORD_* events &amp; perf_sample fields     :
  --- start ---

SNIP

  PERF_RECORD_MMAP for [vdso] missing!
  test child finished with 255
  ---- end ----
  Validate PERF_RECORD_* events &amp; perf_sample fields: FAILED!

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Acked-by: Andy Lutomirski &lt;luto@amacapital.net&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Corey Ashford &lt;cjashfor@linux.vnet.ibm.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/1405353439-14211-1-git-send-email-jolsa@kernel.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Fix lockdep warning on process exit</title>
<updated>2014-07-16T11:18:42Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2014-06-23T14:12:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4a1c0f262f88e2676fda80a6bf80e7dbccae1dcb'/>
<id>urn:sha1:4a1c0f262f88e2676fda80a6bf80e7dbccae1dcb</id>
<content type='text'>
Sasha Levin reported:

&gt; While fuzzing with trinity inside a KVM tools guest running the latest -next
&gt; kernel I've stumbled on the following spew:
&gt;
&gt; ======================================================
&gt; [ INFO: possible circular locking dependency detected ]
&gt; 3.15.0-next-20140613-sasha-00026-g6dd125d-dirty #654 Not tainted
&gt; -------------------------------------------------------
&gt; trinity-c578/9725 is trying to acquire lock:
&gt; (&amp;(&amp;pool-&gt;lock)-&gt;rlock){-.-...}, at: __queue_work (kernel/workqueue.c:1346)
&gt;
&gt; but task is already holding lock:
&gt; (&amp;ctx-&gt;lock){-.....}, at: perf_event_exit_task (kernel/events/core.c:7471 kernel/events/core.c:7533)
&gt;
&gt; which lock already depends on the new lock.

&gt; 1 lock held by trinity-c578/9725:
&gt; #0: (&amp;ctx-&gt;lock){-.....}, at: perf_event_exit_task (kernel/events/core.c:7471 kernel/events/core.c:7533)
&gt;
&gt;  Call Trace:
&gt;  dump_stack (lib/dump_stack.c:52)
&gt;  print_circular_bug (kernel/locking/lockdep.c:1216)
&gt;  __lock_acquire (kernel/locking/lockdep.c:1840 kernel/locking/lockdep.c:1945 kernel/locking/lockdep.c:2131 kernel/locking/lockdep.c:3182)
&gt;  lock_acquire (./arch/x86/include/asm/current.h:14 kernel/locking/lockdep.c:3602)
&gt;  _raw_spin_lock (include/linux/spinlock_api_smp.h:143 kernel/locking/spinlock.c:151)
&gt;  __queue_work (kernel/workqueue.c:1346)
&gt;  queue_work_on (kernel/workqueue.c:1424)
&gt;  free_object (lib/debugobjects.c:209)
&gt;  __debug_check_no_obj_freed (lib/debugobjects.c:715)
&gt;  debug_check_no_obj_freed (lib/debugobjects.c:727)
&gt;  kmem_cache_free (mm/slub.c:2683 mm/slub.c:2711)
&gt;  free_task (kernel/fork.c:221)
&gt;  __put_task_struct (kernel/fork.c:250)
&gt;  put_ctx (include/linux/sched.h:1855 kernel/events/core.c:898)
&gt;  perf_event_exit_task (kernel/events/core.c:907 kernel/events/core.c:7478 kernel/events/core.c:7533)
&gt;  do_exit (kernel/exit.c:766)
&gt;  do_group_exit (kernel/exit.c:884)
&gt;  get_signal_to_deliver (kernel/signal.c:2347)
&gt;  do_signal (arch/x86/kernel/signal.c:698)
&gt;  do_notify_resume (arch/x86/kernel/signal.c:751)
&gt;  int_signal (arch/x86/kernel/entry_64.S:600)

Urgh.. so the only way I can make that happen is through:

  perf_event_exit_task_context()
    raw_spin_lock(&amp;child_ctx-&gt;lock);
    unclone_ctx(child_ctx)
      put_ctx(ctx-&gt;parent_ctx);
    raw_spin_unlock_irqrestore(&amp;child_ctx-&gt;lock);

And we can avoid this by doing the change below.

I can't immediately see how this changed recently, but given that you
say it's easy to reproduce, lets fix this.

Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Dave Jones &lt;davej@redhat.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/20140623141242.GB19860@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Revert ("perf: Always destroy groups on exit")</title>
<updated>2014-07-16T11:18:39Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2014-07-15T15:27:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1903d50cba54261a6562a476c05085f3d7a54097'/>
<id>urn:sha1:1903d50cba54261a6562a476c05085f3d7a54097</id>
<content type='text'>
Vince reported that commit 15a2d4de0eab5 ("perf: Always destroy groups
on exit") causes a regression with grouped events. In particular his
read_group_attached.c test fails.

  https://github.com/deater/perf_event_tests/blob/master/tests/bugs/read_group_attached.c

Because of the context switch optimization in
perf_event_context_sched_out() the 'original' event may end up in the
child process and when that exits the change in the patch in question
destroys the actual grouping.

Therefore revert that change and only destroy inherited groups.

Reported-by: Vince Weaver &lt;vincent.weaver@maine.edu&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/n/tip-zedy3uktcp753q8fw8dagx7a@git.kernel.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Make perf_event_init_context() function static</title>
<updated>2014-07-05T09:21:52Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2014-06-24T08:20:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=985c8dcbe15ddd8a1b98dc6b9c6403cb5d7012ab'/>
<id>urn:sha1:985c8dcbe15ddd8a1b98dc6b9c6403cb5d7012ab</id>
<content type='text'>
Leftover from '8dc85d5 perf: Multiple task contexts'.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Link: http://lkml.kernel.org/r/1403598026-2310-1-git-send-email-jolsa@kernel.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Do not allow optimized switch for non-cloned events</title>
<updated>2014-07-02T06:35:56Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2014-06-24T08:20:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1f9a7268c67f0290837aada443d28fd953ddca90'/>
<id>urn:sha1:1f9a7268c67f0290837aada443d28fd953ddca90</id>
<content type='text'>
The context check in perf_event_context_sched_out allows
non-cloned context to be part of the optimized schedule
out switch.

This could move non-cloned context into another workload
child. Once this child exits, the context is closed and
leaves all original (parent) events in closed state.

Any other new cloned event will have closed state and not
measure anything. And probably causing other odd bugs.

Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Corey Ashford &lt;cjashfor@linux.vnet.ibm.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/1403598026-2310-2-git-send-email-jolsa@kernel.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'perf/core' into perf/urgent, to pick up the latest fixes</title>
<updated>2014-06-14T12:10:08Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@kernel.org</email>
</author>
<published>2014-06-14T12:10:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cf230918cda19532e4a5cc4f0d5c82fa7e5e94f6'/>
<id>urn:sha1:cf230918cda19532e4a5cc4f0d5c82fa7e5e94f6</id>
<content type='text'>
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
</feed>
