Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1342980
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children |
| Date | 2016-02-25 09:50 +0100 |
| Message-ID | <r5ZMu-1aJ-17@gated-at.bofh.it> (permalink) |
| References | <r5Hwe-543-5@gated-at.bofh.it> <r5Hwe-543-21@gated-at.bofh.it> <r5TH5-5ok-53@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 25/02/2016 03:15, Takuya Yoshikawa wrote:
> On 2016/02/24 22:17, Paolo Bonzini wrote:
>> Move the call to kvm_mmu_flush_or_zap outside the loop.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> arch/x86/kvm/mmu.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
>> index 725316df32ec..6d47b5c43246 100644
>> --- a/arch/x86/kvm/mmu.c
>> +++ b/arch/x86/kvm/mmu.c
>> @@ -2029,24 +2029,27 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
>> struct mmu_page_path parents;
>> struct kvm_mmu_pages pages;
>> LIST_HEAD(invalid_list);
>> + bool flush = false;
>>
>> while (mmu_unsync_walk(parent, &pages)) {
>> bool protected = false;
>> - bool flush = false;
>>
>> for_each_sp(pages, sp, parents, i)
>> protected |= rmap_write_protect(vcpu, sp->gfn);
>>
>> - if (protected)
>> + if (protected) {
>> kvm_flush_remote_tlbs(vcpu->kvm);
>> + flush = false;
>> + }
>>
>> for_each_sp(pages, sp, parents, i) {
>> flush |= kvm_sync_page(vcpu, sp, &invalid_list);
>> mmu_pages_clear_parents(&parents);
>> }
>> - kvm_mmu_flush_or_zap(vcpu, &invalid_list, false, flush);
>> cond_resched_lock(&vcpu->kvm->mmu_lock);
>
> This may release the mmu_lock before committing the zapping.
> Is it safe? If so, we may want to see the reason in the changelog.
It should be safe; the page is already marked as invalid and hence the
role will not match in kvm_mmu_get_page.
The idea is simply that committing the zap is expensive (for example it
requires a remote TLB flush) so you want to do it as rarely as possible.
I'll note this in the commit message.
Paolo
> Takuya
>
>> }
>> +
>> + kvm_mmu_flush_or_zap(vcpu, &invalid_list, false, flush);
>> }
>>
>> static void __clear_sp_write_flooding_count(struct kvm_mmu_page *sp)
>>
>
>
>
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children Paolo Bonzini <pbonzini@redhat.com> - 2016-02-24 14:20 +0100
Re: [PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp> - 2016-02-25 03:20 +0100
Re: [PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-02-25 08:40 +0100
Re: [PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children Paolo Bonzini <pbonzini@redhat.com> - 2016-02-25 09:50 +0100
Re: [PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-02-25 10:20 +0100
Re: [PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children Paolo Bonzini <pbonzini@redhat.com> - 2016-02-25 11:00 +0100
Re: [PATCH 09/12] KVM: MMU: coalesce zapping page after mmu_sync_children Paolo Bonzini <pbonzini@redhat.com> - 2016-02-25 09:50 +0100
csiph-web