acrn-kernel/arch/arm64/kvm
Oliver Upton 30c60dda21 KVM: arm64: Use raw_smp_processor_id() in kvm_pmu_probe_armpmu()
Sebastian reports that commit 1c913a1c35 ("KVM: arm64: Iterate
arm_pmus list to probe for default PMU") introduced the following splat
with CONFIG_DEBUG_PREEMPT enabled:

[70506.110187] BUG: using smp_processor_id() in preemptible [00000000] code: qemu-system-aar/3078242
[70506.119077] caller is debug_smp_processor_id+0x20/0x30
[70506.124229] CPU: 129 PID: 3078242 Comm: qemu-system-aar Tainted: G        W          6.4.0-rc5 #25
[70506.133176] Hardware name: GIGABYTE R181-T92-00/MT91-FS4-00, BIOS F34 08/13/2020
[70506.140559] Call trace:
[70506.142993]  dump_backtrace+0xa4/0x130
[70506.146737]  show_stack+0x20/0x38
[70506.150040]  dump_stack_lvl+0x48/0x60
[70506.153704]  dump_stack+0x18/0x28
[70506.157007]  check_preemption_disabled+0xe4/0x108
[70506.161701]  debug_smp_processor_id+0x20/0x30
[70506.166046]  kvm_arm_pmu_v3_set_attr+0x460/0x628
[70506.170662]  kvm_arm_vcpu_arch_set_attr+0x88/0xd8
[70506.175363]  kvm_arch_vcpu_ioctl+0x258/0x4a8
[70506.179632]  kvm_vcpu_ioctl+0x32c/0x6b8
[70506.183465]  __arm64_sys_ioctl+0xb4/0x100
[70506.187467]  invoke_syscall+0x78/0x108
[70506.191205]  el0_svc_common.constprop.0+0x4c/0x100
[70506.195984]  do_el0_svc+0x34/0x50
[70506.199287]  el0_svc+0x34/0x108
[70506.202416]  el0t_64_sync_handler+0xf4/0x120
[70506.206674]  el0t_64_sync+0x194/0x198

Fix the issue by using the raw variant that bypasses the debug
assertion. While at it, stick all of the nuance and UAPI baggage into a
comment for posterity.

Fixes: 1c913a1c35 ("KVM: arm64: Iterate arm_pmus list to probe for default PMU")
Reported-by: Sebastian Ott <sebott@redhat.com>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230606184814.456743-1-oliver.upton@linux.dev
2023-06-07 16:48:34 +01:00
..
hyp KVM: arm64: PMU: Don't overwrite PMUSERENR with vcpu loaded 2023-06-04 17:19:36 +01:00
vgic KVM: arm64: Restore GICv2-on-GICv3 functionality 2023-06-07 16:38:25 +01:00
.gitignore
Kconfig kvm: Remove "select SRCU" 2023-04-05 13:47:42 +00:00
Makefile KVM: arm64: nv: Filter out unsupported features from ID regs 2023-02-11 10:13:30 +00:00
arch_timer.c Merge branch kvm-arm64/timer-vm-offsets into kvmarm-master/next 2023-04-21 09:36:40 +01:00
arm.c s390: 2023-05-01 12:06:20 -07:00
debug.c
emulate-nested.c KVM: arm64: nv: Support virtual EL2 exceptions 2023-02-11 09:16:11 +00:00
fpsimd.c KVM: arm64: Clarify host SME state management 2023-04-21 13:46:20 +01:00
guest.c KVM/arm64 updates for 6.4 2023-04-26 15:46:52 -04:00
handle_exit.c KVM: arm64: Let errors from SMCCC emulation to reach userspace 2023-04-05 12:07:42 +01:00
hypercalls.c s390: 2023-05-01 12:06:20 -07:00
inject_fault.c KVM: arm64: Fix repeated words in comments 2023-04-21 13:46:04 +01:00
mmio.c
mmu.c KVM: arm64: Check for kvm_vma_mte_allowed in the critical section 2023-03-16 23:42:56 +00:00
nested.c KVM: arm64: nv: Use reg_to_encoding() to get sysreg ID 2023-02-11 22:10:34 +00:00
pkvm.c KVM: arm64: Ensure CPU PMU probes before pKVM host de-privilege 2023-04-20 16:57:53 +01:00
pmu-emul.c KVM: arm64: Use raw_smp_processor_id() in kvm_pmu_probe_armpmu() 2023-06-07 16:48:34 +01:00
pmu.c KVM: arm64: PMU: Don't overwrite PMUSERENR with vcpu loaded 2023-06-04 17:19:36 +01:00
psci.c Merge branch kvm-arm64/smccc-filtering into kvmarm-master/next 2023-04-21 09:44:32 +01:00
pvtime.c
reset.c KVM: arm64: Avoid lock inversion when setting the VM register width 2023-03-29 14:08:31 +01:00
stacktrace.c
sys_regs.c KVM: arm64: Handle trap of tagged Set/Way CMOs 2023-05-24 13:45:18 +01:00
sys_regs.h KVM: arm64: nv: Allow a sysreg to be hidden from userspace only 2023-02-11 10:13:29 +00:00
trace.h
trace_arm.h KVM: arm64: nv: timers: Support hyp timer emulation 2023-03-30 19:01:10 +01:00
trace_handle_exit.h
trng.c
va_layout.c
vgic-sys-reg-v3.c
vmid.c KVM: arm64: Use the bitmap API to allocate bitmaps 2023-04-20 09:10:28 +01:00