[PATCH 2/7] KVM: arm64: Move OUTSIDE_GUEST_MODE publication past context being saved
Fuad Tabba
fuad.tabba at linux.dev
Thu Oct 15 05:57:13 PDT 2026
Hi Marc,
On Thu, 15 Oct 2026 11:05:34 +0100, Marc Zyngier <maz at kernel.org> wrote:
[...]
> However, code that uses OUTSIDE_GUEST_MODE as a synchronisation point
> relies on the vcpu state to have been written back to the in-memory
> structures. Clearly, this is not what is happening
nit: missing full stop.
[...]
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
[...]
> @@ -1390,6 +1389,12 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>
> kvm_arch_vcpu_ctxsync_fp(vcpu);
>
> + /*
> + * All the state has been synchronised, let advertise
> + * we're outside of the guest.
> + */
> + smp_store_release(&vcpu->mode, OUTSIDE_GUEST_MODE);
nit: could this say the vgic state rather than all the state? In pKVM,
a non-protected guest's context comes back later, in
handle_exit_pkvm_state() or on demand, and with VHE the EL1 sysregs
stay on the CPU until vcpu_put(). Also "let's advertise".
Cheers,
/fuad
More information about the linux-arm-kernel
mailing list