* Re: [Qemu-devel] [PATCH] KVM: MMU: lazily drop large spte [not found] ` <20121112231032.GB5798@amt.cnet> @ 2012-11-13 15:33 ` Takuya Yoshikawa 2012-11-14 14:44 ` Marcelo Tosatti 0 siblings, 1 reply; 3+ messages in thread From: Takuya Yoshikawa @ 2012-11-13 15:33 UTC (permalink / raw) To: Marcelo Tosatti Cc: kvm, quintela, qemu-devel, linux-kernel, owasserm, avi, pbonzini, xiaoguangrong, chegu_vinod, yamahata Ccing live migration developers who should be interested in this work, On Mon, 12 Nov 2012 21:10:32 -0200 Marcelo Tosatti <mtosatti@redhat.com> wrote: > On Mon, Nov 05, 2012 at 05:59:26PM +0800, Xiao Guangrong wrote: > > Do not drop large spte until it can be insteaded by small pages so that > > the guest can happliy read memory through it > > > > The idea is from Avi: > > | As I mentioned before, write-protecting a large spte is a good idea, > > | since it moves some work from protect-time to fault-time, so it reduces > > | jitter. This removes the need for the return value. > > > > Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> > > --- > > arch/x86/kvm/mmu.c | 34 +++++++++------------------------- > > 1 files changed, 9 insertions(+), 25 deletions(-) > > Its likely that other 4k pages are mapped read-write in the 2mb range > covered by a read-only 2mb map. Therefore its not entirely useful to > map read-only. > > Can you measure an improvement with this change? What we discussed at KVM Forum last week was about the jitter we could measure right after starting live migration: both Isaku and Chegu reported such jitter. So if this patch reduces such jitter for some real workloads, by lazily dropping largepage mappings and saving read faults until that point, that would be very nice! But sadly, what they measured included interactions with the outside of the guest, and the main cause was due to the big QEMU lock problem, they guessed. The order is so different that an improvement by a kernel side effort may not be seen easily. FWIW: I am now changing the initial write protection by kvm_mmu_slot_remove_write_access() to rmap based as I proposed at KVM Forum. ftrace said that 1ms was improved to 250-350us by the change for 10GB guest. My code still drops largepage mappings, so the initial write protection time itself may not be a such big issue here, I think. Again, if we can eliminate read faults to such an extent that guests can see measurable improvement, that should be very nice! Any thoughts? Thanks, Takuya ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] KVM: MMU: lazily drop large spte 2012-11-13 15:33 ` [Qemu-devel] [PATCH] KVM: MMU: lazily drop large spte Takuya Yoshikawa @ 2012-11-14 14:44 ` Marcelo Tosatti 2012-11-14 23:33 ` Xiao Guangrong 0 siblings, 1 reply; 3+ messages in thread From: Marcelo Tosatti @ 2012-11-14 14:44 UTC (permalink / raw) To: Takuya Yoshikawa Cc: kvm, quintela, qemu-devel, linux-kernel, owasserm, avi, pbonzini, xiaoguangrong, chegu_vinod, yamahata On Wed, Nov 14, 2012 at 12:33:50AM +0900, Takuya Yoshikawa wrote: > Ccing live migration developers who should be interested in this work, > > On Mon, 12 Nov 2012 21:10:32 -0200 > Marcelo Tosatti <mtosatti@redhat.com> wrote: > > > On Mon, Nov 05, 2012 at 05:59:26PM +0800, Xiao Guangrong wrote: > > > Do not drop large spte until it can be insteaded by small pages so that > > > the guest can happliy read memory through it > > > > > > The idea is from Avi: > > > | As I mentioned before, write-protecting a large spte is a good idea, > > > | since it moves some work from protect-time to fault-time, so it reduces > > > | jitter. This removes the need for the return value. > > > > > > Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> > > > --- > > > arch/x86/kvm/mmu.c | 34 +++++++++------------------------- > > > 1 files changed, 9 insertions(+), 25 deletions(-) > > > > Its likely that other 4k pages are mapped read-write in the 2mb range > > covered by a read-only 2mb map. Therefore its not entirely useful to > > map read-only. > > > > Can you measure an improvement with this change? > > What we discussed at KVM Forum last week was about the jitter we could > measure right after starting live migration: both Isaku and Chegu reported > such jitter. > > So if this patch reduces such jitter for some real workloads, by lazily > dropping largepage mappings and saving read faults until that point, that > would be very nice! > > But sadly, what they measured included interactions with the outside of the > guest, and the main cause was due to the big QEMU lock problem, they guessed. > The order is so different that an improvement by a kernel side effort may not > be seen easily. > > FWIW: I am now changing the initial write protection by > kvm_mmu_slot_remove_write_access() to rmap based as I proposed at KVM Forum. > ftrace said that 1ms was improved to 250-350us by the change for 10GB guest. > My code still drops largepage mappings, so the initial write protection time > itself may not be a such big issue here, I think. > > Again, if we can eliminate read faults to such an extent that guests can see > measurable improvement, that should be very nice! > > Any thoughts? > > Thanks, > Takuya OK, makes sense. I'm worried about shadow / oos interactions with large read-only mappings (trying to remember what was the case exactly, it might be non-existant now). ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] KVM: MMU: lazily drop large spte 2012-11-14 14:44 ` Marcelo Tosatti @ 2012-11-14 23:33 ` Xiao Guangrong 0 siblings, 0 replies; 3+ messages in thread From: Xiao Guangrong @ 2012-11-14 23:33 UTC (permalink / raw) To: Marcelo Tosatti Cc: kvm, quintela, qemu-devel, linux-kernel, owasserm, avi, pbonzini, chegu_vinod, Takuya Yoshikawa, yamahata On 11/14/2012 10:44 PM, Marcelo Tosatti wrote: > On Wed, Nov 14, 2012 at 12:33:50AM +0900, Takuya Yoshikawa wrote: >> Ccing live migration developers who should be interested in this work, >> >> On Mon, 12 Nov 2012 21:10:32 -0200 >> Marcelo Tosatti <mtosatti@redhat.com> wrote: >> >>> On Mon, Nov 05, 2012 at 05:59:26PM +0800, Xiao Guangrong wrote: >>>> Do not drop large spte until it can be insteaded by small pages so that >>>> the guest can happliy read memory through it >>>> >>>> The idea is from Avi: >>>> | As I mentioned before, write-protecting a large spte is a good idea, >>>> | since it moves some work from protect-time to fault-time, so it reduces >>>> | jitter. This removes the need for the return value. >>>> >>>> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> >>>> --- >>>> arch/x86/kvm/mmu.c | 34 +++++++++------------------------- >>>> 1 files changed, 9 insertions(+), 25 deletions(-) >>> >>> Its likely that other 4k pages are mapped read-write in the 2mb range >>> covered by a read-only 2mb map. Therefore its not entirely useful to >>> map read-only. >>> >>> Can you measure an improvement with this change? >> >> What we discussed at KVM Forum last week was about the jitter we could >> measure right after starting live migration: both Isaku and Chegu reported >> such jitter. >> >> So if this patch reduces such jitter for some real workloads, by lazily >> dropping largepage mappings and saving read faults until that point, that >> would be very nice! >> >> But sadly, what they measured included interactions with the outside of the >> guest, and the main cause was due to the big QEMU lock problem, they guessed. >> The order is so different that an improvement by a kernel side effort may not >> be seen easily. >> >> FWIW: I am now changing the initial write protection by >> kvm_mmu_slot_remove_write_access() to rmap based as I proposed at KVM Forum. >> ftrace said that 1ms was improved to 250-350us by the change for 10GB guest. >> My code still drops largepage mappings, so the initial write protection time >> itself may not be a such big issue here, I think. >> >> Again, if we can eliminate read faults to such an extent that guests can see >> measurable improvement, that should be very nice! >> >> Any thoughts? >> >> Thanks, >> Takuya > > OK, makes sense. I'm worried about shadow / oos interactions > with large read-only mappings (trying to remember what was the > case exactly, it might be non-existant now). Marcelo, i guess commit 38187c830cab84daecb41169948467f1f19317e3 is what you mentioned, but i do not know how it can "Simplifies out of sync shadow." :( ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-14 23:34 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <50978DFE.1000005@linux.vnet.ibm.com> [not found] ` <20121112231032.GB5798@amt.cnet> 2012-11-13 15:33 ` [Qemu-devel] [PATCH] KVM: MMU: lazily drop large spte Takuya Yoshikawa 2012-11-14 14:44 ` Marcelo Tosatti 2012-11-14 23:33 ` Xiao Guangrong
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).