From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [RFT] mmu optimizations branch Date: Tue, 02 Jan 2007 21:05:46 -0600 Message-ID: <459B1D8A.6040604@cs.utexas.edu> References: <4598E33B.608@qumranet.com> <20070102161117.GA3306@elte.hu> <459A8909.7020600@qumranet.com> <20070103022241.GA13840@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel Return-path: To: Ingo Molnar In-Reply-To: <20070103022241.GA13840-X9Un+BFzKDI@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Ingo Molnar wrote: > * Avi Kivity wrote: > > >>> lat_ctx -s 0 [zero memory footprint]: >>> >>> ------------------------------------------------- >>> #tasks native kvm-r4204 kvm-r4232(mmu) >>> ------------------------------------------------- >>> 2: 2.02 180.91 9.19 >>> 20: 4.04 183.21 10.01 >>> 50: 4.30 185.95 11.27 >>> >>> so here it's a /massive/, almost 20 times speedup! >>> >>> >> Excellent. 10us is approximately the vmexit overhead on intel (we >> regularly see 100-120k exits/sec), so it means a context switch is >> exactly one exit. Hard to beat without nested page tables. >> > > actually, the VM entry+exit cost on this CPU is around 3-4 microseconds, > so it's still 2 VM exits per context switch. > > I debugged this a bit, and what happens is that when Linux does a > task-switch it does a cr3 load /and/ a write (look at __flush_tlb()) - > and both are causing a vm exit! > > I have started paravirtualizing the Linux kernel for KVM. I have > eliminated the cr3 load from the Linux kernel via paravirtualization and > that way lat_ctx shows a ~5-6 usecs context-switch cost. That's pretty > good i think, compared to the 2-3 usecs of native. I'll send patches for > this tomorrow. > This should be hookable via arch_{enter,leave}_cpu_mode() via paravirt_ops. I was actually just looking at this myself (although I was focusing on lazy mmu hooks). I've taken the route of using a VMI ROM to actually hook it (instead of implementing a custom paravirt_ops for KVM). I can post the ROM if you're interested in this sort of approach. I like using VMI as we can access most of the things hookable by paravirt_ops without having to change a kernel binary. Regards, Anthony Liguori > Ingo > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > kvm-devel mailing list > kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/kvm-devel > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV