All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] x86: fix the initialization of physnode_map
@ 2014-02-01 12:30 Petr Tesarik
  2014-02-01 23:46 ` David Rientjes
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Petr Tesarik @ 2014-02-01 12:30 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86
  Cc: Jiang Liu, Andrew Morton, Dave Hansen, linux-kernel

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.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
 arch/x86/mm/numa_32.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 0342d27..8c62ec6 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned long start, unsigned long end)
 			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);
-- 
1.8.4.5

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv2] x86: fix the initialization of physnode_map
  2014-02-01 12:30 [PATCHv2] x86: fix the initialization of physnode_map Petr Tesarik
@ 2014-02-01 23:46 ` David Rientjes
  2014-02-02  6:00 ` [tip:x86/urgent] x86: Fix " tip-bot for Petr Tesarik
  2014-02-02  6:18 ` tip-bot for Petr Tesarik
  2 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2014-02-01 23:46 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Jiang Liu,
	Andrew Morton, Dave Hansen, linux-kernel

On Sat, 1 Feb 2014, Petr Tesarik wrote:

> 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.
> 
> Signed-off-by: Petr Tesarik <ptesarik@suse.cz>

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:x86/urgent] x86: Fix the initialization of physnode_map
  2014-02-01 12:30 [PATCHv2] x86: fix the initialization of physnode_map Petr Tesarik
  2014-02-01 23:46 ` David Rientjes
@ 2014-02-02  6:00 ` tip-bot for Petr Tesarik
  2014-02-02  6:18 ` tip-bot for Petr Tesarik
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Petr Tesarik @ 2014-02-02  6:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, ptesarik, tglx, rientjes

Commit-ID:  170750c108bb9382f32a2a99d097aa07d551a89e
Gitweb:     http://git.kernel.org/tip/170750c108bb9382f32a2a99d097aa07d551a89e
Author:     Petr Tesarik <ptesarik@suse.cz>
AuthorDate: Sat, 1 Feb 2014 13:30:19 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 1 Feb 2014 21:57:48 -0800

x86: 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.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Link: http://lkml.kernel.org/r/20140201133019.32e56f86@hananiah.suse.cz
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/mm/numa_32.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 0342d27..8c62ec6 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned long start, unsigned long end)
 			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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:x86/urgent] x86: Fix the initialization of physnode_map
  2014-02-01 12:30 [PATCHv2] x86: fix the initialization of physnode_map Petr Tesarik
  2014-02-01 23:46 ` David Rientjes
  2014-02-02  6:00 ` [tip:x86/urgent] x86: Fix " tip-bot for Petr Tesarik
@ 2014-02-02  6:18 ` tip-bot for Petr Tesarik
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Petr Tesarik @ 2014-02-02  6:18 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, ptesarik, tglx, rientjes

Commit-ID:  85fc73a2cdf10cf42bc36fb3bca3896b2095a1c2
Gitweb:     http://git.kernel.org/tip/85fc73a2cdf10cf42bc36fb3bca3896b2095a1c2
Author:     Petr Tesarik <ptesarik@suse.cz>
AuthorDate: Sat, 1 Feb 2014 13:30:19 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Sat, 1 Feb 2014 22:15:51 -0800

x86: 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.

[ hpa: fixed incorrect use of "pfn" instead of "start" ]

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
Link: http://lkml.kernel.org/r/20140201133019.32e56f86@hananiah.suse.cz
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/mm/numa_32.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 0342d27..47b6436 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned long start, unsigned long end)
 			nid, start, end);
 	printk(KERN_DEBUG "  Setting physnode_map array to node %d for pfns:\n", nid);
 	printk(KERN_DEBUG "  ");
+	start = round_down(start, 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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-02  6:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-01 12:30 [PATCHv2] x86: fix the initialization of physnode_map Petr Tesarik
2014-02-01 23:46 ` David Rientjes
2014-02-02  6:00 ` [tip:x86/urgent] x86: Fix " tip-bot for Petr Tesarik
2014-02-02  6:18 ` tip-bot for Petr Tesarik

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.