From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH v2 6/9] KVM: MMU: Simplify walk_addr_generic() loop Date: Tue, 18 Sep 2012 14:53:14 +0800 Message-ID: <50581A5A.8090206@linux.vnet.ibm.com> References: <1347797235-20732-1-git-send-email-avi@redhat.com> <1347797235-20732-7-git-send-email-avi@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 e28smtp06.in.ibm.com ([122.248.162.6]:53102 "EHLO e28smtp06.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756119Ab2IRGxX (ORCPT ); Tue, 18 Sep 2012 02:53:23 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Sep 2012 12:23:21 +0530 Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8I6rHok32768146 for ; Tue, 18 Sep 2012 12:23:17 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8I6rHr1025144 for ; Tue, 18 Sep 2012 16:53:17 +1000 In-Reply-To: <1347797235-20732-7-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/16/2012 08:07 PM, Avi Kivity wrote: > > - pt_access = ACC_ALL; > + pt_access = pte_access = ACC_ALL; > + ++walker->level; > > - for (;;) { > + do { > gfn_t real_gfn; > unsigned long host_addr; > > + pt_access &= pte_access; > + --walker->level; Any reason increase walker->level before the loop and decrease here? Can not use the origin style? :) > + gfn = gpte_to_gfn_lvl(pte, walker->level); > + gfn += (addr & PT_LVL_OFFSET_MASK(walker->level)) >> PAGE_SHIFT; > + > + if (PTTYPE == 32 && walker->level == PT_DIRECTORY_LEVEL && is_cpuid_PSE36()) > + gfn += pse36_gfn_delta(pte); > + > + ac = write_fault | fetch_fault | user_fault; Can use 'access' instead. Otherwise looks good to me. Reviewed-by: Xiao Guangrong