From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCHv4 3/5] KVM: emulator: move some address manipulation function out of emulator code. Date: Thu, 19 Jul 2012 16:43:39 +0300 Message-ID: <20120719134339.GD26120@redhat.com> References: <1342683653-32114-1-git-send-email-gleb@redhat.com> <1342683653-32114-4-git-send-email-gleb@redhat.com> <5007E497.1040905@redhat.com> <20120719104951.GU26120@redhat.com> <50080CFA.4040607@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, mtosatti@redhat.com To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34657 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750743Ab2GSNnm (ORCPT ); Thu, 19 Jul 2012 09:43:42 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6JDhfLd013818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Jul 2012 09:43:42 -0400 Content-Disposition: inline In-Reply-To: <50080CFA.4040607@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jul 19, 2012 at 04:34:50PM +0300, Avi Kivity wrote: > On 07/19/2012 01:49 PM, Gleb Natapov wrote: > >> All those exports suggest it's better to move the fast path into the > >> emulator. > > > > We've already being through that. Putting the code into emulator gives > > us nothing unless it also works on emulator context and working on > > partially initialized emulator context is first dangerous and second > > slower. > > We can make it work on an x86_pio_ctxt. What it gives us is common > code. (x86_emulate_ctxt can include a x86_pio_ctxt when it does pio). > My patches do similar thing, but instead of x86_pio_ctxt they use x86_linearize_ctx. The code is common. > > > >> Suppose we change register access to use callbacks instead of > >> bulk load/save, could we reuse the exising code? > >> > > I do not see that problem. This helper function do basic arithmetics > > on three values. The value itself will be fetched on demand by the emulator. > > I meant to reduce the emulator initialization cost, so it isn't slow. > > btw, I'm guessing that the main speedup comes not from avoiding the > decode, but by doing page-at-a-time instead of word-at-a-time. > And hacking emulator doing page at a time is not trivial an complicates it for no good reason. BTW you were the one who suggested implementing fast pio as a separate code path. -- Gleb.