From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 6/5] KVM: MMU: Optimize is_last_gpte() Date: Thu, 13 Sep 2012 21:39:17 +0800 Message-ID: <5051E205.5090400@linux.vnet.ibm.com> References: <1347460194-11807-1-git-send-email-avi@redhat.com> <1347472187-14708-1-git-send-email-avi@redhat.com> <5050CE7C.20206@redhat.com> <5051ABCA.8080300@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from e28smtp07.in.ibm.com ([122.248.162.7]:59424 "EHLO e28smtp07.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755761Ab2IMNjY (ORCPT ); Thu, 13 Sep 2012 09:39:24 -0400 Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Sep 2012 19:09:21 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8DDdJsL36175896 for ; Thu, 13 Sep 2012 19:09:19 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8DJ8tu7002836 for ; Fri, 14 Sep 2012 00:38:55 +0530 In-Reply-To: <5051ABCA.8080300@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/13/2012 05:47 PM, Avi Kivity wrote: > On 09/12/2012 09:03 PM, Avi Kivity wrote: >> On 09/12/2012 08:49 PM, Avi Kivity wrote: >>> Instead of branchy code depending on level, gpte.ps, and mmu configuration, >>> prepare everything in a bitmap during mode changes and look it up during >>> runtime. >> >> 6/5 is buggy, sorry, will update it tomorrow. >> >> > > --------8<----------8<-------------- > > From: Avi Kivity > Date: Wed, 12 Sep 2012 20:46:56 +0300 > Subject: [PATCH v2 6/5] KVM: MMU: Optimize is_last_gpte() > > Instead of branchy code depending on level, gpte.ps, and mmu configuration, > prepare everything in a bitmap during mode changes and look it up during > runtime. > > Signed-off-by: Avi Kivity > --- > > v2: rearrange bitmap (one less shift) > avoid stomping on local variable > fix index calculation > move check back to a function > > arch/x86/include/asm/kvm_host.h | 7 +++++++ > arch/x86/kvm/mmu.c | 31 +++++++++++++++++++++++++++++++ > arch/x86/kvm/mmu.h | 3 ++- > arch/x86/kvm/paging_tmpl.h | 22 +--------------------- > 4 files changed, 41 insertions(+), 22 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 3318bde..f9a48cf 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -298,6 +298,13 @@ struct kvm_mmu { > u64 *lm_root; > u64 rsvd_bits_mask[2][4]; > > + /* > + * Bitmap: bit set = last pte in walk > + * index[0]: pte.ps > + * index[1:2]: level > + */ Opposite? index[2]: pte.pse? Reviewed-by: Xiao Guangrong