[PATCH v4 0/8] perf: arm: Make PMUv3 driver available for aarch32

Zaid Al-Bassam posted 8 patches 2 years, 5 months ago
arch/arm/Kconfig                              |   1 +
arch/arm/include/asm/arm_pmuv3.h              | 247 ++++++++++++++
arch/arm/mm/Kconfig                           |   2 +-
arch/arm64/include/asm/arm_pmuv3.h            | 155 +++++++++
arch/arm64/include/asm/perf_event.h           | 249 --------------
arch/arm64/kernel/Makefile                    |   1 -
drivers/perf/Kconfig                          |  10 +
drivers/perf/Makefile                         |   1 +
.../perf_event.c => drivers/perf/arm_pmuv3.c  | 131 ++------
include/kvm/arm_pmu.h                         |   2 +-
include/linux/perf/arm_pmuv3.h                | 303 ++++++++++++++++++
11 files changed, 751 insertions(+), 351 deletions(-)
create mode 100644 arch/arm/include/asm/arm_pmuv3.h
create mode 100644 arch/arm64/include/asm/arm_pmuv3.h
rename arch/arm64/kernel/perf_event.c => drivers/perf/arm_pmuv3.c (93%)
create mode 100644 include/linux/perf/arm_pmuv3.h
[PATCH v4 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Zaid Al-Bassam 2 years, 5 months ago
Currently, PMUv3 driver is only available for ARMv8 aarch64 platforms,
ARMv8 platorms running in aarch32 mode dont have access to the driver.
This is, especially, a problem for ARMv8 platforms that only have
aarch32 support, like the Cortex-A32.

Make the PMUv3 driver available to arm arch (ARMv8 aarch32) by moving
the PMUv3 driver from arm64 to drivers, that makes the driver common
to both arm and arm64 architectures, then add PMUv3 arm Support.

The main work in this patchset was made a while back by Marc Zyngier
in [1]. Patchset version 1 [v1] rebases Marc's patches to the latest
kernel revision and adds additional patches to accommodate the changes
in the kernel since Marc wrote the patches.

version 2 [v2] of the patchset was created by Marc Zyngier and I
picked it up from [2].

Changes in v2:
- Flattened the nested switches in the arm_pmuv3.h for arm.
- Removed wrappers and added stubs for the PMU KVM functions for arm.
- Added PMU version abstractions.

Changes in v3:
- Removed the link tag from the commit messages.
- Fixed the license header in the arm_pmuv3.h files.

Changes in v4:
- Rebased to 6.3.0-rc2 (Clean rebase)

[1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm/pmuv3-32bit
[2] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=arm/pmuv3

[v1] https://lore.kernel.org/all/20230126204444.2204061-1-zalbassam@google.com/
[v2] https://lore.kernel.org/all/20230210165500.2292608-1-zalbassam@google.com/
[v3] https://lore.kernel.org/all/20230213210319.1075872-1-zalbassam@google.com/

Thank you,
Zaid Al-Bassam

Marc Zyngier (5):
  arm64: perf: Move PMUv3 driver to drivers/perf
  arm64: perf: Abstract system register accesses away
  ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations
  ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM
  ARM: mach-virt: Select PMUv3 driver by default

Zaid Al-Bassam (3):
  perf: pmuv3: Abstract PMU version checks
  perf: pmuv3: Move inclusion of kvm_host.h to the arch-specific helper
  perf: pmuv3: Change GENMASK to GENMASK_ULL

 arch/arm/Kconfig                              |   1 +
 arch/arm/include/asm/arm_pmuv3.h              | 247 ++++++++++++++
 arch/arm/mm/Kconfig                           |   2 +-
 arch/arm64/include/asm/arm_pmuv3.h            | 155 +++++++++
 arch/arm64/include/asm/perf_event.h           | 249 --------------
 arch/arm64/kernel/Makefile                    |   1 -
 drivers/perf/Kconfig                          |  10 +
 drivers/perf/Makefile                         |   1 +
 .../perf_event.c => drivers/perf/arm_pmuv3.c  | 131 ++------
 include/kvm/arm_pmu.h                         |   2 +-
 include/linux/perf/arm_pmuv3.h                | 303 ++++++++++++++++++
 11 files changed, 751 insertions(+), 351 deletions(-)
 create mode 100644 arch/arm/include/asm/arm_pmuv3.h
 create mode 100644 arch/arm64/include/asm/arm_pmuv3.h
 rename arch/arm64/kernel/perf_event.c => drivers/perf/arm_pmuv3.c (93%)
 create mode 100644 include/linux/perf/arm_pmuv3.h

-- 
2.40.0.rc2.332.ga46443480c-goog
Re: [PATCH v4 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Florian Fainelli 2 years, 5 months ago
On 3/17/23 12:50, Zaid Al-Bassam wrote:
> Currently, PMUv3 driver is only available for ARMv8 aarch64 platforms,
> ARMv8 platorms running in aarch32 mode dont have access to the driver.
> This is, especially, a problem for ARMv8 platforms that only have
> aarch32 support, like the Cortex-A32.
> 
> Make the PMUv3 driver available to arm arch (ARMv8 aarch32) by moving
> the PMUv3 driver from arm64 to drivers, that makes the driver common
> to both arm and arm64 architectures, then add PMUv3 arm Support.
> 
> The main work in this patchset was made a while back by Marc Zyngier
> in [1]. Patchset version 1 [v1] rebases Marc's patches to the latest
> kernel revision and adds additional patches to accommodate the changes
> in the kernel since Marc wrote the patches.
> 
> version 2 [v2] of the patchset was created by Marc Zyngier and I
> picked it up from [2].
> 
> Changes in v2:
> - Flattened the nested switches in the arm_pmuv3.h for arm.
> - Removed wrappers and added stubs for the PMU KVM functions for arm.
> - Added PMU version abstractions.
> 
> Changes in v3:
> - Removed the link tag from the commit messages.
> - Fixed the license header in the arm_pmuv3.h files.
> 
> Changes in v4:
> - Rebased to 6.3.0-rc2 (Clean rebase)
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm/pmuv3-32bit
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=arm/pmuv3
> 
> [v1] https://lore.kernel.org/all/20230126204444.2204061-1-zalbassam@google.com/
> [v2] https://lore.kernel.org/all/20230210165500.2292608-1-zalbassam@google.com/
> [v3] https://lore.kernel.org/all/20230213210319.1075872-1-zalbassam@google.com/
> 
> Thank you,
> Zaid Al-Bassam

Tested-by: Florian Fainelli <f.fainelli@gmail.com>

on Cortex-A53 and Cortex-A72, thanks!
-- 
Florian
Re: [PATCH v4 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Marc Zyngier 2 years, 5 months ago
On Fri, 17 Mar 2023 19:50:19 +0000,
Zaid Al-Bassam <zalbassam@google.com> wrote:
> 
> Currently, PMUv3 driver is only available for ARMv8 aarch64 platforms,
> ARMv8 platorms running in aarch32 mode dont have access to the driver.
> This is, especially, a problem for ARMv8 platforms that only have
> aarch32 support, like the Cortex-A32.
> 
> Make the PMUv3 driver available to arm arch (ARMv8 aarch32) by moving
> the PMUv3 driver from arm64 to drivers, that makes the driver common
> to both arm and arm64 architectures, then add PMUv3 arm Support.
> 
> The main work in this patchset was made a while back by Marc Zyngier
> in [1]. Patchset version 1 [v1] rebases Marc's patches to the latest
> kernel revision and adds additional patches to accommodate the changes
> in the kernel since Marc wrote the patches.
> 
> version 2 [v2] of the patchset was created by Marc Zyngier and I
> picked it up from [2].

The SoB chain is now a bit off as you picked it from my tree. Nothing
that we can't fix, but please be careful in the future. You also
failed to pick Florian's Tested-by: tags, which is worse. Please make
sure to pick these things as people reply to your series.

Will, Mark: any objection to the general shape of this series? I've
been using it again to test the 32bit PMU support in KVM, and would
rather see something merged while the architecture still has some
relevance.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
Re: [PATCH v4 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Mark Rutland 2 years, 5 months ago
On Sat, Mar 18, 2023 at 10:02:33AM +0000, Marc Zyngier wrote:
> On Fri, 17 Mar 2023 19:50:19 +0000,
> Zaid Al-Bassam <zalbassam@google.com> wrote:
> > 
> > Currently, PMUv3 driver is only available for ARMv8 aarch64 platforms,
> > ARMv8 platorms running in aarch32 mode dont have access to the driver.
> > This is, especially, a problem for ARMv8 platforms that only have
> > aarch32 support, like the Cortex-A32.
> > 
> > Make the PMUv3 driver available to arm arch (ARMv8 aarch32) by moving
> > the PMUv3 driver from arm64 to drivers, that makes the driver common
> > to both arm and arm64 architectures, then add PMUv3 arm Support.
> > 
> > The main work in this patchset was made a while back by Marc Zyngier
> > in [1]. Patchset version 1 [v1] rebases Marc's patches to the latest
> > kernel revision and adds additional patches to accommodate the changes
> > in the kernel since Marc wrote the patches.
> > 
> > version 2 [v2] of the patchset was created by Marc Zyngier and I
> > picked it up from [2].
> 
> The SoB chain is now a bit off as you picked it from my tree. Nothing
> that we can't fix, but please be careful in the future. You also
> failed to pick Florian's Tested-by: tags, which is worse. Please make
> sure to pick these things as people reply to your series.
> 
> Will, Mark: any objection to the general shape of this series? I've
> been using it again to test the 32bit PMU support in KVM, and would
> rather see something merged while the architecture still has some
> relevance.

I think the general shape looks fine, but this is going to conflict with
Anshuman's BRBE series, so we'll need to figure out how to stage these w.r.t.
one another.

Will, any preference between handling the merge manually or rebasing one atop
the other? We'll presumably want to place the BRBE files under drivers/perf/ if
we've moved the PMUv3 code there.

Thanks,
Mark.
Re: [PATCH v4 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Will Deacon 2 years, 5 months ago
On Fri, Mar 24, 2023 at 01:56:42PM +0000, Mark Rutland wrote:
> On Sat, Mar 18, 2023 at 10:02:33AM +0000, Marc Zyngier wrote:
> > On Fri, 17 Mar 2023 19:50:19 +0000,
> > Zaid Al-Bassam <zalbassam@google.com> wrote:
> > > 
> > > Currently, PMUv3 driver is only available for ARMv8 aarch64 platforms,
> > > ARMv8 platorms running in aarch32 mode dont have access to the driver.
> > > This is, especially, a problem for ARMv8 platforms that only have
> > > aarch32 support, like the Cortex-A32.
> > > 
> > > Make the PMUv3 driver available to arm arch (ARMv8 aarch32) by moving
> > > the PMUv3 driver from arm64 to drivers, that makes the driver common
> > > to both arm and arm64 architectures, then add PMUv3 arm Support.
> > > 
> > > The main work in this patchset was made a while back by Marc Zyngier
> > > in [1]. Patchset version 1 [v1] rebases Marc's patches to the latest
> > > kernel revision and adds additional patches to accommodate the changes
> > > in the kernel since Marc wrote the patches.
> > > 
> > > version 2 [v2] of the patchset was created by Marc Zyngier and I
> > > picked it up from [2].
> > 
> > The SoB chain is now a bit off as you picked it from my tree. Nothing
> > that we can't fix, but please be careful in the future. You also
> > failed to pick Florian's Tested-by: tags, which is worse. Please make
> > sure to pick these things as people reply to your series.
> > 
> > Will, Mark: any objection to the general shape of this series? I've
> > been using it again to test the 32bit PMU support in KVM, and would
> > rather see something merged while the architecture still has some
> > relevance.
> 
> I think the general shape looks fine, but this is going to conflict with
> Anshuman's BRBE series, so we'll need to figure out how to stage these w.r.t.
> one another.
> 
> Will, any preference between handling the merge manually or rebasing one atop
> the other? We'll presumably want to place the BRBE files under drivers/perf/ if
> we've moved the PMUv3 code there.

Probably easiest to queue this and have Anshuman rebase BRBE on top once
I've done that. I'll look at it next week.

Will
Re: [PATCH v4 0/8] perf: arm: Make PMUv3 driver available for aarch32
Posted by Will Deacon 2 years, 5 months ago
On Fri, 17 Mar 2023 15:50:19 -0400, Zaid Al-Bassam wrote:
> Currently, PMUv3 driver is only available for ARMv8 aarch64 platforms,
> ARMv8 platorms running in aarch32 mode dont have access to the driver.
> This is, especially, a problem for ARMv8 platforms that only have
> aarch32 support, like the Cortex-A32.
> 
> Make the PMUv3 driver available to arm arch (ARMv8 aarch32) by moving
> the PMUv3 driver from arm64 to drivers, that makes the driver common
> to both arm and arm64 architectures, then add PMUv3 arm Support.
> 
> [...]

Applied to will (for-next/perf), thanks!

[1/8] arm64: perf: Move PMUv3 driver to drivers/perf
      https://git.kernel.org/will/c/7755cec63ade
[2/8] arm64: perf: Abstract system register accesses away
      https://git.kernel.org/will/c/df29ddf4f04b
[3/8] perf: pmuv3: Abstract PMU version checks
      https://git.kernel.org/will/c/711432770f78
[4/8] perf: pmuv3: Move inclusion of kvm_host.h to the arch-specific helper
      https://git.kernel.org/will/c/11fba29a8a1f
[5/8] perf: pmuv3: Change GENMASK to GENMASK_ULL
      https://git.kernel.org/will/c/b3a070869f39
[6/8] ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations
      https://git.kernel.org/will/c/252309adc81f
[7/8] ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM
      https://git.kernel.org/will/c/009d6dc87a56
[8/8] ARM: mach-virt: Select PMUv3 driver by default
      https://git.kernel.org/will/c/3b16f6268e66

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev