From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFT] mmu optimizations branch Date: Wed, 03 Jan 2007 12:16:07 +0200 Message-ID: <459B8267.5080000@qumranet.com> References: <4598E33B.608@qumranet.com> <20070102161117.GA3306@elte.hu> <459A8909.7020600@qumranet.com> <20070103022241.GA13840@elte.hu> <459B6A15.4010208@qumranet.com> <20070103100235.GA17168@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: <20070103100235.GA17168-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: > > >>> 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. >>> >> Does this really call for parvirtualization? Caching the old cr3 value >> will work for native as well. >> > > it's already cached (and my changes use that cached value), but it (used > to be) faster/smaller to just move from cr3 than to dereference down to > the cached pgd pointer, because we used to inline those instructions > heavily. But i agree that in the current kernel it's probably worth > doing this for native too - i'll cook up a patch for upstream. > > Ok. A question. What's __flush_tlb() doing in the context switch path? Shouldn't it just load the new cr3 and be done with it? -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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