<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/perf, branch v6.4</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=v6.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-06-04T16:19:36Z</updated>
<entry>
<title>KVM: arm64: PMU: Don't overwrite PMUSERENR with vcpu loaded</title>
<updated>2023-06-04T16:19:36Z</updated>
<author>
<name>Reiji Watanabe</name>
<email>reijiw@google.com</email>
</author>
<published>2023-06-03T02:50:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0c2f9acf6ae74118385f7a7d48f4b2d93637b628'/>
<id>urn:sha1:0c2f9acf6ae74118385f7a7d48f4b2d93637b628</id>
<content type='text'>
Currently, with VHE, KVM sets ER, CR, SW and EN bits of
PMUSERENR_EL0 to 1 on vcpu_load(), and saves and restores
the register value for the host on vcpu_load() and vcpu_put().
If the value of those bits are cleared on a pCPU with a vCPU
loaded (armv8pmu_start() would do that when PMU counters are
programmed for the guest), PMU access from the guest EL0 might
be trapped to the guest EL1 directly regardless of the current
PMUSERENR_EL0 value of the vCPU.

Fix this by not letting armv8pmu_start() overwrite PMUSERENR_EL0
on the pCPU where PMUSERENR_EL0 for the guest is loaded, and
instead updating the saved shadow register value for the host
so that the value can be restored on vcpu_put() later.
While vcpu_{put,load}() are manipulating PMUSERENR_EL0, disable
IRQs to prevent a race condition between these processes and IPIs
that attempt to update PMUSERENR_EL0 for the host EL0.

Suggested-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Suggested-by: Marc Zyngier &lt;maz@kernel.org&gt;
Fixes: 83a7a4d643d3 ("arm64: perf: Enable PMU counter userspace access for perf event")
Signed-off-by: Reiji Watanabe &lt;reijiw@google.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Link: https://lore.kernel.org/r/20230603025035.3781797-3-reijiw@google.com
</content>
</entry>
<entry>
<title>RISC-V: Align SBI probe implementation with spec</title>
<updated>2023-04-29T20:04:50Z</updated>
<author>
<name>Andrew Jones</name>
<email>ajones@ventanamicro.com</email>
</author>
<published>2023-04-27T16:36:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=41cad8284d5e6bf1d49d3c10a6b52ee1ae866a20'/>
<id>urn:sha1:41cad8284d5e6bf1d49d3c10a6b52ee1ae866a20</id>
<content type='text'>
sbi_probe_extension() is specified with "Returns 0 if the given SBI
extension ID (EID) is not available, or 1 if it is available unless
defined as any other non-zero value by the implementation."
Additionally, sbiret.value is a long. Fix the implementation to
ensure any nonzero long value is considered a success, rather
than only positive int values.

Fixes: b9dcd9e41587 ("RISC-V: Add basic support for SBI v0.2")
Signed-off-by: Andrew Jones &lt;ajones@ventanamicro.com&gt;
Reviewed-by: Conor Dooley &lt;conor.dooley@microchip.com&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230427163626.101042-1-ajones@ventanamicro.com
Signed-off-by: Palmer Dabbelt &lt;palmer@rivosinc.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux</title>
<updated>2023-04-25T19:39:01Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-04-25T19:39:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=df45da57cbd35715d590a36a12968a94508ccd1f'/>
<id>urn:sha1:df45da57cbd35715d590a36a12968a94508ccd1f</id>
<content type='text'>
Pull arm64 updates from Will Deacon:
 "ACPI:

   - Improve error reporting when failing to manage SDEI on AGDI device
     removal

  Assembly routines:

   - Improve register constraints so that the compiler can make use of
     the zero register instead of moving an immediate #0 into a GPR

   - Allow the compiler to allocate the registers used for CAS
     instructions

  CPU features and system registers:

   - Cleanups to the way in which CPU features are identified from the
     ID register fields

   - Extend system register definition generation to handle Enum types
     when defining shared register fields

   - Generate definitions for new _EL2 registers and add new fields for
     ID_AA64PFR1_EL1

   - Allow SVE to be disabled separately from SME on the kernel
     command-line

  Tracing:

   - Support for "direct calls" in ftrace, which enables BPF tracing for
     arm64

  Kdump:

   - Don't bother unmapping the crashkernel from the linear mapping,
     which then allows us to use huge (block) mappings and reduce TLB
     pressure when a crashkernel is loaded.

  Memory management:

   - Try again to remove data cache invalidation from the coherent DMA
     allocation path

   - Simplify the fixmap code by mapping at page granularity

   - Allow the kfence pool to be allocated early, preventing the rest of
     the linear mapping from being forced to page granularity

  Perf and PMU:

   - Move CPU PMU code out to drivers/perf/ where it can be reused by
     the 32-bit ARM architecture when running on ARMv8 CPUs

   - Fix race between CPU PMU probing and pKVM host de-privilege

   - Add support for Apple M2 CPU PMU

   - Adjust the generic PERF_COUNT_HW_BRANCH_INSTRUCTIONS event
     dynamically, depending on what the CPU actually supports

   - Minor fixes and cleanups to system PMU drivers

  Stack tracing:

   - Use the XPACLRI instruction to strip PAC from pointers, rather than
     rolling our own function in C

   - Remove redundant PAC removal for toolchains that handle this in
     their builtins

   - Make backtracing more resilient in the face of instrumentation

  Miscellaneous:

   - Fix single-step with KGDB

   - Remove harmless warning when 'nokaslr' is passed on the kernel
     command-line

   - Minor fixes and cleanups across the board"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (72 commits)
  KVM: arm64: Ensure CPU PMU probes before pKVM host de-privilege
  arm64: kexec: include reboot.h
  arm64: delete dead code in this_cpu_set_vectors()
  arm64/cpufeature: Use helper macro to specify ID register for capabilites
  drivers/perf: hisi: add NULL check for name
  drivers/perf: hisi: Remove redundant initialized of pmu-&gt;name
  arm64/cpufeature: Consistently use symbolic constants for min_field_value
  arm64/cpufeature: Pull out helper for CPUID register definitions
  arm64/sysreg: Convert HFGITR_EL2 to automatic generation
  ACPI: AGDI: Improve error reporting for problems during .remove()
  arm64: kernel: Fix kernel warning when nokaslr is passed to commandline
  perf/arm-cmn: Fix port detection for CMN-700
  arm64: kgdb: Set PSTATE.SS to 1 to re-enable single-step
  arm64: move PAC masks to &lt;asm/pointer_auth.h&gt;
  arm64: use XPACLRI to strip PAC
  arm64: avoid redundant PAC stripping in __builtin_return_address()
  arm64/sme: Fix some comments of ARM SME
  arm64/signal: Alloc tpidr2 sigframe after checking system_supports_tpidr2()
  arm64/signal: Use system_supports_tpidr2() to check TPIDR2
  arm64/idreg: Don't disable SME when disabling SVE
  ...
</content>
</entry>
<entry>
<title>drivers/perf: hisi: add NULL check for name</title>
<updated>2023-04-17T12:14:10Z</updated>
<author>
<name>Junhao He</name>
<email>hejunhao3@huawei.com</email>
</author>
<published>2023-04-03T08:14:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=257aedb72e731082ab514058e57b132f0b29d707'/>
<id>urn:sha1:257aedb72e731082ab514058e57b132f0b29d707</id>
<content type='text'>
When allocations fails that can be NULL now.

If the name provided is NULL, then the initialization process of the PMU
type and dev will be skipped in function perf_pmu_register().
Consequently, the PMU will not be able to register into the kernel.
Moreover, in the case of unregister the PMU, the function device_del()
will need to handle NULL pointers, which potentially can cause issues.

So move this allocation above the cpuhp_state_add_instance() and directly
return if it does fail.

Signed-off-by: Junhao He &lt;hejunhao3@huawei.com&gt;
Reviewed-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Link: https://lore.kernel.org/r/20230403081423.62460-3-hejunhao3@huawei.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>drivers/perf: hisi: Remove redundant initialized of pmu-&gt;name</title>
<updated>2023-04-17T12:14:10Z</updated>
<author>
<name>Junhao He</name>
<email>hejunhao3@huawei.com</email>
</author>
<published>2023-04-03T08:14:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=25d8c25025a46e7621edde2eb6d5f55c6d29ee86'/>
<id>urn:sha1:25d8c25025a46e7621edde2eb6d5f55c6d29ee86</id>
<content type='text'>
"pmu-&gt;name" is initialized by perf_pmu_register() function, so remove
the redundant initialized in hisi_pmu_init().

Signed-off-by: Junhao He &lt;hejunhao3@huawei.com&gt;
Reviewed-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Link: https://lore.kernel.org/r/20230403081423.62460-2-hejunhao3@huawei.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf/arm-cmn: Fix port detection for CMN-700</title>
<updated>2023-04-14T12:45:00Z</updated>
<author>
<name>Robin Murphy</name>
<email>robin.murphy@arm.com</email>
</author>
<published>2023-04-12T10:29:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ad91e44e6b0c7ef1ed151b3bb2242a2144e6085'/>
<id>urn:sha1:2ad91e44e6b0c7ef1ed151b3bb2242a2144e6085</id>
<content type='text'>
When the "extra device ports" configuration was first added, the
additional mxp_device_port_connect_info registers were added around the
existing mxp_mesh_port_connect_info registers. What I missed about
CMN-700 is that it shuffled them around to remove this discontinuity.
As such, tweak the definitions and factor out a helper for reading these
registers so we can deal with this discrepancy easily, which does at
least allow nicely tidying up the callsites. With this we can then also
do the nice thing and skip accesses completely rather than relying on
RES0 behaviour where we know the extra registers aren't defined.

Fixes: 23760a014417 ("perf/arm-cmn: Add CMN-700 support")
Reported-by: Jing Zhang &lt;renyu.zj@linux.alibaba.com&gt;
Signed-off-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
Link: https://lore.kernel.org/r/71d129241d4d7923cde72a0e5b4c8d2f6084525f.1681295193.git.robin.murphy@arm.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>arm64: pmuv3: dynamically map PERF_COUNT_HW_BRANCH_INSTRUCTIONS</title>
<updated>2023-04-11T11:35:20Z</updated>
<author>
<name>Stephane Eranian</name>
<email>eranian@google.com</email>
</author>
<published>2023-04-11T09:38:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a30b87e6bd7db112deb1e3014b23fb90111bc6c4'/>
<id>urn:sha1:a30b87e6bd7db112deb1e3014b23fb90111bc6c4</id>
<content type='text'>
The mapping of perf_events generic hardware events to actual PMU events on
ARM PMUv3 may not always be correct. This is in particular true for the
PERF_COUNT_HW_BRANCH_INSTRUCTIONS event. Although the mapping points to an
architected event, it may not always be available. This can be seen with a
simple:

$ perf stat -e branches sleep 0
 Performance counter stats for 'sleep 0':

   &lt;not supported&gt;      branches

       0.001401081 seconds time elapsed

Yet the hardware does have an event that could be used for branches.

Dynamically check for a supported hardware event which can be used for
PERF_COUNT_HW_BRANCH_INSTRUCTIONS at mapping time.

And with that:

$ perf stat -e branches sleep 0

 Performance counter stats for 'sleep 0':

           166,739      branches

       0.000832163 seconds time elapsed

Co-developed-by: Stephane Eranian &lt;eranian@google.com&gt;
Signed-off-by: Stephane Eranian &lt;eranian@google.com&gt;
Co-developed-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Co-developed-by: Peter Newman &lt;peternewman@google.com&gt;
Signed-off-by: Peter Newman &lt;peternewman@google.com&gt;
Link: https://lore.kernel.org/all/YvunKCJHSXKz%2FkZB@FVFF77S0Q05N
Link: https://lore.kernel.org/r/20230411093809.657501-1-peternewman@google.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf/arm-cmn: Validate cycles events fully</title>
<updated>2023-04-06T15:07:51Z</updated>
<author>
<name>Robin Murphy</name>
<email>robin.murphy@arm.com</email>
</author>
<published>2023-04-03T11:49:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=23b2fd83948952ffee2e96ce6a982be9d8e96f9f'/>
<id>urn:sha1:23b2fd83948952ffee2e96ce6a982be9d8e96f9f</id>
<content type='text'>
DTC cycle count events don't have anything to validate or initialise in
themselves, but we should not forget to still validate their whole group
context. Otherwise, we may fail to correctly reject a contrived group
containing an impossible number of cycles events.

Signed-off-by: Robin Murphy &lt;robin.murphy@arm.com&gt;
Link: https://lore.kernel.org/r/3124e8c276a1f513c1a415dc839ca4181b3c8bc8.1680522545.git.robin.murphy@arm.com
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
<entry>
<title>perf/amlogic: adjust register offsets</title>
<updated>2023-03-27T15:31:22Z</updated>
<author>
<name>Marc Gonzalez</name>
<email>mgonzalez@freebox.fr</email>
</author>
<published>2023-03-27T12:09:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f9d323e7c1724270d747657051099826744e91e7'/>
<id>urn:sha1:f9d323e7c1724270d747657051099826744e91e7</id>
<content type='text'>
Commit "perf/amlogic: resolve conflict between canvas &amp; pmu"
changed the base address.

Fixes: 2016e2113d35 ("perf/amlogic: Add support for Amlogic meson G12 SoC DDR PMU driver")
Signed-off-by: Marc Gonzalez &lt;mgonzalez@freebox.fr&gt;
Acked-by: Will Deacon &lt;will@kernel.org&gt;
Reviewed-by: Neil Armstrong &lt;neil.armstrong@linaro.org&gt;
Link: https://lore.kernel.org/r/20230327120932.2158389-4-mgonzalez@freebox.fr
Signed-off-by: Neil Armstrong &lt;neil.armstrong@linaro.org&gt;
</content>
</entry>
<entry>
<title>drivers/perf: apple_m1: Add Apple M2 support</title>
<updated>2023-03-27T14:15:14Z</updated>
<author>
<name>Janne Grunau</name>
<email>j@jannau.net</email>
</author>
<published>2023-02-14T10:38:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7d0bfb7c997753ef88f4c3a29f3409c8cb052ab1'/>
<id>urn:sha1:7d0bfb7c997753ef88f4c3a29f3409c8cb052ab1</id>
<content type='text'>
The PMU itself is compatible with the one found on M1. We still know
next to nothing about the counters so keep using CPU uarch specific
compatibles/PMU names.

Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Acked-by: Mark Rutland &lt;mark.rutland@arm.com.
Reviewed-by: Hector Martin &lt;marcan@marcan.st&gt;
Link: https://lore.kernel.org/r/20230214-apple_m2_pmu-v1-2-9c9213ab9b63@jannau.net
Signed-off-by: Will Deacon &lt;will@kernel.org&gt;
</content>
</entry>
</feed>
