<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/perf_event.c, branch v2.6.35</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=v2.6.35</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.35'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2010-06-08T16:43:00Z</updated>
<entry>
<title>perf: Fix signed comparison in perf_adjust_period()</title>
<updated>2010-06-08T16:43:00Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2010-06-04T13:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f6ab91add6355e231e1c47897027b2a6ee4fa268'/>
<id>urn:sha1:f6ab91add6355e231e1c47897027b2a6ee4fa268</id>
<content type='text'>
Frederic reported that frequency driven swevents didn't work properly
and even caused a division-by-zero error.

It turns out there are two bugs, the division-by-zero comes from a
failure to deal with that in perf_calculate_period().

The other was more interesting and turned out to be a wrong comparison
in perf_adjust_period(). The comparison was between an s64 and u64 and
got implicitly converted to an unsigned comparison. The problem is
that period_left is typically &lt; 0, so it ended up being always true.

Cure this by making the local period variables s64.

Reported-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Tested-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: &lt;stable@kernel.org&gt;
LKML-Reference: &lt;new-submission&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf: Fix crash in swevents</title>
<updated>2010-06-03T15:03:08Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2010-06-03T09:21:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c6df8d5ab87a246942d138321e1721edbb69f6e1'/>
<id>urn:sha1:c6df8d5ab87a246942d138321e1721edbb69f6e1</id>
<content type='text'>
Frederic reported that because swevents handling doesn't disable IRQs
anymore, we can get a recursion of perf_adjust_period(), once from
overflow handling and once from the tick.

If both call -&gt;disable, we get a double hlist_del_rcu() and trigger
a LIST_POISON2 dereference.

Since we don't actually need to stop/start a swevent to re-programm
the hardware (lack of hardware to program), simply nop out these
callbacks for the swevent pmu.

Reported-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;1275557609.27810.35218.camel@twins&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf_events: Fix unincremented buffer base on partial copy</title>
<updated>2010-05-31T06:46:10Z</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2010-05-27T19:34:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74048f895fa8cbf8119b4999f1f44881a825f954'/>
<id>urn:sha1:74048f895fa8cbf8119b4999f1f44881a825f954</id>
<content type='text'>
If a sample size crosses to the next page boundary, the copy
will be made in more than one step. However we forget to advance
the source offset for the next copy, leading to unexpected double
copies that completely mess up the traces.

This fixes various kinds of bad traces that have irrelevant
data inside, as an example:

	geany-4979  [001]  5758.077775: sched_switch: prev_comm=! prev_pid=121
		prev_prio=0 prev_state=S|D|Z|X|x ==&gt; next_comm= next_pid=7497072
		next_prio=0

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;1274988898-5639-1-git-send-regression-fweisbec@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf_events: Fix event scheduling issues introduced by transactional API</title>
<updated>2010-05-31T06:46:10Z</updated>
<author>
<name>Stephane Eranian</name>
<email>eranian@google.com</email>
</author>
<published>2010-05-25T14:23:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=90151c35b19633e0cab5a6c80f1ba4a51e7c913b'/>
<id>urn:sha1:90151c35b19633e0cab5a6c80f1ba4a51e7c913b</id>
<content type='text'>
The transactional API patch between the generic and model-specific
code introduced several important bugs with event scheduling, at
least on X86. If you had pinned events, e.g., watchdog,  and were
over-committing the PMU, you would get bogus counts. The bug was
showing up on Intel CPU because events would move around more
often that on AMD. But the problem also existed on AMD, though
harder to expose.

The issues were:

 - group_sched_in() was missing a cancel_txn() in the error path

 - cpuc-&gt;n_added was not properly maintained, leading to missing
   actions in hw_perf_enable(), i.e., n_running being 0. You cannot
   update n_added until you know the transaction has succeeded. In
   case of failed transaction n_added was not adjusted back.

 - in case of failed transactions, event_sched_out() was called
   and eventually invoked x86_disable_event() to touch the HW reg.
   But with transactions, on X86, event_sched_in() does not touch
   HW registers, it simply collects events into a list. Thus, you
   could end up calling x86_disable_event() on a counter which
   did not correspond to the current event when idx != -1.

The patch modifies the generic and X86 code to avoid all those problems.

First, we keep track of the number of events added last. In case the
transaction fails, we substract them from n_added. This approach is
necessary (as opposed to delaying updates to n_added) because not all
event updates use the transaction API, e.g., single events.

Second, we encapsulate the event_sched_in() and event_sched_out() in
group_sched_in() inside the transaction. That makes the operations
symmetrical and you can also detect that you are inside a transaction
and skip the HW reg access by checking cpuc-&gt;group_flag.

With this patch, you can now overcommit the PMU even with pinned
system-wide events present and still get valid counts.

Signed-off-by: Stephane Eranian &lt;eranian@google.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;1274796225.5882.1389.camel@twins&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf_events: Fix races in group composition</title>
<updated>2010-05-31T06:46:09Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2010-05-27T13:47:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8a49542c0554af7d0073aac0ee73ee65b807ef34'/>
<id>urn:sha1:8a49542c0554af7d0073aac0ee73ee65b807ef34</id>
<content type='text'>
Group siblings don't pin each-other or the parent, so when we destroy
events we must make sure to clean up all cross referencing pointers.

In particular, for destruction of a group leader we must be able to
find all its siblings and remove their reference to it.

This means that detaching an event from its context must not detach it
from the group, otherwise we can end up failing to clear all pointers.

Solve this by clearly separating the attachment to a context and
attachment to a group, and keep the group composed until we destroy
the events.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;new-submission&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf_events: Fix races and clean up perf_event and perf_mmap_data interaction</title>
<updated>2010-05-31T06:46:08Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2010-05-27T10:54:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ac9721f3f54b27a16c7e1afb2481e7ee95a70318'/>
<id>urn:sha1:ac9721f3f54b27a16c7e1afb2481e7ee95a70318</id>
<content type='text'>
In order to move toward separate buffer objects, rework the whole
perf_mmap_data construct to be a more self-sufficient entity, one
with its own lifetime rules.

This greatly sanitizes the whole output redirection code, which
was riddled with bugs and races.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: &lt;stable@kernel.org&gt;
LKML-Reference: &lt;new-submission&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>Fix racy use of anon_inode_getfd() in perf_event.c</title>
<updated>2010-05-28T02:03:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2010-05-26T21:40:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ea635c64e007061f6468ece5cc9cc62d41d4ecf2'/>
<id>urn:sha1:ea635c64e007061f6468ece5cc9cc62d41d4ecf2</id>
<content type='text'>
once anon_inode_getfd() is called, you can't expect *anything* about
struct file that descriptor points to - another thread might be doing
whatever it likes with descriptor table at that point.

Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>perf: Optimize perf_tp_event_match()</title>
<updated>2010-05-21T09:38:00Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2010-05-20T18:54:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=580d607cd666dfabfc1c7b0fb08c8ac690c7c87f'/>
<id>urn:sha1:580d607cd666dfabfc1c7b0fb08c8ac690c7c87f</id>
<content type='text'>
Since we know tracepoints come from kernel context,
avoid conditionals that try and establish that very
fact.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Mike Galbraith &lt;efault@gmx.de&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
LKML-Reference: &lt;20100521090710.904944001@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf: Remove more code from the fastpath</title>
<updated>2010-05-21T09:37:59Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2010-05-20T17:50:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a94ffaaf55552769af328eaca9260fe6291c66c7'/>
<id>urn:sha1:a94ffaaf55552769af328eaca9260fe6291c66c7</id>
<content type='text'>
Sanity checks cost instructions.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Mike Galbraith &lt;efault@gmx.de&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
LKML-Reference: &lt;20100521090710.852926930@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>perf: Optimize the !vmalloc backed buffer</title>
<updated>2010-05-21T09:37:59Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2010-05-20T17:07:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3cafa9fbb5c1d564b7b8e7224f493effbf04ffee'/>
<id>urn:sha1:3cafa9fbb5c1d564b7b8e7224f493effbf04ffee</id>
<content type='text'>
Reduce code and data by using the knowledge that for
!PERF_USE_VMALLOC data_order is always 0.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@redhat.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Mike Galbraith &lt;efault@gmx.de&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
LKML-Reference: &lt;20100521090710.795019386@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
</feed>
