<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/arch/arm/kernel/perf_event.c, branch docs-5.17-3</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-5.17-3</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-5.17-3'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2015-07-31T14:01:14+00:00</updated>
<entry>
<title>arm: perf: factor arm_pmu core out to drivers</title>
<updated>2015-07-31T14:01:14+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2015-07-06T11:23:53+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=fa8ad7889d83bcf0a6cdbf6d3622f3ec019cde14'/>
<id>urn:sha1:fa8ad7889d83bcf0a6cdbf6d3622f3ec019cde14</id>
<content type='text'>
To enable sharing of the arm_pmu code with arm64, this patch factors it
out to drivers/perf/. A new drivers/perf directory is added for
performance monitor drivers to live under.

MAINTAINERS is updated accordingly. Files added previously without a
corresponsing MAINTAINERS update (perf_regs.c, perf_callchain.c, and
perf_event.h) are also added.

Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Russell King &lt;linux@arm.linux.org.uk&gt;
Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
[will: augmented Kconfig help slightly]
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>ARM: perf: replace arch_find_n_match_cpu_physical_id with of_cpu_device_node_get</title>
<updated>2015-07-31T14:01:14+00:00</updated>
<author>
<name>Sudeep Holla</name>
<email>sudeep.holla@arm.com</email>
</author>
<published>2015-06-30T12:56:57+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=bc1e3c4687df62a1f2ba1b6be11efbeb76145366'/>
<id>urn:sha1:bc1e3c4687df62a1f2ba1b6be11efbeb76145366</id>
<content type='text'>
arch_find_n_match_cpu_physical_id parses the device tree to get the
device node for a given logical cpu index. However, since ARM PMUs get
probed after the CPU device nodes are stashed while registering the
cpus, we can use of_cpu_device_node_get to avoid another DT parse.

This patch replaces arch_find_n_match_cpu_physical_id with
of_cpu_device_node_get to reuse the stashed value directly instead.

Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Sudeep Holla &lt;sudeep.holla@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>ARM: perf: extend interrupt-affinity property for PPIs</title>
<updated>2015-07-31T14:01:14+00:00</updated>
<author>
<name>Will Deacon</name>
<email>will.deacon@arm.com</email>
</author>
<published>2015-06-29T12:59:01+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=b6c084d7aa8bca21920cbbe13ad58572fa85ece6'/>
<id>urn:sha1:b6c084d7aa8bca21920cbbe13ad58572fa85ece6</id>
<content type='text'>
On systems containing multiple, heterogeneous clusters we need a way to
associate a PMU "device" with the CPU(s) on which it exists. For PMUs
that signal overflow with SPIs, this relationship is determined via the
"interrupt-affinity" property, which contains a list of phandles to CPU
nodes for the PMU. For PMUs using PPIs, the per-cpu nature of the
interrupt isn't enough to determine the set of CPUs which actually
contain the device.

This patch allows the interrupt-affinity property to be specified on a
PMU node irrespective of the interrupt type. For PPIs, it identifies
the set of CPUs signalling the PPI in question.

Tested-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt; # Krait PMU
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm: perf: Set affinity for PPI based PMUs</title>
<updated>2015-07-31T14:01:14+00:00</updated>
<author>
<name>Stephen Boyd</name>
<email>sboyd@codeaurora.org</email>
</author>
<published>2015-06-29T21:58:46+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=8ae81c25cfe962a788a28e023d9a78934d807f7d'/>
<id>urn:sha1:8ae81c25cfe962a788a28e023d9a78934d807f7d</id>
<content type='text'>
For PPI based PMUs, we bail out early in of_pmu_irq_cfg() without
setting the PMU's supported_cpus bitmap. This causes the
smp_call_function_any() in armv7_probe_num_events() to fail. Set
the bitmap to be all CPUs so that we properly probe PMUs that use
PPIs.

Fixes: cc88116da0d1 ("arm: perf: treat PMUs as CPU affine")
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>ARM: 8402/1: perf: Don't use of_node after putting it</title>
<updated>2015-07-17T14:08:38+00:00</updated>
<author>
<name>Stephen Boyd</name>
<email>sboyd@codeaurora.org</email>
</author>
<published>2015-07-07T17:17:05+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=8e0c34b0d268f10d84cb3f79f59c140d545a553a'/>
<id>urn:sha1:8e0c34b0d268f10d84cb3f79f59c140d545a553a</id>
<content type='text'>
It's possible, albeit unlikely, that using the of_node here will
reference freed memory. Call of_node_put() after printing the
name to be safe.

Signed-off-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>arm: perf: unify perf_event{,_cpu}.c</title>
<updated>2015-05-28T16:13:26+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2015-05-26T16:23:39+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=74cf0bc75f1671b8da3b2e6ef7b2dc75cab0016a'/>
<id>urn:sha1:74cf0bc75f1671b8da3b2e6ef7b2dc75cab0016a</id>
<content type='text'>
Now that the arm_pmu framework is only used for CPU PMUs, there's no
reason to keep the pseudo-generic and CPU-specific framework portions
separate.

This patch folds the two into perf_event.c.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
[will: fixed up irq cfg to match upstream]
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm: perf: kill off unused pm callbacks</title>
<updated>2015-05-28T15:54:02+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2015-05-26T16:23:34+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=ed61f9851d0686d56d7a9648b4807d82ad0adce6'/>
<id>urn:sha1:ed61f9851d0686d56d7a9648b4807d82ad0adce6</id>
<content type='text'>
Currently the arm perf code has platdata callbacks for runtime PM and
irq handling, but no platform implements the hooks for the former. Kill
these off.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm: perf: filter unschedulable events</title>
<updated>2015-05-27T15:12:36+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2015-05-13T16:12:26+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=c904e32a69b7c77905876fc834f474f13f62c138'/>
<id>urn:sha1:c904e32a69b7c77905876fc834f474f13f62c138</id>
<content type='text'>
Different CPU microarchitectures implement different PMU events, and
thus events which can be scheduled on one microarchitecture cannot be
scheduled on another, and vice-versa. Some archicted events behave
differently across microarchitectures, and thus cannot be meaningfully
summed. Due to this, we reject the scheduling of an event on a CPU of a
different microarchitecture to that the event targets.

When the core perf code is scheduling events and encounters an event
which cannot be scheduled, it stops attempting to schedule events. As
the perf core periodically rotates the list of events, for some
proportion of the time events which are unschedulable will block events
which are schedulable, resulting in low utilisation of the hardware
counters.

This patch implements a pmu::filter_match callback such that we can
detect and skip such events while scheduling early, before they can
block the schedulable events. This prevents the low HW counter
utilisation issue.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>arm: perf: treat PMUs as CPU affine</title>
<updated>2015-05-27T15:12:36+00:00</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2015-05-13T16:12:25+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=cc88116da0d18b8292f5437dbc0c4683c8a34ac1'/>
<id>urn:sha1:cc88116da0d18b8292f5437dbc0c4683c8a34ac1</id>
<content type='text'>
In multi-cluster systems, the PMUs can be different across clusters, and
so our logical PMU may not be able to schedule events on all CPUs.

This patch adds a cpumask to encode which CPUs a PMU driver supports
controlling events for, and limits the driver to scheduling events on
those CPUs, and enabling and disabling the physical PMUs on those CPUs.
The cpumask is built based on the interrupt-affinity property, and in
the absence of such a property a homogenous system is assumed.

Acked-by: Will Deacon &lt;will.deacon@arm.com&gt;
Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
<entry>
<title>ARM: perf: reject groups spanning multiple hardware PMUs</title>
<updated>2015-03-19T19:45:22+00:00</updated>
<author>
<name>Suzuki K. Poulose</name>
<email>suzuki.poulose@arm.com</email>
</author>
<published>2015-03-17T18:14:58+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=e429817b401f095ac483fcb02524b01faf45dad6'/>
<id>urn:sha1:e429817b401f095ac483fcb02524b01faf45dad6</id>
<content type='text'>
The perf core implicitly rejects events spanning multiple HW PMUs, as in
these cases the event-&gt;ctx will differ. However this validation is
performed after pmu::event_init() is called in perf_init_event(), and
thus pmu::event_init() may be called with a group leader from a
different HW PMU.

The ARM PMU driver does not take this fact into account, and when
validating groups assumes that it can call to_arm_pmu(event-&gt;pmu) for
any HW event. When the event in question is from another HW PMU this is
wrong, and results in dereferencing garbage.

This patch updates the ARM PMU driver to first test for and reject
events from other PMUs, moving the to_arm_pmu and related logic after
this test. Fixes a crash triggered by perf_fuzzer on Linux-4.0-rc2, with
a CCI PMU present:

 ---
CPU: 0 PID: 1527 Comm: perf_fuzzer Not tainted 4.0.0-rc2 #57
Hardware name: ARM-Versatile Express
task: bd8484c0 ti: be676000 task.ti: be676000
PC is at 0xbf1bbc90
LR is at validate_event+0x34/0x5c
pc : [&lt;bf1bbc90&gt;]    lr : [&lt;80016060&gt;]    psr: 00000013
...
[&lt;80016060&gt;] (validate_event) from [&lt;80016198&gt;] (validate_group+0x28/0x90)
[&lt;80016198&gt;] (validate_group) from [&lt;80016398&gt;] (armpmu_event_init+0x150/0x218)
[&lt;80016398&gt;] (armpmu_event_init) from [&lt;800882e4&gt;] (perf_try_init_event+0x30/0x48)
[&lt;800882e4&gt;] (perf_try_init_event) from [&lt;8008f544&gt;] (perf_init_event+0x5c/0xf4)
[&lt;8008f544&gt;] (perf_init_event) from [&lt;8008f8a8&gt;] (perf_event_alloc+0x2cc/0x35c)
[&lt;8008f8a8&gt;] (perf_event_alloc) from [&lt;8009015c&gt;] (SyS_perf_event_open+0x498/0xa70)
[&lt;8009015c&gt;] (SyS_perf_event_open) from [&lt;8000e420&gt;] (ret_fast_syscall+0x0/0x34)
Code: bf1be000 bf1bb380 802a2664 00000000 (00000002)
---[ end trace 01aff0ff00926a0a ]---

Also cleans up the code to use the arm_pmu only when we know that
we are dealing with an arm pmu event.

Cc: Will Deacon &lt;will.deacon@arm.com&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Acked-by: Peter Ziljstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Suzuki K. Poulose &lt;suzuki.poulose@arm.com&gt;
Signed-off-by: Will Deacon &lt;will.deacon@arm.com&gt;
</content>
</entry>
</feed>
