On Tue, Oct 29, 2013 at 8:55 PM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > Il 29/10/2013 06:39, Arthur Chunqi Li ha scritto: >> What is the dirty page tracking code path? I find a obsoleted flag >> "dirty_page_log_all" in the very previous codes, but I cannot get the >> most recent version of tracking dirty pages. > > Basically everything that accesses the dirty_bitmap field of struct > kvm_memory_slot is involved. It all starts when the > KVM_SET_USER_MEMORY_REGION ioctl is called with the > KVM_MEM_LOG_DIRTY_PAGES flag set. > >> Besides, I noticed that memory management in KVM uses the mechanism >> with "struct kvm_memory_slot". How is kvm_memory_slot used with the >> cooperation of Linux memory management? > > kvm_memory_slot just maps a host userspace address range to a guest > physical address range. Cooperation with Linux memory management is > done with the Linux MMU notifiers. MMU notifiers let KVM know that a > page has been swapped out, and KVM reacts by invalidating the shadow > page tables for the corresponding guest physical address. So for each VM, qemu need to register its memory region and KVM stores this region of GPA to HVA mapping in kvm_memory_slot, and at the first page fault KVM uses EPT to map GPA to HPA. Am I right? In this way, how is ballooning mechanism implemented in KVM memory management module? Thanks, Arthur > > Paolo -- Arthur Chunqi Li Department of Computer Science School of EECS Peking University Beijing, China -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html