From c7ab8e1e57e8ffa95f8ffa5bf735714c8929a23b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Sep 2015 22:10:40 -0700 Subject: [PATCH] 4.2-stable patches added patches: mm-check-if-section-present-during-memory-block-registering.patch x86-mm-initialize-pmd_idx-in-page_table_range_init_count.patch --- ...sent-during-memory-block-registering.patch | 86 +++++++++++++++++++ queue-4.2/series | 2 + ...d_idx-in-page_table_range_init_count.patch | 38 ++++++++ 3 files changed, 126 insertions(+) create mode 100644 queue-4.2/mm-check-if-section-present-during-memory-block-registering.patch create mode 100644 queue-4.2/x86-mm-initialize-pmd_idx-in-page_table_range_init_count.patch diff --git a/queue-4.2/mm-check-if-section-present-during-memory-block-registering.patch b/queue-4.2/mm-check-if-section-present-during-memory-block-registering.patch new file mode 100644 index 00000000000..bb9af661eb3 --- /dev/null +++ b/queue-4.2/mm-check-if-section-present-during-memory-block-registering.patch @@ -0,0 +1,86 @@ +From 04697858d89e4bf2650364f8d6956e2554e8ef88 Mon Sep 17 00:00:00 2001 +From: Yinghai Lu +Date: Fri, 4 Sep 2015 15:42:39 -0700 +Subject: mm: check if section present during memory block registering + +From: Yinghai Lu + +commit 04697858d89e4bf2650364f8d6956e2554e8ef88 upstream. + +Tony Luck found on his setup, if memory block size 512M will cause crash +during booting. + + BUG: unable to handle kernel paging request at ffffea0074000020 + IP: get_nid_for_pfn+0x17/0x40 + PGD 128ffcb067 PUD 128ffc9067 PMD 0 + Oops: 0000 [#1] SMP + Modules linked in: + CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc8 #1 + ... + Call Trace: + ? register_mem_sect_under_node+0x66/0xe0 + register_one_node+0x17b/0x240 + ? pci_iommu_alloc+0x6e/0x6e + topology_init+0x3c/0x95 + do_one_initcall+0xcd/0x1f0 + +The system has non continuous RAM address: + BIOS-e820: [mem 0x0000001300000000-0x0000001cffffffff] usable + BIOS-e820: [mem 0x0000001d70000000-0x0000001ec7ffefff] usable + BIOS-e820: [mem 0x0000001f00000000-0x0000002bffffffff] usable + BIOS-e820: [mem 0x0000002c18000000-0x0000002d6fffefff] usable + BIOS-e820: [mem 0x0000002e00000000-0x00000039ffffffff] usable + +So there are start sections in memory block not present. For example: + + memory block : [0x2c18000000, 0x2c20000000) 512M + +first three sections are not present. + +The current register_mem_sect_under_node() assume first section is +present, but memory block section number range [start_section_nr, +end_section_nr] would include not present section. + +For arch that support vmemmap, we don't setup memmap for struct page +area within not present sections area. + +So skip the pfn range that belong to absent section. + +[akpm@linux-foundation.org: simplification] +[rientjes@google.com: more simplification] +Fixes: bdee237c0343 ("x86: mm: Use 2GB memory block size on large memory x86-64 systems") +Fixes: 982792c782ef ("x86, mm: probe memory block size for generic x86 64bit") +Signed-off-by: Yinghai Lu +Signed-off-by: David Rientjes +Reported-by: Tony Luck +Tested-by: Tony Luck +Cc: Greg KH +Cc: Ingo Molnar +Tested-by: David Rientjes +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/node.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/base/node.c ++++ b/drivers/base/node.c +@@ -392,6 +392,16 @@ int register_mem_sect_under_node(struct + for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { + int page_nid; + ++ /* ++ * memory block could have several absent sections from start. ++ * skip pfn range from absent section ++ */ ++ if (!pfn_present(pfn)) { ++ pfn = round_down(pfn + PAGES_PER_SECTION, ++ PAGES_PER_SECTION) - 1; ++ continue; ++ } ++ + page_nid = get_nid_for_pfn(pfn); + if (page_nid < 0) + continue; diff --git a/queue-4.2/series b/queue-4.2/series index b4d015de83c..47b5892e3aa 100644 --- a/queue-4.2/series +++ b/queue-4.2/series @@ -59,3 +59,5 @@ powerpc-boot-specify-abi-v2-when-building-an-le-boot-wrapper.patch powerpc-mm-recompute-hash-value-after-a-failed-update.patch cifs-fix-type-confusion-in-copy-offload-ioctl.patch add-radeon-suspend-resume-quirk-for-hp-compaq-dc5750.patch +mm-check-if-section-present-during-memory-block-registering.patch +x86-mm-initialize-pmd_idx-in-page_table_range_init_count.patch diff --git a/queue-4.2/x86-mm-initialize-pmd_idx-in-page_table_range_init_count.patch b/queue-4.2/x86-mm-initialize-pmd_idx-in-page_table_range_init_count.patch new file mode 100644 index 00000000000..d2c77975454 --- /dev/null +++ b/queue-4.2/x86-mm-initialize-pmd_idx-in-page_table_range_init_count.patch @@ -0,0 +1,38 @@ +From 9962eea9e55f797f05f20ba6448929cab2a9f018 Mon Sep 17 00:00:00 2001 +From: Minfei Huang +Date: Sun, 12 Jul 2015 20:18:42 +0800 +Subject: x86/mm: Initialize pmd_idx in page_table_range_init_count() + +From: Minfei Huang + +commit 9962eea9e55f797f05f20ba6448929cab2a9f018 upstream. + +The variable pmd_idx is not initialized for the first iteration of the +for loop. + +Assign the proper value which indexes the start address. + +Fixes: 719272c45b82 'x86, mm: only call early_ioremap_page_table_range_init() once' +Signed-off-by: Minfei Huang +Cc: tony.luck@intel.com +Cc: wangnan0@huawei.com +Cc: david.vrabel@citrix.com +Reviewed-by: yinghai@kernel.org +Link: http://lkml.kernel.org/r/1436703522-29552-1-git-send-email-mhuang@redhat.com +Signed-off-by: Thomas Gleixner +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/mm/init_32.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/x86/mm/init_32.c ++++ b/arch/x86/mm/init_32.c +@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned lon + + vaddr = start; + pgd_idx = pgd_index(vaddr); ++ pmd_idx = pmd_index(vaddr); + + for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) { + for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end); -- 2.47.2