From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] x86: consider modules when cutting off memory Date: Mon, 18 Nov 2013 03:32:42 -0800 Message-ID: References: <5289DFCB0200007800103E6F@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ViN4W-00066u-Hh for xen-devel@lists.xenproject.org; Mon, 18 Nov 2013 11:32:54 +0000 Received: by mail-pd0-f169.google.com with SMTP id v10so873106pde.14 for ; Mon, 18 Nov 2013 03:32:49 -0800 (PST) In-Reply-To: <5289DFCB0200007800103E6F@nat28.tlf.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 List-Id: xen-devel@lists.xenproject.org On 18/11/2013 00:37, "Jan Beulich" wrote: > The code in question runs after module ranges got already removed from > the E820 table, so when determining the new maximum page/PDX we need to > explicitly take them into account. > > Furthermore we need to round up the ending addresses here, in order to > fully cover eventual partial trailing pages. Is rounding up the right thing to do? We round down in find_max_pfn()? > Signed-off-by: Jan Beulich > > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -1013,9 +1013,17 @@ void __init __start_xen(unsigned long mb > ASSERT(j); > } > map_e = boot_e820.map[j].addr + boot_e820.map[j].size; > - if ( (map_e >> PAGE_SHIFT) < max_page ) > + for ( j = 0; j < mbi->mods_count; ++j ) > { > - max_page = map_e >> PAGE_SHIFT; > + uint64_t end = pfn_to_paddr(mod[j].mod_start) + > + mod[j].mod_end; > + > + if ( map_e < end ) > + map_e = end; > + } > + if ( PFN_UP(map_e) < max_page ) > + { > + max_page = PFN_UP(map_e); > max_pdx = pfn_to_pdx(max_page - 1) + 1; > } > printk(XENLOG_WARNING "Ignoring inaccessible memory range" > > >