Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-14 Thread Marcelo Tosatti
On Wed, Mar 14, 2012 at 02:34:32PM +0900, Takuya Yoshikawa wrote: Marcelo Tosatti mtosa...@redhat.com wrote: guest fault enable dirty logging tdp_page_fault (all _page_fault functions) kvm_set_memory_region level = mapping_level(vcpu, gfn)

Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-13 Thread Takuya Yoshikawa
Avi Kivity a...@redhat.com wrote: It occurs to me that we should write-protect huge page tables, since it makes write protection much faster (we make up for this later at write fault time, but that might not occur, and even if it does we reduce guest jitter). In fact I once proposed a more

Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-13 Thread Marcelo Tosatti
On Thu, Mar 01, 2012 at 07:32:16PM +0900, Takuya Yoshikawa wrote: 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

Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-13 Thread Takuya Yoshikawa
Marcelo Tosatti mtosa...@redhat.com wrote: This is a race with hugetlbfs which is not an issue ATM (it is hidden by the removal of huge sptes in get_dirty). Thank you! I did not notice this possibility at all. ... It can be fixed with a preceding patch that checks whether

Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-13 Thread Takuya Yoshikawa
Marcelo Tosatti mtosa...@redhat.com wrote: guest fault enable dirty logging tdp_page_fault (all _page_fault functions) kvm_set_memory_region level = mapping_level(vcpu, gfn) (finds level == 2 or 3)

Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-12 Thread Avi Kivity
On 03/01/2012 12:32 PM, Takuya Yoshikawa wrote: 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

[PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-01 Thread Takuya Yoshikawa
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

Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-01 Thread Takuya Yoshikawa
Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp wrote: + while (mask) { + rmapp = slot-rmap[gfn_offset + __ffs(mask)]; + __rmap_write_protect(kvm, rmapp, PT_PAGE_TABLE_LEVEL); - return write_protected; + /* clear the first set bit */ +

Re: [PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-03-01 Thread Takuya Yoshikawa
Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp wrote: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp wrote: + while (mask) { + rmapp = slot-rmap[gfn_offset + __ffs(mask)]; + __rmap_write_protect(kvm, rmapp, PT_PAGE_TABLE_LEVEL); - return write_protected;

[PATCH 2/4] KVM: Avoid checking huge page mappings in get_dirty_log()

2012-02-23 Thread Takuya Yoshikawa
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