[PATCH 2/2] KVM: arm64: Commit pending PC adjustemnts before returning to userspace
Fuad Tabba
tabba at google.com
Tue May 11 01:03:40 PDT 2021
Hi Marc,
> KVM: arm64: Commit pending PC adjustemnts before returning to userspace
s/adjustments/adjustments
On Mon, May 10, 2021 at 10:49 AM Marc Zyngier <maz at kernel.org> wrote:
>
> KVM currently updates PC (and the corresponding exception state)
> using a two phase approach: first by setting a set of flags,
> then by converting these flags into a state update when the vcpu
> is about to enter the guest.
>
> However, this creates a disconnect with userspace if the vcpu thread
> returns there with any exception/PC flag set. In this case, the exposed
> context is wrong, as userpsace doesn't have access to these flags
> (they aren't architectural). It also means that these flags are
> preserved across a reset, which isn't expected.
>
> To solve this problem, force an explicit synchronisation of the
> exception state on vcpu exit to userspace. As an optimisation
> for nVHE systems, only perform this when there is something pending.
I've tested this with a few nvhe and vhe tests that exercise both
__kvm_adjust_pc call paths (__kvm_vcpu_run and
kvm_arch_vcpu_ioctl_run), and the tests ran as expected. I'll do the
same for v2 when you send it out.
Cheers,
/fuad
More information about the linux-arm-kernel
mailing list