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 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
Marcelo Tosatti 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) > > > rcu_a

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

2012-03-13 Thread Takuya Yoshikawa
Marcelo Tosatti 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 > slot->dirty_bitmap value chan

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 w

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

2012-03-13 Thread Avi Kivity
On 03/13/2012 11:20 AM, Takuya Yoshikawa wrote: > Avi Kivity 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 > > g

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

2012-03-13 Thread Takuya Yoshikawa
Avi Kivity 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 involved vari

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 ca

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

2012-03-01 Thread Takuya Yoshikawa
Takuya Yoshikawa wrote: > Takuya Yoshikawa 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 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 */ > + mask &= mask - 1;