From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/2] Provide fast path for "rep ins" emulation if possible. Date: Wed, 06 Jun 2012 11:04:03 +0300 Message-ID: <4FCF0EF3.9060509@redhat.com> References: <1337782095-32287-1-git-send-email-gleb@redhat.com> <1337782095-32287-3-git-send-email-gleb@redhat.com> <4FCE2ECB.8080103@redhat.com> <20120605171919.GH20236@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:65373 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888Ab2FFIEG (ORCPT ); Wed, 6 Jun 2012 04:04:06 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q56845II018212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Jun 2012 04:04:05 -0400 In-Reply-To: <20120605171919.GH20236@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/05/2012 08:19 PM, Gleb Natapov wrote: > On Tue, Jun 05, 2012 at 07:07:39PM +0300, Avi Kivity wrote: >> > + >> > + count = (PAGE_SIZE - offset_in_page(linear_addr))/size; >> > + >> > + if (count == 0) /* 'in' crosses page boundry */ >> > + return EMULATE_FAIL; >> > + >> > + count = min(count, rcx); >> > + >> > + r = __kvm_fast_string_pio_in(vcpu, size, port, linear_addr, count); >> > + >> > + if (r != EMULATE_DO_MMIO) >> > + return r; >> > + >> > + vcpu->arch.fast_string_pio_ctxt.linear_addr = linear_addr; >> > + vcpu->arch.complete_userspace_io = complete_fast_string_pio; >> > + return EMULATE_DO_MMIO; >> > +} >> > +EXPORT_SYMBOL_GPL(kvm_fast_string_pio_in); >> >> Perhaps a better way to do it is to move the code into the emulator, >> which already handles all the checks and masks, and just avoid >> x86_decode_insn()/x86_emulate_insn(). >> > I do not see how it would be better. Emulator works on different data > structures that should be prepared and the only functions that we can > reuse (as far as I see) are register_address_increment() and ad_mask() > anyway. Also linearize(). Remember the hardware segment checks are only applied to the first iteration. -- error compiling committee.c: too many arguments to function