<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel, branch v3.4.58</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/kernel?h=v3.4.58</id>
<link rel='self' href='https://git.amat.us/linux/atom/kernel?h=v3.4.58'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-08-15T05:57:08Z</updated>
<entry>
<title>tracing: Fix fields of struct trace_iterator that are zeroed by mistake</title>
<updated>2013-08-15T05:57:08Z</updated>
<author>
<name>Andrew Vagin</name>
<email>avagin@openvz.org</email>
</author>
<published>2013-08-02T17:16:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=99593eb7ca1dd9bfaa431d96e009eda23f001ace'/>
<id>urn:sha1:99593eb7ca1dd9bfaa431d96e009eda23f001ace</id>
<content type='text'>
commit ed5467da0e369e65b247b99eb6403cb79172bcda upstream.

tracing_read_pipe zeros all fields bellow "seq". The declaration contains
a comment about that, but it doesn't help.

The first field is "snapshot", it's true when current open file is
snapshot. Looks obvious, that it should not be zeroed.

The second field is "started". It was converted from cpumask_t to
cpumask_var_t (v2.6.28-4983-g4462344), in other words it was
converted from cpumask to pointer on cpumask.

Currently the reference on "started" memory is lost after the first read
from tracing_read_pipe and a proper object will never be freed.

The "started" is never dereferenced for trace_pipe, because trace_pipe
can't have the TRACE_FILE_ANNOTATE options.

Link: http://lkml.kernel.org/r/1375463803-3085183-1-git-send-email-avagin@openvz.org

Signed-off-by: Andrew Vagin &lt;avagin@openvz.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>perf: Use css_tryget() to avoid propping up css refcount</title>
<updated>2013-08-11T22:38:43Z</updated>
<author>
<name>Salman Qazi</name>
<email>sqazi@google.com</email>
</author>
<published>2012-06-14T22:31:09Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2d8be9cf0668fab848b9b7740f0725ae9181b703'/>
<id>urn:sha1:2d8be9cf0668fab848b9b7740f0725ae9181b703</id>
<content type='text'>
commit 9c5da09d266ca9b32eb16cf940f8161d949c2fe5 upstream.

An rmdir pushes css's ref count to zero.  However, if the associated
directory is open at the time, the dentry ref count is non-zero.  If
the fd for this directory is then passed into perf_event_open, it
does a css_get().  This bounces the ref count back up from zero.  This
is a problem by itself.  But what makes it turn into a crash is the
fact that we end up doing an extra dput, since we perform a dput
when css_put sees the ref count go down to zero.

css_tryget() does not fall into that trap. So, we use that instead.

Reproduction test-case for the bug:

 #include &lt;unistd.h&gt;
 #include &lt;sys/types.h&gt;
 #include &lt;sys/stat.h&gt;
 #include &lt;fcntl.h&gt;
 #include &lt;linux/unistd.h&gt;
 #include &lt;linux/perf_event.h&gt;
 #include &lt;string.h&gt;
 #include &lt;errno.h&gt;
 #include &lt;stdio.h&gt;

 #define PERF_FLAG_PID_CGROUP    (1U &lt;&lt; 2)

 int perf_event_open(struct perf_event_attr *hw_event_uptr,
                     pid_t pid, int cpu, int group_fd, unsigned long flags) {
         return syscall(__NR_perf_event_open,hw_event_uptr, pid, cpu,
                 group_fd, flags);
 }

 /*
  * Directly poke at the perf_event bug, since it's proving hard to repro
  * depending on where in the kernel tree.  what moved?
  */
 int main(int argc, char **argv)
 {
        int fd;
        struct perf_event_attr attr;
        memset(&amp;attr, 0, sizeof(attr));
        attr.exclude_kernel = 1;
        attr.size = sizeof(attr);
        mkdir("/dev/cgroup/perf_event/blah", 0777);
        fd = open("/dev/cgroup/perf_event/blah", O_RDONLY);
        perror("open");
        rmdir("/dev/cgroup/perf_event/blah");
        sleep(2);
        perf_event_open(&amp;attr, fd, 0, -1,  PERF_FLAG_PID_CGROUP);
        perror("perf_event_open");
        close(fd);
        return 0;
 }

Signed-off-by: Salman Qazi &lt;sqazi@google.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Link: http://lkml.kernel.org/r/20120614223108.1025.2503.stgit@dungbeetle.mtv.corp.google.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>perf: Fix event group context move</title>
<updated>2013-08-11T22:38:43Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2013-02-01T10:23:45Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5cbff87c00cf1b8e3a077465e4ec501dd21651c8'/>
<id>urn:sha1:5cbff87c00cf1b8e3a077465e4ec501dd21651c8</id>
<content type='text'>
commit 0231bb5336758426b44ccd798ccd3c5419c95d58 upstream.

When we have group with mixed events (hw/sw) we want to end up
with group leader being in hw context. So if group leader is
initialy sw event, we move all the events under hw context.

The move is done for each event by removing it from its context
and adding it back into proper one. As a part of the removal the
event is automatically disabled, which is not what we want at
this stage of creating groups.

The fix is to initialize event state after removal from sw
context.

This fix resulted from the following discussion:

  http://thread.gmane.org/gmane.linux.kernel.perf.user/1144

Reported-by: Andreas Hollmann &lt;hollmann@in.tum.de&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Corey Ashford &lt;cjashfor@linux.vnet.ibm.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Stephane Eranian &lt;eranian@google.com&gt;
Cc: Vince Weaver &lt;vince@deater.net&gt;
Link: http://lkml.kernel.org/r/1359714225-4231-1-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Li Zefan &lt;lizefan@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>sched: Fix the broken sched_rr_get_interval()</title>
<updated>2013-08-11T22:38:43Z</updated>
<author>
<name>Zhu Yanhai</name>
<email>gaoyang.zyh@taobao.com</email>
</author>
<published>2013-01-08T04:56:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1836cd176170d39f5b1fda9cd47d3c3f0f10dad2'/>
<id>urn:sha1:1836cd176170d39f5b1fda9cd47d3c3f0f10dad2</id>
<content type='text'>
commit a59f4e079d19464eebb9b06513a1d4f55fdae5ba upstream.

The caller of sched_sliced() should pass se.cfs_rq and se as the
arguments, however in sched_rr_get_interval() we gave it
rq.cfs_rq and se, which made the following computation obviously
wrong.

The change was introduced by commit:

  77034937dc45 sched: fix crash in sys_sched_rr_get_interval()

... 5 years ago, while it had been the correct 'cfs_rq_of' before
the commit. The change seems to be irrelevant to the commit
msg, which was to return a 0 timeslice for tasks that are on an
idle runqueue. So I believe that was just a plain typo.

Signed-off-by: Zhu Yanhai &lt;gaoyang.zyh@taobao.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Paul Turner &lt;pjt@google.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/1357621012-15039-1-git-send-email-gaoyang.zyh@taobao.com
[ Since this is an ABI and an old bug, we'll test this via a
  slow upstream route, to hopefully discover any app breakage. ]
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>tracing: Fix irqs-off tag display in syscall tracing</title>
<updated>2013-08-04T08:25:45Z</updated>
<author>
<name>zhangwei(Jovi)</name>
<email>jovi.zhangwei@huawei.com</email>
</author>
<published>2013-07-29T01:33:58Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=352b6418a2d14c754b41f23e0698f0006c914b95'/>
<id>urn:sha1:352b6418a2d14c754b41f23e0698f0006c914b95</id>
<content type='text'>
commit 11034ae9c20f4057a6127fc965906417978e69b2 upstream

Initialization of variable irq_flags and pc was missed when backport
11034ae9c to linux-3.0.y and linux-3.4.y, my fault.

Signed-off-by: zhangwei(Jovi) &lt;jovi.zhangwei@huawei.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hrtimers: Move SMP function call to thread context</title>
<updated>2013-07-28T23:26:47Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2013-07-05T10:09:18Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=39367f485b87492a5e51af8496a684eafa4aec86'/>
<id>urn:sha1:39367f485b87492a5e51af8496a684eafa4aec86</id>
<content type='text'>
commit 5ec2481b7b47a4005bb446d176e5d0257400c77d upstream.

smp_call_function_* must not be called from softirq context.

But clock_was_set() which calls on_each_cpu() is called from softirq
context to implement a delayed clock_was_set() for the timer interrupt
handler. Though that almost never gets invoked. A recent change in the
resume code uses the softirq based delayed clock_was_set to support
Xens resume mechanism.

linux-next contains a new warning which warns if smp_call_function_*
is called from softirq context which gets triggered by that Xen
change.

Fix this by moving the delayed clock_was_set() call to a work context.

Reported-and-tested-by: Artem Savkov &lt;artem.savkov@gmail.com&gt;
Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: David Vrabel &lt;david.vrabel@citrix.com&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: H. Peter Anvin &lt;hpa@zytor.com&gt;,
Cc: Konrad Wilk &lt;konrad.wilk@oracle.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: xen-devel@lists.xen.org
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>tracing: Fix irqs-off tag display in syscall tracing</title>
<updated>2013-07-28T23:26:46Z</updated>
<author>
<name>zhangwei(Jovi)</name>
<email>jovi.zhangwei@huawei.com</email>
</author>
<published>2013-04-10T03:26:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f36a0d6764dcb33a280dce206f1be4bcaff5714e'/>
<id>urn:sha1:f36a0d6764dcb33a280dce206f1be4bcaff5714e</id>
<content type='text'>
commit 11034ae9c20f4057a6127fc965906417978e69b2 upstream.

All syscall tracing irqs-off tags are wrong, the syscall enter entry doesn't
disable irqs.

 [root@jovi tracing]#echo "syscalls:sys_enter_open" &gt; set_event
 [root@jovi tracing]# cat trace
 # tracer: nop
 #
 # entries-in-buffer/entries-written: 13/13   #P:2
 #
 #                              _-----=&gt; irqs-off
 #                             / _----=&gt; need-resched
 #                            | / _---=&gt; hardirq/softirq
 #                            || / _--=&gt; preempt-depth
 #                            ||| /     delay
 #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
 #              | |       |   ||||       |         |
       irqbalance-513   [000] d... 56115.496766: sys_open(filename: 804e1a6, flags: 0, mode: 1b6)
       irqbalance-513   [000] d... 56115.497008: sys_open(filename: 804e1bb, flags: 0, mode: 1b6)
         sendmail-771   [000] d... 56115.827982: sys_open(filename: b770e6d1, flags: 0, mode: 1b6)

The reason is syscall tracing doesn't record irq_flags into buffer.
The proper display is:

 [root@jovi tracing]#echo "syscalls:sys_enter_open" &gt; set_event
 [root@jovi tracing]# cat trace
 # tracer: nop
 #
 # entries-in-buffer/entries-written: 14/14   #P:2
 #
 #                              _-----=&gt; irqs-off
 #                             / _----=&gt; need-resched
 #                            | / _---=&gt; hardirq/softirq
 #                            || / _--=&gt; preempt-depth
 #                            ||| /     delay
 #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
 #              | |       |   ||||       |         |
       irqbalance-514   [001] ....    46.213921: sys_open(filename: 804e1a6, flags: 0, mode: 1b6)
       irqbalance-514   [001] ....    46.214160: sys_open(filename: 804e1bb, flags: 0, mode: 1b6)
            &lt;...&gt;-920   [001] ....    47.307260: sys_open(filename: 4e82a0c5, flags: 80000, mode: 0)

Link: http://lkml.kernel.org/r/1365564393-10972-3-git-send-email-jovi.zhangwei@huawei.com

Cc: stable@vger.kernel.org # 2.6.35
Signed-off-by: zhangwei(Jovi) &lt;jovi.zhangwei@huawei.com&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>perf: Fix perf_lock_task_context() vs RCU</title>
<updated>2013-07-28T23:25:48Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2013-07-12T09:08:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=41154a356f6516ffa266e50ff7d1bf706893dfe3'/>
<id>urn:sha1:41154a356f6516ffa266e50ff7d1bf706893dfe3</id>
<content type='text'>
commit 058ebd0eba3aff16b144eabf4510ed9510e1416e upstream.

Jiri managed to trigger this warning:

 [] ======================================================
 [] [ INFO: possible circular locking dependency detected ]
 [] 3.10.0+ #228 Tainted: G        W
 [] -------------------------------------------------------
 [] p/6613 is trying to acquire lock:
 []  (rcu_node_0){..-...}, at: [&lt;ffffffff810ca797&gt;] rcu_read_unlock_special+0xa7/0x250
 []
 [] but task is already holding lock:
 []  (&amp;ctx-&gt;lock){-.-...}, at: [&lt;ffffffff810f2879&gt;] perf_lock_task_context+0xd9/0x2c0
 []
 [] which lock already depends on the new lock.
 []
 [] the existing dependency chain (in reverse order) is:
 []
 [] -&gt; #4 (&amp;ctx-&gt;lock){-.-...}:
 [] -&gt; #3 (&amp;rq-&gt;lock){-.-.-.}:
 [] -&gt; #2 (&amp;p-&gt;pi_lock){-.-.-.}:
 [] -&gt; #1 (&amp;rnp-&gt;nocb_gp_wq[1]){......}:
 [] -&gt; #0 (rcu_node_0){..-...}:

Paul was quick to explain that due to preemptible RCU we cannot call
rcu_read_unlock() while holding scheduler (or nested) locks when part
of the read side critical section was preemptible.

Therefore solve it by making the entire RCU read side non-preemptible.

Also pull out the retry from under the non-preempt to play nice with RT.

Reported-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Helped-out-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario</title>
<updated>2013-07-28T23:25:48Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2013-07-09T15:44:11Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1f11f44083bca90ce4f534023658d481b5707d94'/>
<id>urn:sha1:1f11f44083bca90ce4f534023658d481b5707d94</id>
<content type='text'>
commit 06f417968beac6e6b614e17b37d347aa6a6b1d30 upstream.

The '!ctx-&gt;is_active' check has a valid scenario, so
there's no need for the warning.

The reason is that there's a time window between the
'ctx-&gt;is_active' check in the perf_event_enable() function
and the __perf_event_enable() function having:

  - IRQs on
  - ctx-&gt;lock unlocked

where the task could be killed and 'ctx' deactivated by
perf_event_exit_task(), ending up with the warning below.

So remove the WARN_ON_ONCE() check and add comments to
explain it all.

This addresses the following warning reported by Vince Weaver:

[  324.983534] ------------[ cut here ]------------
[  324.984420] WARNING: at kernel/events/core.c:1953 __perf_event_enable+0x187/0x190()
[  324.984420] Modules linked in:
[  324.984420] CPU: 19 PID: 2715 Comm: nmi_bug_snb Not tainted 3.10.0+ #246
[  324.984420] Hardware name: Supermicro X8DTN/X8DTN, BIOS 4.6.3 01/08/2010
[  324.984420]  0000000000000009 ffff88043fce3ec8 ffffffff8160ea0b ffff88043fce3f00
[  324.984420]  ffffffff81080ff0 ffff8802314fdc00 ffff880231a8f800 ffff88043fcf7860
[  324.984420]  0000000000000286 ffff880231a8f800 ffff88043fce3f10 ffffffff8108103a
[  324.984420] Call Trace:
[  324.984420]  &lt;IRQ&gt;  [&lt;ffffffff8160ea0b&gt;] dump_stack+0x19/0x1b
[  324.984420]  [&lt;ffffffff81080ff0&gt;] warn_slowpath_common+0x70/0xa0
[  324.984420]  [&lt;ffffffff8108103a&gt;] warn_slowpath_null+0x1a/0x20
[  324.984420]  [&lt;ffffffff81134437&gt;] __perf_event_enable+0x187/0x190
[  324.984420]  [&lt;ffffffff81130030&gt;] remote_function+0x40/0x50
[  324.984420]  [&lt;ffffffff810e51de&gt;] generic_smp_call_function_single_interrupt+0xbe/0x130
[  324.984420]  [&lt;ffffffff81066a47&gt;] smp_call_function_single_interrupt+0x27/0x40
[  324.984420]  [&lt;ffffffff8161fd2f&gt;] call_function_single_interrupt+0x6f/0x80
[  324.984420]  &lt;EOI&gt;  [&lt;ffffffff816161a1&gt;] ? _raw_spin_unlock_irqrestore+0x41/0x70
[  324.984420]  [&lt;ffffffff8113799d&gt;] perf_event_exit_task+0x14d/0x210
[  324.984420]  [&lt;ffffffff810acd04&gt;] ? switch_task_namespaces+0x24/0x60
[  324.984420]  [&lt;ffffffff81086946&gt;] do_exit+0x2b6/0xa40
[  324.984420]  [&lt;ffffffff8161615c&gt;] ? _raw_spin_unlock_irq+0x2c/0x30
[  324.984420]  [&lt;ffffffff81087279&gt;] do_group_exit+0x49/0xc0
[  324.984420]  [&lt;ffffffff81096854&gt;] get_signal_to_deliver+0x254/0x620
[  324.984420]  [&lt;ffffffff81043057&gt;] do_signal+0x57/0x5a0
[  324.984420]  [&lt;ffffffff8161a164&gt;] ? __do_page_fault+0x2a4/0x4e0
[  324.984420]  [&lt;ffffffff8161665c&gt;] ? retint_restore_args+0xe/0xe
[  324.984420]  [&lt;ffffffff816166cd&gt;] ? retint_signal+0x11/0x84
[  324.984420]  [&lt;ffffffff81043605&gt;] do_notify_resume+0x65/0x80
[  324.984420]  [&lt;ffffffff81616702&gt;] retint_signal+0x46/0x84
[  324.984420] ---[ end trace 442ec2f04db3771a ]---

Reported-by: Vince Weaver &lt;vincent.weaver@maine.edu&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Suggested-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Corey Ashford &lt;cjashfor@linux.vnet.ibm.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lkml.kernel.org/r/1373384651-6109-2-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>perf: Clone child context from parent context pmu</title>
<updated>2013-07-28T23:25:48Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2013-07-09T15:44:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c4c6a6ea3adbe790d81ef72f623e22591704fdb9'/>
<id>urn:sha1:c4c6a6ea3adbe790d81ef72f623e22591704fdb9</id>
<content type='text'>
commit 734df5ab549ca44f40de0f07af1c8803856dfb18 upstream.

Currently when the child context for inherited events is
created, it's based on the pmu object of the first event
of the parent context.

This is wrong for the following scenario:

  - HW context having HW and SW event
  - HW event got removed (closed)
  - SW event stays in HW context as the only event
    and its pmu is used to clone the child context

The issue starts when the cpu context object is touched
based on the pmu context object (__get_cpu_context). In
this case the HW context will work with SW cpu context
ending up with following WARN below.

Fixing this by using parent context pmu object to clone
from child context.

Addresses the following warning reported by Vince Weaver:

[ 2716.472065] ------------[ cut here ]------------
[ 2716.476035] WARNING: at kernel/events/core.c:2122 task_ctx_sched_out+0x3c/0x)
[ 2716.476035] Modules linked in: nfsd auth_rpcgss oid_registry nfs_acl nfs locn
[ 2716.476035] CPU: 0 PID: 3164 Comm: perf_fuzzer Not tainted 3.10.0-rc4 #2
[ 2716.476035] Hardware name: AOpen   DE7000/nMCP7ALPx-DE R1.06 Oct.19.2012, BI2
[ 2716.476035]  0000000000000000 ffffffff8102e215 0000000000000000 ffff88011fc18
[ 2716.476035]  ffff8801175557f0 0000000000000000 ffff880119fda88c ffffffff810ad
[ 2716.476035]  ffff880119fda880 ffffffff810af02a 0000000000000009 ffff880117550
[ 2716.476035] Call Trace:
[ 2716.476035]  [&lt;ffffffff8102e215&gt;] ? warn_slowpath_common+0x5b/0x70
[ 2716.476035]  [&lt;ffffffff810ab2bd&gt;] ? task_ctx_sched_out+0x3c/0x5f
[ 2716.476035]  [&lt;ffffffff810af02a&gt;] ? perf_event_exit_task+0xbf/0x194
[ 2716.476035]  [&lt;ffffffff81032a37&gt;] ? do_exit+0x3e7/0x90c
[ 2716.476035]  [&lt;ffffffff810cd5ab&gt;] ? __do_fault+0x359/0x394
[ 2716.476035]  [&lt;ffffffff81032fe6&gt;] ? do_group_exit+0x66/0x98
[ 2716.476035]  [&lt;ffffffff8103dbcd&gt;] ? get_signal_to_deliver+0x479/0x4ad
[ 2716.476035]  [&lt;ffffffff810ac05c&gt;] ? __perf_event_task_sched_out+0x230/0x2d1
[ 2716.476035]  [&lt;ffffffff8100205d&gt;] ? do_signal+0x3c/0x432
[ 2716.476035]  [&lt;ffffffff810abbf9&gt;] ? ctx_sched_in+0x43/0x141
[ 2716.476035]  [&lt;ffffffff810ac2ca&gt;] ? perf_event_context_sched_in+0x7a/0x90
[ 2716.476035]  [&lt;ffffffff810ac311&gt;] ? __perf_event_task_sched_in+0x31/0x118
[ 2716.476035]  [&lt;ffffffff81050dd9&gt;] ? mmdrop+0xd/0x1c
[ 2716.476035]  [&lt;ffffffff81051a39&gt;] ? finish_task_switch+0x7d/0xa6
[ 2716.476035]  [&lt;ffffffff81002473&gt;] ? do_notify_resume+0x20/0x5d
[ 2716.476035]  [&lt;ffffffff813654f5&gt;] ? retint_signal+0x3d/0x78
[ 2716.476035] ---[ end trace 827178d8a5966c3d ]---

Reported-by: Vince Weaver &lt;vincent.weaver@maine.edu&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Cc: Corey Ashford &lt;cjashfor@linux.vnet.ibm.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Namhyung Kim &lt;namhyung@kernel.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Signed-off-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lkml.kernel.org/r/1373384651-6109-1-git-send-email-jolsa@redhat.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
