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, 23 May 2012 17:49:31 +0300 Message-ID: <4FBCF8FB.6050308@redhat.com> References: <1337782095-32287-1-git-send-email-gleb@redhat.com> <1337782095-32287-3-git-send-email-gleb@redhat.com> <4FBCF6EB.8040604@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, "Roedel, Joerg" To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:48049 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754416Ab2EWOtf (ORCPT ); Wed, 23 May 2012 10:49:35 -0400 In-Reply-To: <4FBCF6EB.8040604@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/23/2012 05:40 PM, Avi Kivity wrote: > On 05/23/2012 05:08 PM, Gleb Natapov wrote: >> "rep ins" emulation is going through emulator now. This is slow because >> emulator knows how to write back only one datum at a time. This patch >> provides fast path for the instruction in certain conditions. The >> conditions are: DF flag is not set, destination memory is RAM and single >> datum does not cross page boundary. If fast path code fails it falls >> back to emulation. >> >> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c >> index f75af40..20e3fb0 100644 >> --- a/arch/x86/kvm/svm.c >> +++ b/arch/x86/kvm/svm.c >> @@ -1887,21 +1887,31 @@ static int io_interception(struct vcpu_svm *svm) >> { >> struct kvm_vcpu *vcpu = &svm->vcpu; >> u32 io_info = svm->vmcb->control.exit_info_1; /* address size bug? */ >> - int size, in, string; >> + int size, in, string, rep; >> unsigned port; >> >> ++svm->vcpu.stat.io_exits; >> string = (io_info & SVM_IOIO_STR_MASK) != 0; >> + rep = (io_info & SVM_IOIO_REP_MASK) != 0; >> in = (io_info & SVM_IOIO_TYPE_MASK) != 0; >> - if (string || in) >> - return emulate_instruction(vcpu, 0) == EMULATE_DONE; >> > > If decode assists are not available, we still need to emulate, see 15.33.5. > Joerg, the 2010 version of the manual says that the effective segment (10:12) is only available with decode assists. The 2012 version says it's unconditional. What's correct? -- error compiling committee.c: too many arguments to function