diff for duplicates of <20130823171605.GH10971@arm.com> diff --git a/a/1.txt b/N1/1.txt index 98fe58f..5e65130 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -3,7 +3,7 @@ On Thu, Aug 22, 2013 at 05:16:14PM +0100, Catalin Marinas wrote: > > This problem is on ARM64. When CONFIG_ARM64_64K_PAGES is not opened, the memory > > map size can be 2M(section) and 4K(PAGE). First, OS will create map for pgd > > (level 1 table) and level 2 table which in swapper_pg_dir. Then, OS register -> > mem block into memblock.memory according to memory node in fdt, like memory at 0, +> > mem block into memblock.memory according to memory node in fdt, like memory@0, > > and create map in setup_arch-->paging_init. If all mem block start address and > > size is integral multiple of 2M, there is no problem, because we will create 2M > > section size map whose entries locate in level 2 table. But if it is not @@ -22,84 +22,3 @@ On Thu, Aug 22, 2013 at 05:16:14PM +0100, Catalin Marinas wrote: Could you please try this patch? -------------------------8<--------------------------------------- - ->From 3a35771339b7eea105925d1d573aedbeeea59ef0 Mon Sep 17 00:00:00 2001 -From: Catalin Marinas <catalin.marinas@arm.com> -Date: Fri, 23 Aug 2013 18:04:44 +0100 -Subject: [PATCH] arm64: Fix mapping of memory banks not ending on a PMD_SIZE - boundary - -The map_mem() function limits the current memblock limit to PGDIR_SIZE -(the initial swapper_pg_dir mapping) to avoid create_mapping() -allocating memory from unmapped areas. However, if the first block is -within PGDIR_SIZE and not ending on a PMD_SIZE boundary, when 4K page -configuration is enabled, create_mapping() will try to allocate a pte -page. Such page may be returned by memblock_alloc() from the end of such -bank (or any subsequent bank within PGDIR_SIZE) which is not mapped yet. - -The patch limits the current memblock limit to the aligned end of the -first bank and gradually increases it as more memory is mapped. It also -ensures that the start of the first bank is aligned to PMD_SIZE to avoid -pte page allocation for this mapping. - -Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> -Reported-by: "Leizhen (ThunderTown, Euler)" <thunder.leizhen@huawei.com> ---- - arch/arm64/mm/mmu.c | 28 ++++++++++++++++++++++++++-- - 1 file changed, 26 insertions(+), 2 deletions(-) - -diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c -index a8d1059..49a0bc2 100644 ---- a/arch/arm64/mm/mmu.c -+++ b/arch/arm64/mm/mmu.c -@@ -296,6 +296,7 @@ void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt) - static void __init map_mem(void) - { - struct memblock_region *reg; -+ phys_addr_t limit; - - /* - * Temporarily limit the memblock range. We need to do this as -@@ -303,9 +304,11 @@ static void __init map_mem(void) - * memory addressable from the initial direct kernel mapping. - * - * The initial direct kernel mapping, located at swapper_pg_dir, -- * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (aligned). -+ * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (which must be -+ * aligned to 2MB as per Documentation/arm64/booting.txt). - */ -- memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE); -+ limit = PHYS_OFFSET + PGDIR_SIZE; -+ memblock_set_current_limit(limit); - - /* map all the memory banks */ - for_each_memblock(memory, reg) { -@@ -315,7 +318,28 @@ static void __init map_mem(void) - if (start >= end) - break; - -+#ifndef CONFIG_ARM64_64K_PAGES -+ /* -+ * For the first memory bank align the start address and -+ * current memblock limit to prevent create_mapping() from -+ * allocating pte page tables from unmapped memory. -+ * When 64K pages are enabled, the pte page table for the -+ * first PGDIR_SIZE is already present in swapper_pg_dir. -+ */ -+ if (start < limit) -+ start = ALIGN(start, PMD_SIZE); -+ if (end < limit) { -+ limit = end & PMD_MASK; -+ memblock_set_current_limit(limit); -+ } -+#endif -+ - create_mapping(start, __phys_to_virt(start), end - start); -+ -+ /* -+ * Mapping created, extend the current memblock limit. -+ */ -+ memblock_set_current_limit(end); - } - - /* Limit no longer required. */ diff --git a/a/content_digest b/N1/content_digest index 45aecf7..1e52ecc 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,9 +1,18 @@ "ref\0BFAC7FA8F7636E45AB9ECBAC17346F3434557683@SZXEML508-MBS.china.huawei.com\0" "ref\020130822161614.GE1352@arm.com\0" - "From\0catalin.marinas@arm.com (Catalin Marinas)\0" - "Subject\0[BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception.\0" + "From\0Catalin Marinas <catalin.marinas@arm.com>\0" + "Subject\0Re: [BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception.\0" "Date\0Fri, 23 Aug 2013 18:16:05 +0100\0" - "To\0linux-arm-kernel@lists.infradead.org\0" + "To\0Leizhen (ThunderTown" + " Euler) <thunder.leizhen@huawei.com>\0" + "Cc\0Russell King <linux@arm.linux.org.uk>" + Liujiang (Gerry) <jiang.liu@huawei.com> + Will Deacon <Will.Deacon@arm.com> + linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org> + Huxinwei <huxinwei@huawei.com> + linux-mm@kvack.org <linux-mm@kvack.org> + Lizefan <lizefan@huawei.com> + " linux-arm-kernel@lists.infradead.org <linux-arm-kernel@lists.infradead.org>\0" "\00:1\0" "b\0" "On Thu, Aug 22, 2013 at 05:16:14PM +0100, Catalin Marinas wrote:\n" @@ -11,7 +20,7 @@ "> > This problem is on ARM64. When CONFIG_ARM64_64K_PAGES is not opened, the memory\n" "> > map size can be 2M(section) and 4K(PAGE). First, OS will create map for pgd\n" "> > (level 1 table) and level 2 table which in swapper_pg_dir. Then, OS register\n" - "> > mem block into memblock.memory according to memory node in fdt, like memory at 0,\n" + "> > mem block into memblock.memory according to memory node in fdt, like memory@0,\n" "> > and create map in setup_arch-->paging_init. If all mem block start address and\n" "> > size is integral multiple of 2M, there is no problem, because we will create 2M\n" "> > section size map whose entries locate in level 2 table. But if it is not\n" @@ -29,87 +38,6 @@ "\n" "Could you please try this patch?\n" "\n" - "-------------------------8<---------------------------------------\n" - "\n" - ">From 3a35771339b7eea105925d1d573aedbeeea59ef0 Mon Sep 17 00:00:00 2001\n" - "From: Catalin Marinas <catalin.marinas@arm.com>\n" - "Date: Fri, 23 Aug 2013 18:04:44 +0100\n" - "Subject: [PATCH] arm64: Fix mapping of memory banks not ending on a PMD_SIZE\n" - " boundary\n" - "\n" - "The map_mem() function limits the current memblock limit to PGDIR_SIZE\n" - "(the initial swapper_pg_dir mapping) to avoid create_mapping()\n" - "allocating memory from unmapped areas. However, if the first block is\n" - "within PGDIR_SIZE and not ending on a PMD_SIZE boundary, when 4K page\n" - "configuration is enabled, create_mapping() will try to allocate a pte\n" - "page. Such page may be returned by memblock_alloc() from the end of such\n" - "bank (or any subsequent bank within PGDIR_SIZE) which is not mapped yet.\n" - "\n" - "The patch limits the current memblock limit to the aligned end of the\n" - "first bank and gradually increases it as more memory is mapped. It also\n" - "ensures that the start of the first bank is aligned to PMD_SIZE to avoid\n" - "pte page allocation for this mapping.\n" - "\n" - "Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>\n" - "Reported-by: \"Leizhen (ThunderTown, Euler)\" <thunder.leizhen@huawei.com>\n" - "---\n" - " arch/arm64/mm/mmu.c | 28 ++++++++++++++++++++++++++--\n" - " 1 file changed, 26 insertions(+), 2 deletions(-)\n" - "\n" - "diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c\n" - "index a8d1059..49a0bc2 100644\n" - "--- a/arch/arm64/mm/mmu.c\n" - "+++ b/arch/arm64/mm/mmu.c\n" - "@@ -296,6 +296,7 @@ void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt)\n" - " static void __init map_mem(void)\n" - " {\n" - " \tstruct memblock_region *reg;\n" - "+\tphys_addr_t limit;\n" - " \n" - " \t/*\n" - " \t * Temporarily limit the memblock range. We need to do this as\n" - "@@ -303,9 +304,11 @@ static void __init map_mem(void)\n" - " \t * memory addressable from the initial direct kernel mapping.\n" - " \t *\n" - " \t * The initial direct kernel mapping, located at swapper_pg_dir,\n" - "-\t * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (aligned).\n" - "+\t * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (which must be\n" - "+\t * aligned to 2MB as per Documentation/arm64/booting.txt).\n" - " \t */\n" - "-\tmemblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE);\n" - "+\tlimit = PHYS_OFFSET + PGDIR_SIZE;\n" - "+\tmemblock_set_current_limit(limit);\n" - " \n" - " \t/* map all the memory banks */\n" - " \tfor_each_memblock(memory, reg) {\n" - "@@ -315,7 +318,28 @@ static void __init map_mem(void)\n" - " \t\tif (start >= end)\n" - " \t\t\tbreak;\n" - " \n" - "+#ifndef CONFIG_ARM64_64K_PAGES\n" - "+\t\t/*\n" - "+\t\t * For the first memory bank align the start address and\n" - "+\t\t * current memblock limit to prevent create_mapping() from\n" - "+\t\t * allocating pte page tables from unmapped memory.\n" - "+\t\t * When 64K pages are enabled, the pte page table for the\n" - "+\t\t * first PGDIR_SIZE is already present in swapper_pg_dir.\n" - "+\t\t */\n" - "+\t\tif (start < limit)\n" - "+\t\t\tstart = ALIGN(start, PMD_SIZE);\n" - "+\t\tif (end < limit) {\n" - "+\t\t\tlimit = end & PMD_MASK;\n" - "+\t\t\tmemblock_set_current_limit(limit);\n" - "+\t\t}\n" - "+#endif\n" - "+\n" - " \t\tcreate_mapping(start, __phys_to_virt(start), end - start);\n" - "+\n" - "+\t\t/*\n" - "+\t\t * Mapping created, extend the current memblock limit.\n" - "+\t\t */\n" - "+\t\tmemblock_set_current_limit(end);\n" - " \t}\n" - " \n" - " \t/* Limit no longer required. */" + -------------------------8<--------------------------------------- -83d82f2df6030d6a440507e6ffb4b1883df7be9c1791c91ccc00bae619c55b7b +0abf0a130f6f16bfe4c4cd8f9fab6703a2bd9a3aebabf5fdd66528f8b85d7813
diff --git a/a/1.txt b/N2/1.txt index 98fe58f..94cedac 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -3,7 +3,7 @@ On Thu, Aug 22, 2013 at 05:16:14PM +0100, Catalin Marinas wrote: > > This problem is on ARM64. When CONFIG_ARM64_64K_PAGES is not opened, the memory > > map size can be 2M(section) and 4K(PAGE). First, OS will create map for pgd > > (level 1 table) and level 2 table which in swapper_pg_dir. Then, OS register -> > mem block into memblock.memory according to memory node in fdt, like memory at 0, +> > mem block into memblock.memory according to memory node in fdt, like memory@0, > > and create map in setup_arch-->paging_init. If all mem block start address and > > size is integral multiple of 2M, there is no problem, because we will create 2M > > section size map whose entries locate in level 2 table. But if it is not diff --git a/a/content_digest b/N2/content_digest index 45aecf7..d427bb4 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -1,9 +1,18 @@ "ref\0BFAC7FA8F7636E45AB9ECBAC17346F3434557683@SZXEML508-MBS.china.huawei.com\0" "ref\020130822161614.GE1352@arm.com\0" - "From\0catalin.marinas@arm.com (Catalin Marinas)\0" - "Subject\0[BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception.\0" + "From\0Catalin Marinas <catalin.marinas@arm.com>\0" + "Subject\0Re: [BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception.\0" "Date\0Fri, 23 Aug 2013 18:16:05 +0100\0" - "To\0linux-arm-kernel@lists.infradead.org\0" + "To\0Leizhen (ThunderTown" + " Euler) <thunder.leizhen@huawei.com>\0" + "Cc\0Russell King <linux@arm.linux.org.uk>" + Liujiang (Gerry) <jiang.liu@huawei.com> + Will Deacon <Will.Deacon@arm.com> + linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org> + Huxinwei <huxinwei@huawei.com> + linux-mm@kvack.org <linux-mm@kvack.org> + Lizefan <lizefan@huawei.com> + " linux-arm-kernel@lists.infradead.org <linux-arm-kernel@lists.infradead.org>\0" "\00:1\0" "b\0" "On Thu, Aug 22, 2013 at 05:16:14PM +0100, Catalin Marinas wrote:\n" @@ -11,7 +20,7 @@ "> > This problem is on ARM64. When CONFIG_ARM64_64K_PAGES is not opened, the memory\n" "> > map size can be 2M(section) and 4K(PAGE). First, OS will create map for pgd\n" "> > (level 1 table) and level 2 table which in swapper_pg_dir. Then, OS register\n" - "> > mem block into memblock.memory according to memory node in fdt, like memory at 0,\n" + "> > mem block into memblock.memory according to memory node in fdt, like memory@0,\n" "> > and create map in setup_arch-->paging_init. If all mem block start address and\n" "> > size is integral multiple of 2M, there is no problem, because we will create 2M\n" "> > section size map whose entries locate in level 2 table. But if it is not\n" @@ -112,4 +121,4 @@ " \n" " \t/* Limit no longer required. */" -83d82f2df6030d6a440507e6ffb4b1883df7be9c1791c91ccc00bae619c55b7b +e031378d833f10846d72cdfc83f49c0ff6d9758dc0ef3087ce074b3b21e58763
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.