<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/events/core.c, branch v3.6</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.6</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.6'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2012-09-04T15:29:53Z</updated>
<entry>
<title>perf/hwpb: Invoke __perf_event_disable() if interrupts are already disabled</title>
<updated>2012-09-04T15:29:53Z</updated>
<author>
<name>K.Prasad</name>
<email>Prasad.Krishnan@gmail.com</email>
</author>
<published>2012-08-02T08:16:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=500ad2d8b01390c98bc6dce068bccfa9534b8212'/>
<id>urn:sha1:500ad2d8b01390c98bc6dce068bccfa9534b8212</id>
<content type='text'>
While debugging a warning message on PowerPC while using hardware
breakpoints, it was discovered that when perf_event_disable is invoked
through hw_breakpoint_handler function with interrupts disabled, a
subsequent IPI in the code path would trigger a WARN_ON_ONCE message in
smp_call_function_single function.

This patch calls __perf_event_disable() when interrupts are already
disabled, instead of perf_event_disable().

Reported-by: Edjunior Barbosa Machado &lt;emachado@linux.vnet.ibm.com&gt;
Signed-off-by: K.Prasad &lt;Prasad.Krishnan@gmail.com&gt;
[naveen.n.rao@linux.vnet.ibm.com: v3: Check to make sure we target current task]
Signed-off-by: Naveen N. Rao &lt;naveen.n.rao@linux.vnet.ibm.com&gt;
Acked-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/20120802081635.5811.17737.stgit@localhost.localdomain
[ Fixed build error on MIPS. ]
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf_event: Switch to internal refcount, fix race with close()</title>
<updated>2012-09-04T15:29:22Z</updated>
<author>
<name>Al Viro</name>
<email>viro@ZenIV.linux.org.uk</email>
</author>
<published>2012-08-20T13:59:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a6fa941d94b411bbd2b6421ffbde6db3c93e65ab'/>
<id>urn:sha1:a6fa941d94b411bbd2b6421ffbde6db3c93e65ab</id>
<content type='text'>
Don't mess with file refcounts (or keep a reference to file, for
that matter) in perf_event.  Use explicit refcount of its own
instead.  Deal with the race between the final reference to event
going away and new children getting created for it by use of
atomic_long_inc_not_zero() in inherit_event(); just have the
latter free what it had allocated and return NULL, that works
out just fine (children of siblings of something doomed are
created as singletons, same as if the child of leader had been
created and immediately killed).

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: stable@kernel.org
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/20120820135925.GG23464@ZenIV.linux.org.uk
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf/trace: Add ability to set a target task for events</title>
<updated>2012-07-31T15:02:05Z</updated>
<author>
<name>Andrew Vagin</name>
<email>avagin@openvz.org</email>
</author>
<published>2012-07-11T14:14:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e6dab5ffab59e910ec0e3355f4a6f29f7a7be474'/>
<id>urn:sha1:e6dab5ffab59e910ec0e3355f4a6f29f7a7be474</id>
<content type='text'>
A few events are interesting not only for a current task.
For example, sched_stat_* events are interesting for a task
which wakes up. For this reason, it will be good if such
events will be delivered to a target task too.

Now a target task can be set by using __perf_task().

The original idea and a draft patch belongs to Peter Zijlstra.

I need these events for profiling sleep times. sched_switch is used for
getting callchains and sched_stat_* is used for getting time periods.
These events are combined in user space, then it can be analyzed by
perf tools.

Inspired-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@ghostprotocols.net&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Arun Sharma &lt;asharma@fb.com&gt;
Signed-off-by: Andrew Vagin &lt;avagin@openvz.org&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/1342016098-213063-1-git-send-email-avagin@openvz.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Introduce perf_pmu_migrate_context()</title>
<updated>2012-06-18T10:13:21Z</updated>
<author>
<name>Yan, Zheng</name>
<email>zheng.z.yan@intel.com</email>
</author>
<published>2012-06-15T06:31:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0cda4c023132aa93f2dd94811061f812e88daf4c'/>
<id>urn:sha1:0cda4c023132aa93f2dd94811061f812e88daf4c</id>
<content type='text'>
Originally from Peter Zijlstra. The helper migrates perf events
from one cpu to another cpu.

Signed-off-by: Zheng Yan &lt;zheng.z.yan@intel.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/1339741902-8449-5-git-send-email-zheng.z.yan@intel.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Allow the PMU driver to choose the CPU on which to install events</title>
<updated>2012-06-18T10:13:21Z</updated>
<author>
<name>Yan, Zheng</name>
<email>zheng.z.yan@intel.com</email>
</author>
<published>2012-06-15T06:31:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e2d37cd213dcc0aeb3db4b37b9bd1710fe36fbf7'/>
<id>urn:sha1:e2d37cd213dcc0aeb3db4b37b9bd1710fe36fbf7</id>
<content type='text'>
Allow the pmu-&gt;event_init callback to change event-&gt;cpu, so the PMU driver
can choose the CPU on which to install events.

Signed-off-by: Zheng Yan &lt;zheng.z.yan@intel.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/1339741902-8449-4-git-send-email-zheng.z.yan@intel.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Avoid race between cpu hotplug and installing event</title>
<updated>2012-06-18T10:13:20Z</updated>
<author>
<name>Yan, Zheng</name>
<email>zheng.z.yan@intel.com</email>
</author>
<published>2012-06-15T06:31:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fbfc623f8231c8d8c78aab5841e9c6e5811ab638'/>
<id>urn:sha1:fbfc623f8231c8d8c78aab5841e9c6e5811ab638</id>
<content type='text'>
perf_event_open() requires the cpu on which to install event is online,
but the cpu can go offline after perf_event_open checks that. Add a
get_online_cpus()/put_online_cpus() pair to avoid the race.

Signed-off-by: Zheng Yan &lt;zheng.z.yan@intel.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/1339741902-8449-3-git-send-email-zheng.z.yan@intel.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf: Use css_tryget() to avoid propping up css refcount</title>
<updated>2012-06-18T09:45:57Z</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.shady.money/linux/commit/?id=9c5da09d266ca9b32eb16cf940f8161d949c2fe5'/>
<id>urn:sha1:9c5da09d266ca9b32eb16cf940f8161d949c2fe5</id>
<content type='text'>
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;
</content>
</entry>
<entry>
<title>perf: Remove duplicate invocation on perf_event_for_each</title>
<updated>2012-05-31T17:01:00Z</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung.kim@lge.com</email>
</author>
<published>2012-05-31T05:51:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cb7225feec627e91d598198996429e9ee6804f8d'/>
<id>urn:sha1:cb7225feec627e91d598198996429e9ee6804f8d</id>
<content type='text'>
The @func callback was invoked twice for group leader when
perf_event_for_each() called. It seems the commit 75f937f24bd9
("perf_counter: Fix ctx-&gt;mutex vs counter -&gt;mutex inversion") made the
mistake during the change.

Signed-off-by: Namhyung Kim &lt;namhyung.kim@lge.com&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/1338443506-25009-1-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
<entry>
<title>Revert "sched, perf: Use a single callback into the scheduler"</title>
<updated>2012-05-23T15:40:51Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@redhat.com</email>
</author>
<published>2012-05-23T11:13:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ab0cce560ef177bdc7a8f73e9962be9d829a7b2c'/>
<id>urn:sha1:ab0cce560ef177bdc7a8f73e9962be9d829a7b2c</id>
<content type='text'>
This reverts commit cb04ff9ac424 ("sched, perf: Use a single
callback into the scheduler").

Before this change was introduced, the process switch worked
like this (wrt. to perf event schedule):

     schedule (prev, next)
       - schedule out all perf events for prev
       - switch to next
       - schedule in all perf events for current (next)

After the commit, the process switch looks like:

     schedule (prev, next)
       - schedule out all perf events for prev
       - schedule in all perf events for (next)
       - switch to next

The problem is, that after we schedule perf events in, the pmu
is enabled and we can receive events even before we make the
switch to next - so "current" still being prev process (event
SAMPLE data are filled based on the value of the "current"
process).

Thats exactly what we see for test__PERF_RECORD test. We receive
SAMPLES with PID of the process that our tracee is scheduled
from.

Discussed with Peter Zijlstra:

 &gt; Bah!, yeah I guess reverting is the right thing for now. Sad
 &gt; though.
 &gt;
 &gt; So by having the two hooks we have a black-spot between them
 &gt; where we receive no events at all, this black-spot covers the
 &gt; hand-over of current and we thus don't receive the 'wrong'
 &gt; events.
 &gt;
 &gt; I rather liked we could do away with both that black-spot and
 &gt; clean up the code a little, but apparently people rely on it.

Signed-off-by: Jiri Olsa &lt;jolsa@redhat.com&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: acme@redhat.com
Cc: paulus@samba.org
Cc: cjashfor@linux.vnet.ibm.com
Cc: fweisbec@gmail.com
Cc: eranian@google.com
Link: http://lkml.kernel.org/r/20120523111302.GC1638@m.brq.redhat.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'tip/perf/urgent' into perf/core</title>
<updated>2012-05-18T16:13:33Z</updated>
<author>
<name>Arnaldo Carvalho de Melo</name>
<email>acme@redhat.com</email>
</author>
<published>2012-05-18T16:13:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=16ee6576e25b83806d26eb771138249fcfb5eddc'/>
<id>urn:sha1:16ee6576e25b83806d26eb771138249fcfb5eddc</id>
<content type='text'>
Merge reason: We are going to queue up a dependent patch:

"perf tools: Move parse event automated tests to separated object"

That depends on:

commit e7c72d8
perf tools: Add 'G' and 'H' modifiers to event parsing

Conflicts:
	tools/perf/builtin-stat.c

Conflicted with the recent 'perf_target' patches when checking the
result of perf_evsel open routines to see if a retry is needed to cope
with older kernels where the exclude guest/host perf_event_attr bits
were not used.

Signed-off-by: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
</content>
</entry>
</feed>
