diff mbox

xen/arm: setup: initialize xenheap mappings after boot pages avaiable

Message ID 1464327119-6242-1-git-send-email-van.freenix@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peng Fan May 27, 2016, 5:31 a.m. UTC
To ARM64, setup_xenheap_mappings may call alloc_boot_pages to allocate
first level page table, if there is a big chunk memory (ie, >512GB).

So, need to make sure boot pages are ready before setup xenheap mappings.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Julien Grall May 30, 2016, 9:53 p.m. UTC | #1
Hi Peng,

On 27/05/2016 06:31, Peng Fan wrote:
> To ARM64, setup_xenheap_mappings may call alloc_boot_pages to allocate
> first level page table, if there is a big chunk memory (ie, >512GB).

Out of interest, have you found the bug by testing Xen on a platform 
with 512GB of RAM? :)

> So, need to make sure boot pages are ready before setup xenheap mappings.

init_boot_pages is using mfn_to_virt (see bootmem_region_add), which 
cannot work until xenheap_mfn_start is initialized. This is done by 
setup_xenheap_mappings.

I would be happy to give you hint on how to solve this, but I am not 
sure to fully understand your issue. Can you give more details?

Regards,

>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> ---
>  xen/arch/arm/setup.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index dcb23b7..24cf9d3 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -641,8 +641,6 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
>          ram_start = min(ram_start,bank_start);
>          ram_end = max(ram_end,bank_end);
>
> -        setup_xenheap_mappings(bank_start>>PAGE_SHIFT, bank_size>>PAGE_SHIFT);
> -
>          s = bank_start;
>          while ( s < bank_end )
>          {
> @@ -663,6 +661,8 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
>              dt_unreserved_regions(s, e, init_boot_pages, 0);
>              s = n;
>          }
> +
> +        setup_xenheap_mappings(bank_start>>PAGE_SHIFT, bank_size>>PAGE_SHIFT);
>      }
>
>      total_pages += ram_size >> PAGE_SHIFT;
>
diff mbox

Patch

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index dcb23b7..24cf9d3 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -641,8 +641,6 @@  static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
         ram_start = min(ram_start,bank_start);
         ram_end = max(ram_end,bank_end);
 
-        setup_xenheap_mappings(bank_start>>PAGE_SHIFT, bank_size>>PAGE_SHIFT);
-
         s = bank_start;
         while ( s < bank_end )
         {
@@ -663,6 +661,8 @@  static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
             dt_unreserved_regions(s, e, init_boot_pages, 0);
             s = n;
         }
+
+        setup_xenheap_mappings(bank_start>>PAGE_SHIFT, bank_size>>PAGE_SHIFT);
     }
 
     total_pages += ram_size >> PAGE_SHIFT;