<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/arch/powerpc/perf, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/arch/powerpc/perf?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/arch/powerpc/perf?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-10-10T16:27:46Z</updated>
<entry>
<title>Merge tag 'perf-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2022-10-10T16:27:46Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-10-10T16:27:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3871d93b82a4a6c1f4308064f046a544f16ada21'/>
<id>urn:sha1:3871d93b82a4a6c1f4308064f046a544f16ada21</id>
<content type='text'>
Pull perf events updates from Ingo Molnar:
 "PMU driver updates:

   - Add AMD Last Branch Record Extension Version 2 (LbrExtV2) feature
     support for Zen 4 processors.

   - Extend the perf ABI to provide branch speculation information, if
     available, and use this on CPUs that have it (eg. LbrExtV2).

   - Improve Intel PEBS TSC timestamp handling &amp; integration.

   - Add Intel Raptor Lake S CPU support.

   - Add 'perf mem' and 'perf c2c' memory profiling support on AMD CPUs
     by utilizing IBS tagged load/store samples.

   - Clean up &amp; optimize various x86 PMU details.

  HW breakpoints:

   - Big rework to optimize the code for systems with hundreds of CPUs
     and thousands of breakpoints:

      - Replace the nr_bp_mutex global mutex with the bp_cpuinfo_sem
        per-CPU rwsem that is read-locked during most of the key
        operations.

      - Improve the O(#cpus * #tasks) logic in toggle_bp_slot() and
        fetch_bp_busy_slots().

      - Apply micro-optimizations &amp; cleanups.

  - Misc cleanups &amp; enhancements"

* tag 'perf-core-2022-10-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (75 commits)
  perf/hw_breakpoint: Annotate tsk-&gt;perf_event_mutex vs ctx-&gt;mutex
  perf: Fix pmu_filter_match()
  perf: Fix lockdep_assert_event_ctx()
  perf/x86/amd/lbr: Adjust LBR regardless of filtering
  perf/x86/utils: Fix uninitialized var in get_branch_type()
  perf/uapi: Define PERF_MEM_SNOOPX_PEER in kernel header file
  perf/x86/amd: Support PERF_SAMPLE_PHY_ADDR
  perf/x86/amd: Support PERF_SAMPLE_ADDR
  perf/x86/amd: Support PERF_SAMPLE_{WEIGHT|WEIGHT_STRUCT}
  perf/x86/amd: Support PERF_SAMPLE_DATA_SRC
  perf/x86/amd: Add IBS OP_DATA2 DataSrc bit definitions
  perf/mem: Introduce PERF_MEM_LVLNUM_{EXTN_MEM|IO}
  perf/x86/uncore: Add new Raptor Lake S support
  perf/x86/cstate: Add new Raptor Lake S support
  perf/x86/msr: Add new Raptor Lake S support
  perf/x86: Add new Raptor Lake S support
  bpf: Check flags for branch stack in bpf_read_branch_records helper
  perf, hw_breakpoint: Fix use-after-free if perf_event_open() fails
  perf: Use sample_flags for raw_data
  perf: Use sample_flags for addr
  ...
</content>
</entry>
<entry>
<title>powerpc/perf: Fix branch_filter support for multiple filters</title>
<updated>2022-09-28T09:22:13Z</updated>
<author>
<name>Athira Rajeev</name>
<email>atrajeev@linux.vnet.ibm.com</email>
</author>
<published>2022-09-21T14:52:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b9c001276d4a756f98cc7dc4672eff5343949203'/>
<id>urn:sha1:b9c001276d4a756f98cc7dc4672eff5343949203</id>
<content type='text'>
For PERF_SAMPLE_BRANCH_STACK sample type, different branch_sample_type
ie branch filters are supported. The branch filters are requested via
event attribute "branch_sample_type". Multiple branch filters can be
passed in event attribute. eg:

  $ perf record -b -o- -B --branch-filter any,ind_call true

None of the Power PMUs support having multiple branch filters at
the same time. Branch filters for branch stack sampling is set via MMCRA
IFM bits [32:33]. But currently when requesting for multiple filter
types, the "perf record" command does not report any error.

eg:
  $ perf record -b -o- -B --branch-filter any,save_type true
  $ perf record -b -o- -B --branch-filter any,ind_call true

The "bhrb_filter_map" function in PMU driver code does the validity
check for supported branch filters. But this check is done for single
filter. Hence "perf record" will proceed here without reporting any
error.

Fix power_pmu_event_init() to return EOPNOTSUPP when multiple branch
filters are requested in the event attr.

After the fix:
  $ perf record --branch-filter any,ind_call -- ls
  Error:
  cycles: PMU Hardware doesn't support sampling/overflow-interrupts.
  Try 'perf stat'

Reported-by: Disha Goel &lt;disgoel@linux.vnet.ibm.com&gt;
Signed-off-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Tested-by: Disha Goel&lt;disgoel@linux.vnet.ibm.com&gt;
Reviewed-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
Reviewed-by: Kajol Jain &lt;kjain@linux.ibm.com&gt;
[mpe: Tweak comment and change log wording]
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20220921145255.20972-1-atrajeev@linux.vnet.ibm.com

</content>
</entry>
<entry>
<title>powerpc/64: asm use consistent global variable declaration and access</title>
<updated>2022-09-28T09:22:12Z</updated>
<author>
<name>Nicholas Piggin</name>
<email>npiggin@gmail.com</email>
</author>
<published>2022-09-26T03:40:54Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=dab3b8f4fd09c22e8dbb2d9608194c7d52252f33'/>
<id>urn:sha1:dab3b8f4fd09c22e8dbb2d9608194c7d52252f33</id>
<content type='text'>
Use helper macros to access global variables, and place them in .data
sections rather than in .toc. Putting addresses in TOC is not required
because the kernel is linked with a single TOC.

Signed-off-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20220926034057.2360083-3-npiggin@gmail.com

</content>
</entry>
<entry>
<title>powerpc: Include all arch-specific syscall prototypes</title>
<updated>2022-09-28T09:22:08Z</updated>
<author>
<name>Rohan McLure</name>
<email>rmclure@linux.ibm.com</email>
</author>
<published>2022-09-21T06:55:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8cd1def4b8e4a592949509fac443e850da8428d0'/>
<id>urn:sha1:8cd1def4b8e4a592949509fac443e850da8428d0</id>
<content type='text'>
Forward declare all syscall handler prototypes where a generic prototype
is not provided in either linux/syscalls.h or linux/compat.h in
asm/syscalls.h. This is required for compile-time type-checking for
syscall handlers, which is implemented later in this series.

32-bit compatibility syscall handlers are expressed in terms of types in
ppc32.h. Expose this header globally.

Signed-off-by: Rohan McLure &lt;rmclure@linux.ibm.com&gt;
Acked-by: Nicholas Piggin &lt;npiggin@gmail.com&gt;
[mpe: Use standard include guard naming for syscalls_32.h]
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20220921065605.1051927-17-rmclure@linux.ibm.com

</content>
</entry>
<entry>
<title>perf: Use sample_flags for data_src</title>
<updated>2022-09-06T09:33:03Z</updated>
<author>
<name>Kan Liang</name>
<email>kan.liang@linux.intel.com</email>
</author>
<published>2022-09-01T13:09:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=e16fd7f2cb1a65555cfe76f983eaefb1eab7471f'/>
<id>urn:sha1:e16fd7f2cb1a65555cfe76f983eaefb1eab7471f</id>
<content type='text'>
Use the new sample_flags to indicate whether the data_src field is
filled by the PMU driver.

Remove the data_src field from the perf_sample_data_init() to minimize
the number of cache lines touched.

Signed-off-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220901130959.1285717-6-kan.liang@linux.intel.com
</content>
</entry>
<entry>
<title>perf: Use sample_flags for weight</title>
<updated>2022-09-06T09:33:02Z</updated>
<author>
<name>Kan Liang</name>
<email>kan.liang@linux.intel.com</email>
</author>
<published>2022-09-01T13:09:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2abe681da0a192ab850a5271d838a7817b469fca'/>
<id>urn:sha1:2abe681da0a192ab850a5271d838a7817b469fca</id>
<content type='text'>
Use the new sample_flags to indicate whether the weight field is filled
by the PMU driver.

Remove the weight field from the perf_sample_data_init() to minimize the
number of cache lines touched.

Signed-off-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220901130959.1285717-5-kan.liang@linux.intel.com
</content>
</entry>
<entry>
<title>perf: Use sample_flags for branch stack</title>
<updated>2022-09-06T09:33:02Z</updated>
<author>
<name>Kan Liang</name>
<email>kan.liang@linux.intel.com</email>
</author>
<published>2022-09-01T13:09:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=a9a931e2666878343782c82d7d55cc173ddeb3e9'/>
<id>urn:sha1:a9a931e2666878343782c82d7d55cc173ddeb3e9</id>
<content type='text'>
Use the new sample_flags to indicate whether the branch stack is filled
by the PMU driver.

Remove the br_stack from the perf_sample_data_init() to minimize the number
of cache lines touched.

Signed-off-by: Kan Liang &lt;kan.liang@linux.intel.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20220901130959.1285717-4-kan.liang@linux.intel.com
</content>
</entry>
<entry>
<title>powerpc/perf: Add missing of_node_put()s in imc-pmu.c</title>
<updated>2022-09-05T07:28:26Z</updated>
<author>
<name>Liang He</name>
<email>windhl@126.com</email>
</author>
<published>2022-06-18T07:13:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0dd8d2c8066e672244975c171816fdd9dae87721'/>
<id>urn:sha1:0dd8d2c8066e672244975c171816fdd9dae87721</id>
<content type='text'>
In update_events_in_group(), of_find_node_by_phandle() will return
a node pointer with refcount incremented. The reference should be
dropped with of_node_put() in the failure path or when it is not used
anymore.

Signed-off-by: Liang He &lt;windhl@126.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Reviewed-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Link: https://lore.kernel.org/r/20220618071353.4059000-1-windhl@126.com

</content>
</entry>
<entry>
<title>powerpc/perf: Include caps feature for power10 DD1 version</title>
<updated>2022-08-01T12:21:18Z</updated>
<author>
<name>Athira Rajeev</name>
<email>atrajeev@linux.vnet.ibm.com</email>
</author>
<published>2022-07-28T16:37:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=8c9f37a78f70fad763f0d61f03245bb011765086'/>
<id>urn:sha1:8c9f37a78f70fad763f0d61f03245bb011765086</id>
<content type='text'>
Commit 6320e693d98c ("powerpc/perf: Add support for caps under sysfs in
powerpc") added support for caps under sysfs in powerpc. This added caps
directory to: /sys/bus/event_source/devices/cpu/ for power8, power9,
power10 and generic compat PMU in respective PMU driver code.

For power10, it is added under "power10_pmu_attr_groups". But
for DD1 version, attr_groups are defined under dd1 array:
"power10_pmu_attr_groups_dd1". Since caps is not added for DD1,
it fails to include "cpu/caps" in DD1 model.

The issue was observed while booting power10 pseries with qemu version
6, but not observed with qemu version 7. This is because qemu version 7
uses a DD 2.0 CPU model.

Below is the trace log:

  Can't update unknown attr grp name: cpu/caps^M
  ------------[ cut here ]------------^M
  Failed to register pmu: cpu, reason -22^M
  WARNING: CPU: 1 PID: 1 at kernel/events/core.c:13427 perf_event_sysfs_init+0xbc/0x108^M
  Modules linked in:^M
  CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc2-00111-g6320e693d98c #148^M
  NIP:  c0000000020391f4 LR: c0000000020391f0 CTR: c0000000008c9c30^M
  REGS: c0000000044c38c0 TRAP: 0700   Not tainted  (5.19.0-rc2-00111-g6320e693d98c)^M
  MSR:  8000000002029033 &lt;SF,VEC,EE,ME,IR,DR,RI,LE&gt;  CR: 48000281  XER: 20040000^M
  CFAR: c00000000013feac IRQMASK: 0 ^M
  GPR00: c0000000020391f0 c0000000044c3b60 c00000000283db00 0000000000000027 ^M
  GPR04: 80000000ffffe0a8 0000000000000000 0000000000000004 00000000fdcd0000 ^M
  GPR08: 0000000000000027 c0000000ffe07e08 0000000000000001 0000000000000000 ^M
  GPR12: c00000000035dd90 c0000000fffff300 c000000000012478 0000000000000000 ^M
  GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ^M
  GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ^M
  GPR24: c000000002003480 0000000000000007 c0000000012a78d0 c000000001170a80 ^M
  GPR28: c0000000026c4df8 c0000000026c4e68 0000000000000000 c0000000025a8628 ^M
  NIP [c0000000020391f4] perf_event_sysfs_init+0xbc/0x108^M
  LR [c0000000020391f0] perf_event_sysfs_init+0xb8/0x108^M
  Call Trace:^M
  [c0000000044c3b60] [c0000000020391f0] perf_event_sysfs_init+0xb8/0x108 (unreliable)^M
  [c0000000044c3bf0] [c000000000011ec4] do_one_initcall+0x64/0x2d0^M
  [c0000000044c3cd0] [c0000000020049fc] kernel_init_freeable+0x338/0x3e0^M
  [c0000000044c3db0] [c0000000000124a0] kernel_init+0x30/0x1a0^M
  [c0000000044c3e10] [c00000000000cd54] ret_from_kernel_thread+0x5c/0x64^M
  Instruction dump:^M
  813f0038 2c090000 4180002c 7fe3fb78 4a3280c5 2c030000 7c651b78 41820018 ^M
  e89f0030 7f63db78 4a106c59 60000000 &lt;0fe00000&gt; ebff0000 4bffffb4 39200001 ^M
  ---[ end trace 0000000000000000 ]---^M

Fix it by adding caps for dd1 attr_groups in power10 PMU driver.

Fixes: 6320e693d98c ("powerpc/perf: Add support for caps under sysfs in powerpc")
Signed-off-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
[mpe: Update change log to mention qemu 7 DD2.0 CPU model]
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20220728163746.85062-1-atrajeev@linux.vnet.ibm.com

</content>
</entry>
<entry>
<title>powerpc/perf: Use PVR rather than oprofile field to determine CPU version</title>
<updated>2022-07-27T11:36:05Z</updated>
<author>
<name>Rashmica Gupta</name>
<email>rashmica.g@gmail.com</email>
</author>
<published>2022-07-07T14:37:17Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ec3eb9d941a98f4c0dac263110729680a734279b'/>
<id>urn:sha1:ec3eb9d941a98f4c0dac263110729680a734279b</id>
<content type='text'>
Currently the perf CPU backend drivers detect what CPU they're on using
cur_cpu_spec-&gt;oprofile_cpu_type.

Although that works, it's a bit crufty to be using oprofile related fields,
especially seeing as oprofile is more or less unused these days.

It also means perf is reliant on the fragile logic in setup_cpu_spec()
which detects when we're using a logical PVR and copies back the PMU
related fields from the raw CPU entry. So lets check the PVR directly.

Suggested-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Signed-off-by: Rashmica Gupta &lt;rashmica.g@gmail.com&gt;
Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Reviewed-by: Madhavan Srinivasan &lt;maddy@linux.vnet.ibm.com&gt;
[chleroy: Added power10 and fixed checkpatch issues]
Reviewed-and-tested-by: Athira Rajeev &lt;atrajeev@linux.vnet.ibm.com&gt;
Reviewed-and-tested-By: Kajol Jain &lt;kjain@linux.ibm.com&gt; [For 24x7 side changes]
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20c0ee7f99dbf0dbf8658df6b39f84753e6db1ef.1657204631.git.christophe.leroy@csgroup.eu

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