From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: [patch 3/5] KVM: hypercall batching Date: Sun, 17 Feb 2008 12:40:28 -0600 Message-ID: <1203273628.24928.2.camel@diesel> References: <20080216220924.733723618@redhat.com> > <20080216221220.924823582@redhat.com>> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net, Avi Kivity To: Marcelo Tosatti Return-path: In-Reply-To: <20080216221220.924823582@redhat.com>> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org On Sat, 2008-02-16 at 17:09 -0500, Marcelo Tosatti wrote: > plain text document attachment (kvm-multicall) > Batch pte updates and tlb flushes in lazy MMU mode. > > Signed-off-by: Marcelo Tosatti > Cc: Anthony Liguori > > Index: kvm.paravirt/arch/x86/kernel/kvm.c > =================================================================== > --- kvm.paravirt.orig/arch/x86/kernel/kvm.c > +++ kvm.paravirt/arch/x86/kernel/kvm.c > @@ -25,6 +25,74 @@ > #include > #include > #include > +#include > + > +#define MAX_MULTICALL_NR (PAGE_SIZE / sizeof(struct kvm_multicall_entry)) > + > +struct kvm_para_state { > + struct kvm_multicall_entry queue[MAX_MULTICALL_NR]; > + int queue_index; > + enum paravirt_lazy_mode mode; > +}; > + > +static DEFINE_PER_CPU(struct kvm_para_state, para_state); AFAICS there is no guarantee about page-alignment here... > +static int kvm_hypercall_multicall(struct kvm_vcpu *vcpu, gpa_t addr, u32 nents) > +{ > + int i, result = 0; > + > + ++vcpu->stat.multicall; > + vcpu->stat.multicall_nr += nents; > + > + for (i = 0; i < nents; i++) { > + struct kvm_multicall_entry mc; > + int ret; > + > + down_read(&vcpu->kvm->slots_lock); > + ret = kvm_read_guest(vcpu->kvm, addr, &mc, sizeof(mc)); > + up_read(&vcpu->kvm->slots_lock); > + if (ret) > + return -KVM_EFAULT; > + > + ret = dispatch_hypercall(vcpu, mc.nr, mc.a0, mc.a1, mc.a2, > + mc.a3); > + if (ret) > + result = ret; > + addr += sizeof(mc); > + } > + if (result < 0) > + return -KVM_EINVAL; > + return result; > +} ... but here you're assuming that 'queue' is physically contiguous, which is not necessarily true one you cross a page boundary. -- Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/