diff options
author | Avi Kivity <avi@redhat.com> | 2010-12-27 05:08:45 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2011-03-17 12:08:24 -0400 |
commit | 8234b22e1c3287307c53655b16478cf8f5071555 (patch) | |
tree | 7dd7ae5f746efe4af845acba9a1cc26b8e4b9637 /arch/x86/kvm/mmu.c | |
parent | 054cfaacf88865bff1dd58d305443d5d6c068a08 (diff) |
KVM: MMU: Don't flush shadow when enabling dirty tracking
Instead, drop large mappings, which were the reason we dropped shadow.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index f02b8edc3d44..ccacf0b1b540 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -3538,14 +3538,18 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) | |||
3538 | if (!test_bit(slot, sp->slot_bitmap)) | 3538 | if (!test_bit(slot, sp->slot_bitmap)) |
3539 | continue; | 3539 | continue; |
3540 | 3540 | ||
3541 | if (sp->role.level != PT_PAGE_TABLE_LEVEL) | ||
3542 | continue; | ||
3543 | |||
3544 | pt = sp->spt; | 3541 | pt = sp->spt; |
3545 | for (i = 0; i < PT64_ENT_PER_PAGE; ++i) | 3542 | for (i = 0; i < PT64_ENT_PER_PAGE; ++i) { |
3543 | if (sp->role.level != PT_PAGE_TABLE_LEVEL | ||
3544 | && is_large_pte(pt[i])) { | ||
3545 | drop_spte(kvm, &pt[i], | ||
3546 | shadow_trap_nonpresent_pte); | ||
3547 | --kvm->stat.lpages; | ||
3548 | } | ||
3546 | /* avoid RMW */ | 3549 | /* avoid RMW */ |
3547 | if (is_writable_pte(pt[i])) | 3550 | if (is_writable_pte(pt[i])) |
3548 | update_spte(&pt[i], pt[i] & ~PT_WRITABLE_MASK); | 3551 | update_spte(&pt[i], pt[i] & ~PT_WRITABLE_MASK); |
3552 | } | ||
3549 | } | 3553 | } |
3550 | kvm_flush_remote_tlbs(kvm); | 3554 | kvm_flush_remote_tlbs(kvm); |
3551 | } | 3555 | } |