]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Resolve all pending PC updates before immediate exit
authorZenghui Yu <yuzenghui@huawei.com>
Wed, 26 May 2021 14:18:31 +0000 (22:18 +0800)
committerMarc Zyngier <maz@kernel.org>
Thu, 27 May 2021 09:33:06 +0000 (10:33 +0100)
commitf0f8122877094ebe143e102c8ebbeb9c8e31d7a6
treef403d7ce489e6959aeda0b5d7d63cc0bae179b07
parentfaaf2117c44c44da063178b0c5dab9af1acf58fd
KVM: arm64: Resolve all pending PC updates before immediate exit

Commit 26e0aabb38a6 ("KVM: arm64: Commit pending PC adjustemnts before
returning to userspace") fixed the PC updating issue by forcing an explicit
synchronisation of the exception state on vcpu exit to userspace.

However, we forgot to take into account the case where immediate_exit is
set by userspace and KVM_RUN will exit immediately. Fix it by resolving all
pending PC updates before returning to userspace.

Since __kvm_adjust_pc() relies on a loaded vcpu context, I moved the
immediate_exit checking right after vcpu_load(). We will get some overhead
if immediate_exit is true (which should hopefully be rare).

Fixes: 26e0aabb38a6 ("KVM: arm64: Commit pending PC adjustemnts before returning to userspace")
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210526141831.1662-1-yuzenghui@huawei.com
Cc: stable@vger.kernel.org # 5.11
arch/arm64/kvm/arm.c