[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH] xen/arm: Vmap allocator fails to allocate beyond 128M
In vmap_init, map_pages_to_xen() is called for mapping vm_bitmap. Initially one page of vm_bitmap is allocated and mapped using PAGE_HYPERVISOR attribute. For the rest of vm_bitmap pages, MAP_SMALL_PAGES attribute is used to map. In ARM for both PAGE_HYPERVISOR and MAP_SMALL_PAGES, valid bit is set to 1 in pte entry for these mapping. In vma_alloc(), map_pages_to_xen() is failing for >128MB because for this next vm_bitmap page the mapping is already set in vm_init() with valid bit set in pte entry. So map_pages_to_xen() in ARM returns error. On x86, for the pages mapped with MAP_SMALL_PAGES attribute valid bit is not set. So the common vmap code assumes the same behaviour from arm. However this is not the case. This patch will set valid bit to 0 in pte entry when pages are mapped with MAP_SMALL_PAGES. Signed-off-by: Vijaya Kumar K<Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index c3ae184..f125cf9 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -827,7 +827,8 @@ static int create_xen_table(lpae_t *entry) enum xenmap_operation { INSERT, - REMOVE + REMOVE, + RESERVE }; static int create_xen_entries(enum xenmap_operation op, @@ -859,6 +860,7 @@ static int create_xen_entries(enum xenmap_operation op, switch ( op ) { case INSERT: + case RESERVE: if ( third[third_table_offset(addr)].pt.valid ) { printk("create_xen_entries: trying to replace an existing mapping addr=%lx mfn=%lx\n", @@ -866,6 +868,8 @@ static int create_xen_entries(enum xenmap_operation op, return -EINVAL; } pte = mfn_to_xen_entry(mfn, ai); + if ( op == RESERVE ) + pte.pt.valid = 0; pte.pt.table = 1; write_pte(&third[third_table_offset(addr)], pte); break; @@ -896,7 +900,10 @@ int map_pages_to_xen(unsigned long virt, unsigned long nr_mfns, unsigned int flags) { - return create_xen_entries(INSERT, virt, mfn, nr_mfns, flags); + if ( flags == MAP_SMALL_PAGES ) + return create_xen_entries(RESERVE, virt, mfn, nr_mfns, PAGE_HYPERVISOR); + else + return create_xen_entries(INSERT, virt, mfn, nr_mfns, flags); } void destroy_xen_mappings(unsigned long v, unsigned long e) { diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 53d4b63..e704ac8 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -58,6 +58,7 @@ #define WRITEBACK 0x3 #define DEV_SHARED 0x4 #define WRITEALLOC 0x7 +#define WRITEALLOC_INVALID 0xf #define DEV_NONSHARED DEV_SHARED #define DEV_WC BUFFERABLE #define DEV_CACHED WRITEBACK @@ -65,7 +66,7 @@ #define PAGE_HYPERVISOR (WRITEALLOC) #define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) #define PAGE_HYPERVISOR_WC (DEV_WC) -#define MAP_SMALL_PAGES PAGE_HYPERVISOR +#define MAP_SMALL_PAGES (WRITEALLOC_INVALID) /* * Stage 2 Memory Type. -- 1.7.9.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |