From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH] x86/EPT: adjust types in ept_split_super_page() Date: Tue, 29 Sep 2015 11:40:36 +0100 Message-ID: <560A6AA4.1050204@citrix.com> References: <56096C5702000078000A63D6@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZgsKw-0002iI-9f for xen-devel@lists.xenproject.org; Tue, 29 Sep 2015 10:40:42 +0000 In-Reply-To: <56096C5702000078000A63D6@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: George Dunlap , Andrew Cooper , Kevin Tian , Jun Nakajima List-Id: xen-devel@lists.xenproject.org On 28/09/15 15:35, Jan Beulich wrote: > The function returns a boolean and its current and target level inputs > are unsigned (which in turn allows simplifying the early-out check). > Also convert a non-standard loop variable to an ordinary function scope > one, at once making it unsigned too. > > Signed-off-by: Jan Beulich Acked-by: George Dunlap > > --- a/xen/arch/x86/mm/p2m-ept.c > +++ b/xen/arch/x86/mm/p2m-ept.c > @@ -266,16 +266,18 @@ static void ept_free_entry(struct p2m_do > p2m_free_ptp(p2m, mfn_to_page(ept_entry->mfn)); > } > > -static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry, > - int level, int target) > +static bool_t ept_split_super_page(struct p2m_domain *p2m, > + ept_entry_t *ept_entry, > + unsigned int level, unsigned int target) > { > ept_entry_t new_ept, *table; > uint64_t trunk; > - int rv = 1; > + unsigned int i; > + bool_t rv = 1; > > /* End if the entry is a leaf entry or reaches the target level. */ > - if ( level == 0 || level == target ) > - return rv; > + if ( level <= target ) > + return 1; > > ASSERT(is_epte_superpage(ept_entry)); > > @@ -285,7 +287,7 @@ static int ept_split_super_page(struct p > table = map_domain_page(_mfn(new_ept.mfn)); > trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER); > > - for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) > + for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ ) > { > ept_entry_t *epte = table + i; > > > >