All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: "Zhanghaoyu (A)" <haoyu.zhang@huawei.com>
Cc: "Marcelo Tosatti" <mtosatti@redhat.com>,
	"Bruce Rogers" <brogers@suse.com>,
	"paolo.bonzini@gmail.com" <paolo.bonzini@gmail.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>, KVM <kvm@vger.kernel.org>,
	"xiaoguangrong@linux.vnet.ibm.com"
	<xiaoguangrong@linux.vnet.ibm.com>,
	"Andreas Färber" <afaerber@suse.de>,
	Hanweidong <hanweidong@huawei.com>,
	Luonengjun <luonengjun@huawei.com>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	Zanghongyong <zanghongyong@huawei.com>,
	Xiejunyong <xiejunyong@huawei.com>, Xiahai <xiahai@huawei.com>,
	"Yi Li" <YiLi@novell.com>, "Xin Rong Fu" <XRFu@novell.com>
Subject: Re: [Qemu-devel] vm performance degradation after kvm live migration or save-restore with EPT enabled
Date: Mon, 5 Aug 2013 11:43:09 +0300	[thread overview]
Message-ID: <20130805084309.GE2258@redhat.com> (raw)
In-Reply-To: <D3E216785288A145B7BC975F83A2ED103FEF8B6F@szxeml556-mbx.china.huawei.com>

On Mon, Aug 05, 2013 at 08:35:09AM +0000, Zhanghaoyu (A) wrote:
> >> >> >> hi all,
> >> >> >> 
> >> >> >> I met similar problem to these, while performing live migration or 
> >> >> >> save-restore test on the kvm platform (qemu:1.4.0, host:suse11sp2, 
> >> >> >> guest:suse11sp2), running tele-communication software suite in 
> >> >> >> guest, 
> >> >> >> https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg00098.html
> >> >> >> http://comments.gmane.org/gmane.comp.emulators.kvm.devel/102506
> >> >> >> http://thread.gmane.org/gmane.comp.emulators.kvm.devel/100592
> >> >> >> https://bugzilla.kernel.org/show_bug.cgi?id=58771
> >> >> >> 
> >> >> >> After live migration or virsh restore [savefile], one process's CPU 
> >> >> >> utilization went up by about 30%, resulted in throughput 
> >> >> >> degradation of this process.
> >> >> >> 
> >> >> >> If EPT disabled, this problem gone.
> >> >> >> 
> >> >> >> I suspect that kvm hypervisor has business with this problem.
> >> >> >> Based on above suspect, I want to find the two adjacent versions of 
> >> >> >> kvm-kmod which triggers this problem or not (e.g. 2.6.39, 3.0-rc1), 
> >> >> >> and analyze the differences between this two versions, or apply the 
> >> >> >> patches between this two versions by bisection method, finally find the key patches.
> >> >> >> 
> >> >> >> Any better ideas?
> >> >> >> 
> >> >> >> Thanks,
> >> >> >> Zhang Haoyu
> >> >> >
> >> >> >I've attempted to duplicate this on a number of machines that are as similar to yours as I am able to get my hands on, and so far have not been able to see any performance degradation. And from what I've read in the above links, huge pages do not seem to be part of the problem.
> >> >> >
> >> >> >So, if you are in a position to bisect the kernel changes, that would probably be the best avenue to pursue in my opinion.
> >> >> >
> >> >> >Bruce
> >> >> 
> >> >> I found the first bad 
> >> >> commit([612819c3c6e67bac8fceaa7cc402f13b1b63f7e4] KVM: propagate fault r/w information to gup(), allow read-only memory) which triggers this problem by git bisecting the kvm kernel (download from https://git.kernel.org/pub/scm/virt/kvm/kvm.git) changes.
> >> >> 
> >> >> And,
> >> >> git log 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4 -n 1 -p > 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.log
> >> >> git diff 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4~1..612819c3c6e67bac8fceaa7cc4
> >> >> 02f13b1b63f7e4 > 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.diff
> >> >> 
> >> >> Then, I diffed 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.log and 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.diff,
> >> >> came to a conclusion that all of the differences between 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4~1 and 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4
> >> >> are contributed by no other than 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4, so this commit is the peace-breaker which directly or indirectly causes the degradation.
> >> >> 
> >> >> Does the map_writable flag passed to mmu_set_spte() function have effect on PTE's PAT flag or increase the VMEXITs induced by that guest tried to write read-only memory?
> >> >> 
> >> >> Thanks,
> >> >> Zhang Haoyu
> >> >> 
> >> >
> >> >There should be no read-only memory maps backing guest RAM.
> >> >
> >> >Can you confirm map_writable = false is being passed to __direct_map? (this should not happen, for guest RAM).
> >> >And if it is false, please capture the associated GFN.
> >> >
> >> I added below check and printk at the start of __direct_map() at the fist bad commit version,
> >> --- kvm-612819c3c6e67bac8fceaa7cc402f13b1b63f7e4/arch/x86/kvm/mmu.c     2013-07-26 18:44:05.000000000 +0800
> >> +++ kvm-612819/arch/x86/kvm/mmu.c       2013-07-31 00:05:48.000000000 +0800
> >> @@ -2223,6 +2223,9 @@ static int __direct_map(struct kvm_vcpu
> >>         int pt_write = 0;
> >>         gfn_t pseudo_gfn;
> >> 
> >> +        if (!map_writable)
> >> +                printk(KERN_ERR "%s: %s: gfn = %llu \n", __FILE__, __func__, gfn);
> >> +
> >>         for_each_shadow_entry(vcpu, (u64)gfn << PAGE_SHIFT, iterator) {
> >>                 if (iterator.level == level) {
> >>                         unsigned pte_access = ACC_ALL;
> >> 
> >> I virsh-save the VM, and then virsh-restore it, so many GFNs were printed, you can absolutely describe it as flooding.
> >> 
> >The flooding you see happens during migrate to file stage because of dirty
> >page tracking. If you clear dmesg after virsh-save you should not see any
> >flooding after virsh-restore. I just checked with latest tree, I do not.
> 
> I made a verification again.
> I virsh-save the VM, during the saving stage, I run 'dmesg', no GFN printed, maybe the switching from running stage to pause stage takes so short time, 
> no guest-write happens during this switching period.
> After the completion of saving operation, I run 'demsg -c' to clear the buffer all the same, then I virsh-restore the VM, so many GFNs are printed by running 'dmesg',
> and I also run 'tail -f /var/log/messages' during the restoring stage, so many GFNs are flooded dynamically too.
> I'm sure that the flooding happens during the virsh-restore stage, not the migration stage.
> 
Interesting, is this with upstream kernel? For me the situation is
exactly the opposite. What is your command line?
 
--
			Gleb.

WARNING: multiple messages have this Message-ID (diff)
From: Gleb Natapov <gleb@redhat.com>
To: "Zhanghaoyu (A)" <haoyu.zhang@huawei.com>
Cc: Xiejunyong <xiejunyong@huawei.com>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	KVM <kvm@vger.kernel.org>, "Michael S. Tsirkin" <mst@redhat.com>,
	Luonengjun <luonengjun@huawei.com>, Xiahai <xiahai@huawei.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"paolo.bonzini@gmail.com" <paolo.bonzini@gmail.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Bruce Rogers" <brogers@suse.com>,
	Zanghongyong <zanghongyong@huawei.com>,
	"Xin Rong Fu" <XRFu@novell.com>, "Yi Li" <YiLi@novell.com>,
	"xiaoguangrong@linux.vnet.ibm.com"
	<xiaoguangrong@linux.vnet.ibm.com>,
	Hanweidong <hanweidong@huawei.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] vm performance degradation after kvm live migration or save-restore with EPT enabled
Date: Mon, 5 Aug 2013 11:43:09 +0300	[thread overview]
Message-ID: <20130805084309.GE2258@redhat.com> (raw)
In-Reply-To: <D3E216785288A145B7BC975F83A2ED103FEF8B6F@szxeml556-mbx.china.huawei.com>

On Mon, Aug 05, 2013 at 08:35:09AM +0000, Zhanghaoyu (A) wrote:
> >> >> >> hi all,
> >> >> >> 
> >> >> >> I met similar problem to these, while performing live migration or 
> >> >> >> save-restore test on the kvm platform (qemu:1.4.0, host:suse11sp2, 
> >> >> >> guest:suse11sp2), running tele-communication software suite in 
> >> >> >> guest, 
> >> >> >> https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg00098.html
> >> >> >> http://comments.gmane.org/gmane.comp.emulators.kvm.devel/102506
> >> >> >> http://thread.gmane.org/gmane.comp.emulators.kvm.devel/100592
> >> >> >> https://bugzilla.kernel.org/show_bug.cgi?id=58771
> >> >> >> 
> >> >> >> After live migration or virsh restore [savefile], one process's CPU 
> >> >> >> utilization went up by about 30%, resulted in throughput 
> >> >> >> degradation of this process.
> >> >> >> 
> >> >> >> If EPT disabled, this problem gone.
> >> >> >> 
> >> >> >> I suspect that kvm hypervisor has business with this problem.
> >> >> >> Based on above suspect, I want to find the two adjacent versions of 
> >> >> >> kvm-kmod which triggers this problem or not (e.g. 2.6.39, 3.0-rc1), 
> >> >> >> and analyze the differences between this two versions, or apply the 
> >> >> >> patches between this two versions by bisection method, finally find the key patches.
> >> >> >> 
> >> >> >> Any better ideas?
> >> >> >> 
> >> >> >> Thanks,
> >> >> >> Zhang Haoyu
> >> >> >
> >> >> >I've attempted to duplicate this on a number of machines that are as similar to yours as I am able to get my hands on, and so far have not been able to see any performance degradation. And from what I've read in the above links, huge pages do not seem to be part of the problem.
> >> >> >
> >> >> >So, if you are in a position to bisect the kernel changes, that would probably be the best avenue to pursue in my opinion.
> >> >> >
> >> >> >Bruce
> >> >> 
> >> >> I found the first bad 
> >> >> commit([612819c3c6e67bac8fceaa7cc402f13b1b63f7e4] KVM: propagate fault r/w information to gup(), allow read-only memory) which triggers this problem by git bisecting the kvm kernel (download from https://git.kernel.org/pub/scm/virt/kvm/kvm.git) changes.
> >> >> 
> >> >> And,
> >> >> git log 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4 -n 1 -p > 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.log
> >> >> git diff 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4~1..612819c3c6e67bac8fceaa7cc4
> >> >> 02f13b1b63f7e4 > 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.diff
> >> >> 
> >> >> Then, I diffed 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.log and 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4.diff,
> >> >> came to a conclusion that all of the differences between 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4~1 and 
> >> >> 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4
> >> >> are contributed by no other than 612819c3c6e67bac8fceaa7cc402f13b1b63f7e4, so this commit is the peace-breaker which directly or indirectly causes the degradation.
> >> >> 
> >> >> Does the map_writable flag passed to mmu_set_spte() function have effect on PTE's PAT flag or increase the VMEXITs induced by that guest tried to write read-only memory?
> >> >> 
> >> >> Thanks,
> >> >> Zhang Haoyu
> >> >> 
> >> >
> >> >There should be no read-only memory maps backing guest RAM.
> >> >
> >> >Can you confirm map_writable = false is being passed to __direct_map? (this should not happen, for guest RAM).
> >> >And if it is false, please capture the associated GFN.
> >> >
> >> I added below check and printk at the start of __direct_map() at the fist bad commit version,
> >> --- kvm-612819c3c6e67bac8fceaa7cc402f13b1b63f7e4/arch/x86/kvm/mmu.c     2013-07-26 18:44:05.000000000 +0800
> >> +++ kvm-612819/arch/x86/kvm/mmu.c       2013-07-31 00:05:48.000000000 +0800
> >> @@ -2223,6 +2223,9 @@ static int __direct_map(struct kvm_vcpu
> >>         int pt_write = 0;
> >>         gfn_t pseudo_gfn;
> >> 
> >> +        if (!map_writable)
> >> +                printk(KERN_ERR "%s: %s: gfn = %llu \n", __FILE__, __func__, gfn);
> >> +
> >>         for_each_shadow_entry(vcpu, (u64)gfn << PAGE_SHIFT, iterator) {
> >>                 if (iterator.level == level) {
> >>                         unsigned pte_access = ACC_ALL;
> >> 
> >> I virsh-save the VM, and then virsh-restore it, so many GFNs were printed, you can absolutely describe it as flooding.
> >> 
> >The flooding you see happens during migrate to file stage because of dirty
> >page tracking. If you clear dmesg after virsh-save you should not see any
> >flooding after virsh-restore. I just checked with latest tree, I do not.
> 
> I made a verification again.
> I virsh-save the VM, during the saving stage, I run 'dmesg', no GFN printed, maybe the switching from running stage to pause stage takes so short time, 
> no guest-write happens during this switching period.
> After the completion of saving operation, I run 'demsg -c' to clear the buffer all the same, then I virsh-restore the VM, so many GFNs are printed by running 'dmesg',
> and I also run 'tail -f /var/log/messages' during the restoring stage, so many GFNs are flooded dynamically too.
> I'm sure that the flooding happens during the virsh-restore stage, not the migration stage.
> 
Interesting, is this with upstream kernel? For me the situation is
exactly the opposite. What is your command line?
 
--
			Gleb.

  reply	other threads:[~2013-08-05  8:43 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11  9:36 vm performance degradation after kvm live migration or save-restore with ETP enabled Zhanghaoyu (A)
2013-07-11  9:36 ` [Qemu-devel] " Zhanghaoyu (A)
2013-07-11 10:28 ` Michael S. Tsirkin
2013-07-11 10:28   ` [Qemu-devel] " Michael S. Tsirkin
2013-07-11 10:39 ` Gleb Natapov
2013-07-11 10:39   ` [Qemu-devel] " Gleb Natapov
2013-07-11 10:39 ` Xiao Guangrong
2013-07-11 10:39   ` [Qemu-devel] " Xiao Guangrong
2013-07-11 14:00   ` Zhang Haoyu
2013-07-11 14:00     ` [Qemu-devel] " Zhang Haoyu
2013-07-11 10:51 ` Andreas Färber
2013-07-11 10:51   ` Andreas Färber
2013-07-12  3:21   ` Zhanghaoyu (A)
2013-07-12  3:21     ` Zhanghaoyu (A)
2013-07-11 18:20 ` Bruce Rogers
2013-07-11 18:20   ` [Qemu-devel] " Bruce Rogers
2013-07-27  7:47   ` Zhanghaoyu (A)
2013-07-27  7:47     ` [Qemu-devel] " Zhanghaoyu (A)
2013-07-29 22:14     ` Andrea Arcangeli
2013-07-29 22:14       ` Andrea Arcangeli
2013-07-29 23:47     ` Marcelo Tosatti
2013-07-29 23:47       ` Marcelo Tosatti
2013-07-30  9:04       ` Zhanghaoyu (A)
2013-07-30  9:04         ` Zhanghaoyu (A)
2013-08-01  6:16         ` Gleb Natapov
2013-08-01  6:16           ` Gleb Natapov
2013-08-05  8:35           ` [Qemu-devel] vm performance degradation after kvm live migration or save-restore with EPT enabled Zhanghaoyu (A)
2013-08-05  8:35             ` Zhanghaoyu (A)
2013-08-05  8:43             ` Gleb Natapov [this message]
2013-08-05  8:43               ` Gleb Natapov
2013-08-05  9:09               ` Zhanghaoyu (A)
2013-08-05  9:09                 ` Zhanghaoyu (A)
2013-08-05  9:15                 ` Andreas Färber
2013-08-05  9:15                   ` Andreas Färber
2013-08-05  9:22                   ` Zhanghaoyu (A)
2013-08-05  9:22                     ` Zhanghaoyu (A)
2013-08-05  9:37                 ` Gleb Natapov
2013-08-05  9:37                   ` Gleb Natapov
2013-08-06 10:47                   ` Zhanghaoyu (A)
2013-08-06 10:47                     ` Zhanghaoyu (A)
2013-08-07  1:34                     ` Zhanghaoyu (A)
2013-08-07  1:34                       ` Zhanghaoyu (A)
2013-08-07  5:52                       ` Gleb Natapov
2013-08-07  5:52                         ` Gleb Natapov
2013-08-14  9:05                         ` Zhanghaoyu (A)
2013-08-14  9:05                           ` [Qemu-devel] " Zhanghaoyu (A)
2013-08-20 13:33                         ` Zhanghaoyu (A)
2013-08-20 13:33                           ` [Qemu-devel] " Zhanghaoyu (A)
2013-08-31  7:45                         ` Zhanghaoyu (A)
2013-08-31  7:45                           ` [Qemu-devel] " Zhanghaoyu (A)
2013-08-05 18:27             ` Xiao Guangrong
2013-08-05 18:27               ` [Qemu-devel] " Xiao Guangrong
2013-08-08 11:31 Zhanghaoyu (A)
2013-08-08 12:29 ` Paolo Bonzini

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=20130805084309.GE2258@redhat.com \
    --to=gleb@redhat.com \
    --cc=XRFu@novell.com \
    --cc=YiLi@novell.com \
    --cc=afaerber@suse.de \
    --cc=brogers@suse.com \
    --cc=hanweidong@huawei.com \
    --cc=haoyu.zhang@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paolo.bonzini@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weidong.huang@huawei.com \
    --cc=xiahai@huawei.com \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    --cc=xiejunyong@huawei.com \
    --cc=zanghongyong@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.