diff options
author | Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> | 2012-03-01 05:32:16 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-04-08 05:49:58 -0400 |
commit | 5dc99b2380d59b8aeafa98791f92b96400ed3187 (patch) | |
tree | eba3731e113e14df9bd2e1ece5a3493dd5e606c0 /arch/x86/kvm/x86.c | |
parent | a0ed46073c14f66dbf0707aaa7588b78da83d7c6 (diff) |
KVM: Avoid checking huge page mappings in get_dirty_log()
Dropped such mappings when we enabled dirty logging and we will never
create new ones until we stop the logging.
For this we introduce a new function which can be used to write protect
a range of PT level pages: although we do not need to care about a range
of pages at this point, the following patch will need this feature to
optimize the write protection of many pages.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 99b738028fc..813ebf1e55a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3095,13 +3095,11 @@ static void write_protect_slot(struct kvm *kvm, | |||
3095 | 3095 | ||
3096 | /* Not many dirty pages compared to # of shadow pages. */ | 3096 | /* Not many dirty pages compared to # of shadow pages. */ |
3097 | if (nr_dirty_pages < kvm->arch.n_used_mmu_pages) { | 3097 | if (nr_dirty_pages < kvm->arch.n_used_mmu_pages) { |
3098 | unsigned long gfn_offset; | 3098 | gfn_t offset; |
3099 | 3099 | ||
3100 | for_each_set_bit(gfn_offset, dirty_bitmap, memslot->npages) { | 3100 | for_each_set_bit(offset, dirty_bitmap, memslot->npages) |
3101 | unsigned long gfn = memslot->base_gfn + gfn_offset; | 3101 | kvm_mmu_write_protect_pt_masked(kvm, memslot, offset, 1); |
3102 | 3102 | ||
3103 | kvm_mmu_rmap_write_protect(kvm, gfn, memslot); | ||
3104 | } | ||
3105 | kvm_flush_remote_tlbs(kvm); | 3103 | kvm_flush_remote_tlbs(kvm); |
3106 | } else | 3104 | } else |
3107 | kvm_mmu_slot_remove_write_access(kvm, memslot->id); | 3105 | kvm_mmu_slot_remove_write_access(kvm, memslot->id); |