From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [PATCH 2/3] x86/xen: add extra memory for remapped frames during setup Date: Wed, 07 Jan 2015 16:12:08 +0100 Message-ID: <54AD4CC8.9050403@suse.com> References: <1420642048-12236-1-git-send-email-david.vrabel@citrix.com> <1420642048-12236-3-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" 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 1Y8sHL-0006bG-H7 for xen-devel@lists.xenproject.org; Wed, 07 Jan 2015 15:12:11 +0000 In-Reply-To: <1420642048-12236-3-git-send-email-david.vrabel@citrix.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: David Vrabel , xen-devel@lists.xenproject.org Cc: Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org On 01/07/2015 03:47 PM, David Vrabel wrote: > If the non-RAM regions in the e820 memory map are larger than the size > of the initial balloon, a BUG was triggered as the frames are remaped > beyond the limit of the linear p2m. The frames are remapped into the > initial balloon area (xen_extra_mem) but not enough of this is > available. > > Ensure enough extra memory regions are added for these remapped > frames. > > Signed-off-by: David Vrabel Reviewed-by: Juergen Gross > --- > arch/x86/xen/setup.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c > index 664dffc..feb6d86 100644 > --- a/arch/x86/xen/setup.c > +++ b/arch/x86/xen/setup.c > @@ -366,7 +366,7 @@ static void __init xen_do_set_identity_and_remap_chunk( > static unsigned long __init xen_set_identity_and_remap_chunk( > const struct e820entry *list, size_t map_size, unsigned long start_pfn, > unsigned long end_pfn, unsigned long nr_pages, unsigned long remap_pfn, > - unsigned long *released) > + unsigned long *released, unsigned long *remapped) > { > unsigned long pfn; > unsigned long i = 0; > @@ -404,6 +404,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk( > /* Update variables to reflect new mappings. */ > i += size; > remap_pfn += size; > + *remapped += size; > } > > /* > @@ -420,12 +421,13 @@ static unsigned long __init xen_set_identity_and_remap_chunk( > > static void __init xen_set_identity_and_remap( > const struct e820entry *list, size_t map_size, unsigned long nr_pages, > - unsigned long *released) > + unsigned long *released, unsigned long *remapped) > { > phys_addr_t start = 0; > unsigned long last_pfn = nr_pages; > const struct e820entry *entry; > unsigned long num_released = 0; > + unsigned long num_remapped = 0; > int i; > > /* > @@ -452,12 +454,13 @@ static void __init xen_set_identity_and_remap( > last_pfn = xen_set_identity_and_remap_chunk( > list, map_size, start_pfn, > end_pfn, nr_pages, last_pfn, > - &num_released); > + &num_released, &num_remapped); > start = end; > } > } > > *released = num_released; > + *remapped = num_remapped; > > pr_info("Released %ld page(s)\n", num_released); > } > @@ -577,6 +580,7 @@ char * __init xen_memory_setup(void) > struct xen_memory_map memmap; > unsigned long max_pages; > unsigned long extra_pages = 0; > + unsigned long remapped_pages; > int i; > int op; > > @@ -626,9 +630,10 @@ char * __init xen_memory_setup(void) > * underlying RAM. > */ > xen_set_identity_and_remap(map, memmap.nr_entries, max_pfn, > - &xen_released_pages); > + &xen_released_pages, &remapped_pages); > > extra_pages += xen_released_pages; > + extra_pages += remapped_pages; > > /* > * Clamp the amount of extra memory to a EXTRA_MEM_RATIO >