1. 20 Apr, 2023 1 commit
    • Will Deacon's avatar
      KVM: arm64: Ensure CPU PMU probes before pKVM host de-privilege · 87727ba2
      Will Deacon authored
      Although pKVM supports CPU PMU emulation for non-protected guests since
      722625c6 ("KVM: arm64: Reenable pmu in Protected Mode"), this relies
      on the PMU driver probing before the host has de-privileged so that the
      'kvm_arm_pmu_available' static key can still be enabled by patching the
      hypervisor text.
      
      As it happens, both of these events hang off device_initcall() but the
      PMU consistently won the race until 7755cec6 ("arm64: perf: Move
      PMUv3 driver to drivers/perf"). Since then, the host will fail to boot
      when pKVM is enabled:
      
        | hw perfevents: enabled with armv8_pmuv3_0 PMU driver, 7 counters available
        | kvm [1]: nVHE hyp BUG at: [<ffff8000090366e0>] __kvm_nvhe_handle_host_mem_abort+0x270/0x284!
        | kvm [1]: Cannot dump pKVM nVHE stacktrace: !CONFIG_PROTECTED_NVHE_STACKTRACE
        | kvm [1]: Hyp Offset: 0xfffea41fbdf70000
        | Kernel panic - not syncing: HYP panic:
        | PS:a00003c9 PC:0000dbe04b0c66e0 ESR:00000000f2000800
        | FAR:fffffbfffddfcf00 HPFAR:00000000010b0bf0 PAR:0000000000000000
        | VCPU:0000000000000000
        | CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.3.0-rc7-00083-g0bce6746d154 #1
        | Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
        | Call trace:
        |  dump_backtrace+0xec/0x108
        |  show_stack+0x18/0x2c
        |  dump_stack_lvl+0x50/0x68
        |  dump_stack+0x18/0x24
        |  panic+0x13c/0x33c
        |  nvhe_hyp_panic_handler+0x10c/0x190
        |  aarch64_insn_patch_text_nosync+0x64/0xc8
        |  arch_jump_label_transform+0x4c/0x5c
        |  __jump_label_update+0x84/0xfc
        |  jump_label_update+0x100/0x134
        |  static_key_enable_cpuslocked+0x68/0xac
        |  static_key_enable+0x20/0x34
        |  kvm_host_pmu_init+0x88/0xa4
        |  armpmu_register+0xf0/0xf4
        |  arm_pmu_acpi_probe+0x2ec/0x368
        |  armv8_pmu_driver_init+0x38/0x44
        |  do_one_initcall+0xcc/0x240
      
      Fix the race properly by deferring the de-privilege step to
      device_initcall_sync(). This will also be needed in future when probing
      IOMMU devices and allows us to separate the pKVM de-privilege logic from
      the core hypervisor initialisation path.
      
      Cc: Oliver Upton <oliver.upton@linux.dev>
      Cc: Fuad Tabba <tabba@google.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Fixes: 7755cec6 ("arm64: perf: Move PMUv3 driver to drivers/perf")
      Tested-by: default avatarFuad Tabba <tabba@google.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20230420123356.2708-1-will@kernel.orgSigned-off-by: default avatarWill Deacon <will@kernel.org>
      87727ba2
  2. 17 Apr, 2023 2 commits
  3. 14 Apr, 2023 1 commit
  4. 11 Apr, 2023 1 commit
  5. 06 Apr, 2023 1 commit
  6. 28 Mar, 2023 1 commit
    • Will Deacon's avatar
      Revert "ARM: mach-virt: Select PMUv3 driver by default" · 4248d043
      Will Deacon authored
      This reverts commit 3b16f626.
      
      Selecting a Kconfig option that has its own set of dependencies tends to
      end badly, and in this case 'randconfig' builds blew up on 32-bit ARM
      where ARM_PMUV3 was being selecting with HW_PERF_EVENTS=n:
      
        |    drivers/perf/arm_pmuv3.c:68:5: error: use of undeclared identifier 'DTLB'
        |            [C(DTLB)][C(OP_READ)][C(RESULT_ACCESS)] = ARMV8_PMUV3_PERFCTR_L1D_TLB,
        |               ^
        |    fatal error: too many errors emitted, stopping now [-ferror-limit=]
        |    20 errors generated.
        |
        | Kconfig warnings: (for reference only)
        |    WARNING: unmet direct dependencies detected for ARM_PMUV3
        |    Depends on [n]: PERF_EVENTS [=y] && HW_PERF_EVENTS [=n] && (ARM [=y] && CPU_V7 [=y] || ARM64)
        |    Selected by [y]:
        |    - ARCH_VIRT [=y] && ARCH_MULTI_V7 [=y] && PERF_EVENTS [=y]
      
      As suggested by Marc, just drop the 'select' clause altogether by
      reverting the patch which introduced it.
      
      Link: https://lore.kernel.org/r/202303281539.zzI4vpw1-lkp@intel.comReported-by: default avatarkernel test robot <lkp@intel.com>
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Suggested-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      4248d043
  7. 27 Mar, 2023 17 commits
  8. 19 Mar, 2023 16 commits