Skip to contentSkip to conversation

+ arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map.patch added to -mm tree

PATCH [email protected] 2 participants 2 messages Feb 3, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Subject: + arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map.patch added to -mm tree
To: [email protected]
From: [email protected]
Date: Mon, 03 Feb 2014 14:47:39 -0800

The patch titled
Subject: arch/x86/mm/numa_32.c: fix the initialization of physnode_map
has been added to the -mm tree. Its filename is
arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Petr Tesarik <[email protected]>
Subject: arch/x86/mm/numa_32.c: fix the initialization of physnode_map

With DISCONTIGMEM, the mapping between a pfn and its owning node is initialized using data provided by the BIOS. However, the initialization may fail if the extents are not aligned to section boundary (64M).

The symptom of this bug is an early boot failure in pfn_to_page(), as it tries to access NODE_DATA(__nid) using index from an unitialized element of the physnode_map[] array.

While the bug is always present, it is more likely to be hit in kdump kernels on large machines, because:

1. The memory map for a kdump kernel is specified as exactmap, and exactmap is more likely to be unaligned.

2. Large reservations are more likely to span across a 64M boundary.

---

 arch/x86/mm/numa_32.c |    2 ++
 1 file changed, 2 insertions(+)
arch/x86/mm/numa_32.c renamed from arch/x86/mm/numa_32.c~arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map +2 -0
diff -puN arch/x86/mm/numa_32.c~arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map arch/x86/mm/numa_32.c
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned lo
 			nid, start, end);
 	printk(KERN_DEBUG "  Setting physnode_map array to node %d for pfns:\n", nid);
 	printk(KERN_DEBUG "  ");
+	pfn = round_down(pfn, PAGES_PER_SECTION);
+	end = round_up(end, PAGES_PER_SECTION);
 	for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
 		physnode_map[pfn / PAGES_PER_SECTION] = nid;
 		printk(KERN_CONT "%lx ", pfn);

_

Patches currently in -mm which might be from [email protected] are

arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map.patch linux-next.patch

#1 lore raw
Quoted 30 lines · On Mon, 3 Feb 2014, [email protected] wrote:

From: Petr Tesarik <[email protected]>
Subject: arch/x86/mm/numa_32.c: fix the initialization of physnode_map

With DISCONTIGMEM, the mapping between a pfn and its owning node is initialized using data provided by the BIOS. However, the initialization may fail if the extents are not aligned to section boundary (64M).

The symptom of this bug is an early boot failure in pfn_to_page(), as it tries to access NODE_DATA(__nid) using index from an unitialized element of the physnode_map[] array.

While the bug is always present, it is more likely to be hit in kdump kernels on large machines, because:

1. The memory map for a kdump kernel is specified as exactmap, and exactmap is more likely to be unaligned.

2. Large reservations are more likely to span across a 64M boundary.

---

 arch/x86/mm/numa_32.c |    2 ++
 1 file changed, 2 insertions(+)

diff -puN arch/x86/mm/numa_32.c~arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map arch/x86/mm/numa_32.c

arch/x86/mm/numa_32.c void memory_present(int nid, unsigned lo · line 59

Quoted 8 lines
arch/x86/mm/numa_32.c renamed from arch/x86/mm/numa_32.c~arch-x86-mm-numa_32c-fix-the-initialization-of-physnode_map +2 -0
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned lo
 			nid, start, end);
 	printk(KERN_DEBUG "  Setting physnode_map array to node %d for pfns:\n", nid);
 	printk(KERN_DEBUG "  ");
+	pfn = round_down(pfn, PAGES_PER_SECTION);
+	end = round_up(end, PAGES_PER_SECTION);
 	for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
 		physnode_map[pfn / PAGES_PER_SECTION] = nid;
 		printk(KERN_CONT "%lx ", pfn);

This is the buggy version of the patch which erroneously rounds down the uninitialized "pfn" rather than "start". hpa has already merged the corrected patch into x86/urgent.