Hi Paolo, 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. I find the mechanism here is set all pages read-only to track all the dirty pages. But EPT provides such a dirty bit in EPT paging structures. Why don't we use this? Arthur > >> 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. > > 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