diff options
author | Suzuki K Poulose <Suzuki.Poulose@arm.com> | 2017-07-05 04:57:00 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2017-07-25 09:21:22 -0400 |
commit | 7e5a672289c9754d07e1c3b33649786d3d70f5e4 (patch) | |
tree | c2d1573adab0b1781395a20195d52f70d2c33e4c | |
parent | d9f89b4e9290e46cd9b273e9ad0bff0f93e86fae (diff) |
KVM: arm/arm64: Handle hva aging while destroying the vm
The mmu_notifier_release() callback of KVM triggers cleaning up
the stage2 page table on kvm-arm. However there could be other
notifier callbacks in parallel with the mmu_notifier_release(),
which could cause the call backs ending up in an empty stage2
page table. Make sure we check it for all the notifier callbacks.
Cc: stable@vger.kernel.org
Fixes: commit 293f29363 ("kvm-arm: Unmap shadow pagetables properly")
Reported-by: Alex Graf <agraf@suse.de>
Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | virt/kvm/arm/mmu.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c index 0e1fc75f3585..2ea21dac0b44 100644 --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c | |||
@@ -1718,12 +1718,16 @@ static int kvm_test_age_hva_handler(struct kvm *kvm, gpa_t gpa, u64 size, void * | |||
1718 | 1718 | ||
1719 | int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end) | 1719 | int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end) |
1720 | { | 1720 | { |
1721 | if (!kvm->arch.pgd) | ||
1722 | return 0; | ||
1721 | trace_kvm_age_hva(start, end); | 1723 | trace_kvm_age_hva(start, end); |
1722 | return handle_hva_to_gpa(kvm, start, end, kvm_age_hva_handler, NULL); | 1724 | return handle_hva_to_gpa(kvm, start, end, kvm_age_hva_handler, NULL); |
1723 | } | 1725 | } |
1724 | 1726 | ||
1725 | int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) | 1727 | int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) |
1726 | { | 1728 | { |
1729 | if (!kvm->arch.pgd) | ||
1730 | return 0; | ||
1727 | trace_kvm_test_age_hva(hva); | 1731 | trace_kvm_test_age_hva(hva); |
1728 | return handle_hva_to_gpa(kvm, hva, hva, kvm_test_age_hva_handler, NULL); | 1732 | return handle_hva_to_gpa(kvm, hva, hva, kvm_test_age_hva_handler, NULL); |
1729 | } | 1733 | } |