Re: [PATCH v4 09/18] KVM: arm64: Introduce __pkvm_vcpu_{load,put}()

From: Oliver Upton
Date: Mon Feb 03 2025 - 18:19:33 EST


On Mon, Feb 03, 2025 at 07:50:44PM +0000, Mark Brown wrote:
> On Wed, Dec 18, 2024 at 07:40:50PM +0000, Quentin Perret wrote:
> > From: Marc Zyngier <maz@xxxxxxxxxx>
> >
> > Rather than look-up the hyp vCPU on every run hypercall at EL2,
> > introduce a per-CPU 'loaded_hyp_vcpu' tracking variable which is updated
> > by a pair of load/put hypercalls called directly from
> > kvm_arch_vcpu_{load,put}() when pKVM is enabled.
>
> Current mainline crashes when running the arch_timer_edge_cases selftest
> in pKVM mode on a LibreTech Le Potato board, with a bisection pointing
> at this change. The system dies like this:
>
> # selftests: kvm: arch_timer_edge_cases
> [ 130.599140] kvm [4518]: nVHE hyp panic at: [<ffff800081102b58>] __kvm_nvhe___vgic_v3_restore_vmcr_aprs+0x8/0x84!
> [ 130.603685] kvm [4518]: Cannot dump pKVM nVHE stacktrace: !CONFIG_PROTECTED_NVHE_STACKTRACE
> [ 130.611962] kvm [4518]: Hyp Offset: 0xfffeca95ed000000
> [ 130.617053] Kernel panic - not syncing: HYP panic:

Thanks, fix posted here [*], although as a consequence this machine will
stop running KVM in protected mode (which was never meant to work in the
first place).

[*]: https://lore.kernel.org/kvmarm/20250203231543.233511-1-oliver.upton@xxxxxxxxx/

--
Thanks,
Oliver