qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Guangrong <guangrong.xiao@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	"Zhoujian (jay)" <jianjay.zhou@huawei.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	yanghongyang <yanghongyang@huawei.com>
Cc: Wanpeng Li <kernellwp@gmail.com>,
	Zhanghailiang <zhang.zhanghailiang@huawei.com>,
	"quintela@redhat.com" <quintela@redhat.com>,
	"wangxin (U)" <wangxinxin.wang@huawei.com>,
	Xiao Guangrong <xiaoguangrong@tencent.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	Huangzhichao <huangzhichao@huawei.com>,
	"Herongguang (Stephen)" <herongguang.he@huawei.com>
Subject: Re: [Qemu-devel] About QEMU BQL and dirty log switch in Migration
Date: Fri, 12 May 2017 16:09:45 +0800	[thread overview]
Message-ID: <a35ce92b-d10b-646b-34d0-d7f075fc46d4@gmail.com> (raw)
In-Reply-To: <85e3a0dd-20c8-8ff2-37ce-bfdf543e7787@redhat.com>



On 05/11/2017 08:24 PM, Paolo Bonzini wrote:
> 
> 
> On 11/05/2017 14:07, Zhoujian (jay) wrote:
>> -        * Scan sptes if dirty logging has been stopped, dropping those
>> -        * which can be collapsed into a single large-page spte.  Later
>> -        * page faults will create the large-page sptes.
>> +        * Reset each vcpu's mmu, then page faults will create the large-page
>> +        * sptes later.
>>           */
>>          if ((change != KVM_MR_DELETE) &&
>>                  (old->flags & KVM_MEM_LOG_DIRTY_PAGES) &&
>> -               !(new->flags & KVM_MEM_LOG_DIRTY_PAGES))
>> -               kvm_mmu_zap_collapsible_sptes(kvm, new);
>> +               !(new->flags & KVM_MEM_LOG_DIRTY_PAGES)) {
>> +               kvm_for_each_vcpu(i, vcpu, kvm)
>> +                       kvm_mmu_reset_context(vcpu);
> 
> This should be "kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD);" but
> I am not sure it is enough.  I think that if you do not zap the SPTEs,
> the page faults will use 4K SPTEs, not large ones (though I'd have to
> check better; CCing Xiao and Wanpeng).

Yes, Paolo is right. kvm_mmu_reset_context() just reloads vCPU's
root page table, 4k mappings are still kept.

There are two issues reported:
- one is kvm_mmu_slot_apply_flags(), when enable dirty log tracking.

   Its root cause is kvm_mmu_slot_remove_write_access() takes too much
   time.

   We can make the code adaptive to use the new fast-write-protect faculty
   introduced by my patchset, i.e, if the number of pages contained in this
   memslot is more than > TOTAL * FAST_WRITE_PROTECT_PAGE_PERCENTAGE, then
   we use fast-write-protect instead.

- another one is kvm_mmu_zap_collapsible_sptes() when disable dirty
   log tracking.

   collapsible_sptes zaps 4k mappings to make memory-read happy, it is not
   required by the semanteme of KVM_SET_USER_MEMORY_REGION and it is not
   urgent for vCPU's running, it could be done in a separate thread and use
   lock-break technology.

Thanks!

  parent reply	other threads:[~2017-05-12  8:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 11:46 [Qemu-devel] About QEMU BQL and dirty log switch in Migration Yang Hongyang
2017-04-24 12:06 ` Juan Quintela
2017-04-24 12:13   ` Yang Hongyang
2017-04-24 16:42     ` Dr. David Alan Gilbert
2017-04-26 15:46       ` Paolo Bonzini
2017-04-27  2:46         ` Yang Hongyang
2017-05-11 12:07       ` Zhoujian (jay)
2017-05-11 12:24         ` Paolo Bonzini
2017-05-11 13:43           ` Wanpeng Li
2017-05-11 13:49             ` Wanpeng Li
2017-05-11 14:18               ` Zhoujian (jay)
2017-05-12  6:34                 ` Wanpeng Li
2017-05-17  2:20             ` Zhoujian (jay)
2017-05-17  5:47               ` Wanpeng Li
2017-05-17  7:35                 ` Jay Zhou
2017-05-17  7:43               ` Paolo Bonzini
2017-05-17  8:38                 ` Wanpeng Li
2017-05-19  8:09                   ` Jay Zhou
2017-05-19  8:32                     ` Xiao Guangrong
2017-05-19  9:27                       ` Jay Zhou
2018-12-11  3:43                     ` Wanpeng Li
2017-05-12  8:09           ` Xiao Guangrong [this message]
2017-05-12  8:42             ` Hailiang Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a35ce92b-d10b-646b-34d0-d7f075fc46d4@gmail.com \
    --to=guangrong.xiao@gmail.com \
    --cc=arei.gonglei@huawei.com \
    --cc=dgilbert@redhat.com \
    --cc=herongguang.he@huawei.com \
    --cc=huangzhichao@huawei.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=kernellwp@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wangxinxin.wang@huawei.com \
    --cc=xiaoguangrong@tencent.com \
    --cc=yanghongyang@huawei.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).