Commit f47e5bb
KVM: x86/mmu: Zap only TDP MMU leafs in zap range and mmu_notifier unmap
Re-introduce zapping only leaf SPTEs in kvm_zap_gfn_range() and
kvm_tdp_mmu_unmap_gfn_range(), this time without losing a pending TLB
flush when processing multiple roots (including nested TDP shadow roots).
Dropping the TLB flush resulted in random crashes when running Hyper-V
Server 2019 in a guest with KSM enabled in the host (or any source of
mmu_notifier invalidations, KSM is just the easiest to force).
This effectively revert commits 873dd12
and fcb93eb, and thus restores commit
cf3e264, plus this delta on top:
bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start, gfn_t end,
struct kvm_mmu_page *root;
for_each_tdp_mmu_root_yield_safe(kvm, root, as_id)
- flush = tdp_mmu_zap_leafs(kvm, root, start, end, can_yield, false);
+ flush = tdp_mmu_zap_leafs(kvm, root, start, end, can_yield, flush);
return flush;
}
Cc: Ben Gardon <bgardon@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220325230348.2587437-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent a80ced6 commit f47e5bb
3 files changed
Lines changed: 19 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5849 | 5849 | | |
5850 | 5850 | | |
5851 | 5851 | | |
5852 | | - | |
5853 | | - | |
| 5852 | + | |
| 5853 | + | |
5854 | 5854 | | |
5855 | 5855 | | |
5856 | 5856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
| 912 | + | |
| 913 | + | |
916 | 914 | | |
917 | 915 | | |
918 | 916 | | |
919 | 917 | | |
920 | 918 | | |
921 | 919 | | |
922 | 920 | | |
923 | | - | |
924 | | - | |
| 921 | + | |
| 922 | + | |
925 | 923 | | |
926 | | - | |
927 | 924 | | |
928 | 925 | | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | 926 | | |
936 | 927 | | |
937 | 928 | | |
938 | 929 | | |
939 | 930 | | |
940 | 931 | | |
941 | | - | |
| 932 | + | |
942 | 933 | | |
943 | 934 | | |
944 | 935 | | |
945 | 936 | | |
946 | 937 | | |
947 | 938 | | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
| 939 | + | |
959 | 940 | | |
960 | 941 | | |
961 | 942 | | |
962 | 943 | | |
963 | 944 | | |
964 | 945 | | |
965 | 946 | | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | 947 | | |
975 | 948 | | |
976 | | - | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
977 | 954 | | |
978 | 955 | | |
979 | 956 | | |
| |||
982 | 959 | | |
983 | 960 | | |
984 | 961 | | |
985 | | - | |
986 | | - | |
| 962 | + | |
| 963 | + | |
987 | 964 | | |
988 | 965 | | |
989 | 966 | | |
990 | 967 | | |
991 | | - | |
| 968 | + | |
992 | 969 | | |
993 | 970 | | |
994 | 971 | | |
| |||
1236 | 1213 | | |
1237 | 1214 | | |
1238 | 1215 | | |
1239 | | - | |
1240 | | - | |
| 1216 | + | |
| 1217 | + | |
1241 | 1218 | | |
1242 | 1219 | | |
1243 | 1220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 20 | | |
27 | 21 | | |
28 | 22 | | |
| |||
0 commit comments