From: Adrian Bunk <bunk@stusta.de>
To: Linus Torvalds <torvalds@osdl.org>, ak@suse.de
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
discuss@x86-64.org
Subject: [2.6.15-rc7 patch] Reject SRAT tables that don't cover all memory
Date: Thu, 29 Dec 2005 14:39:02 +0100 [thread overview]
Message-ID: <20051229133902.GD3811@stusta.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0512241930370.14098@g5.osdl.org>
Below is a patch by Andi Kleen from kernel Bugzilla #5758 fixing a
post-2.6.14 regression.
cu
Adrian
<-- snip -->
Reject SRAT tables that don't cover all memory
Broken BIOS on Iwill reports these and it causes the bootmem
allocator to crash. Add a sanity check if all the PXMs in the
SRAT table cover all memory as reported by e820.
This patch fixes kernel Bugzilla #5758.
From: Andi Kleen <ak@suse.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux.orig/arch/x86_64/mm/srat.c
+++ linux/arch/x86_64/mm/srat.c
@@ -17,6 +17,7 @@
#include <linux/topology.h>
#include <asm/proto.h>
#include <asm/numa.h>
+#include <asm/e820.h>
static struct acpi_table_slit *acpi_slit;
@@ -196,12 +197,39 @@ acpi_numa_memory_affinity_init(struct ac
nd->start, nd->end);
}
+/* Sanity check to catch more bad SRATs (they are amazingly common).
+ Make sure the PXMs cover all memory. */
+static int nodes_cover_memory(void)
+{
+ int i;
+ unsigned long pxmram, e820ram;
+
+ pxmram = 0;
+ for_each_node_mask(i, nodes_parsed) {
+ unsigned long s = nodes[i].start >> PAGE_SHIFT;
+ unsigned long e = nodes[i].end >> PAGE_SHIFT;
+ pxmram += e - s;
+ pxmram -= e820_hole_size(s, e);
+ }
+
+ e820ram = end_pfn - e820_hole_size(0, end_pfn);
+ if (pxmram < e820ram) {
+ printk(KERN_ERR
+ "SRAT: PXMs only cover %luMB of your %luMB e820 RAM. Not used.\n",
+ (pxmram << PAGE_SHIFT) >> 20,
+ (e820ram << PAGE_SHIFT) >> 20);
+ return 0;
+ }
+ return 1;
+}
+
void __init acpi_numa_arch_fixup(void) {}
/* Use the information discovered above to actually set up the nodes. */
int __init acpi_scan_nodes(unsigned long start, unsigned long end)
{
int i;
+
if (acpi_numa <= 0)
return -1;
@@ -212,6 +240,11 @@ int __init acpi_scan_nodes(unsigned long
node_clear(i, nodes_parsed);
}
+ if (!nodes_cover_memory()) {
+ bad_srat();
+ return -1;
+ }
+
memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed));
if (memnode_shift < 0) {
printk(KERN_ERR
next prev parent reply other threads:[~2005-12-29 13:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-25 3:39 Ho ho ho.. Linux 2.6.15-rc7 Linus Torvalds
2005-12-25 5:00 ` Keith Owens
2005-12-26 5:23 ` Grant Coady
2005-12-26 13:54 ` Kalin KOZHUHAROV
2005-12-28 9:11 ` Paul Rolland
2005-12-26 18:02 ` Mark Knecht
2005-12-26 18:14 ` Lee Revell
2005-12-27 2:49 ` Mark Knecht
2005-12-27 5:56 ` Michael Krufky
2005-12-27 13:23 ` James Courtier-Dutton
2005-12-27 17:53 ` Michael Krufky
2005-12-26 18:50 ` Markus Koßmann
2005-12-26 23:24 ` Mauro Carvalho Chehab
2005-12-27 5:47 ` Michael Krufky
2005-12-27 12:43 ` [uml-devel] " Pekka Enberg
2005-12-27 12:43 ` Pekka Enberg
2005-12-29 13:39 ` Adrian Bunk [this message]
2005-12-29 16:07 ` [2.6.15-rc7 patch] Reject SRAT tables that don't cover all memory Andi Kleen
2005-12-29 16:20 ` Adrian Bunk
2005-12-29 16:23 ` Andi Kleen
2006-01-02 16:46 ` 2.6.15-rc7: known regressions Adrian Bunk
2006-01-02 16:46 ` Adrian Bunk
2006-01-02 17:07 ` Andi Kleen
2006-01-02 17:23 ` Adrian Bunk
2006-01-02 17:38 ` Andi Kleen
2006-01-02 18:30 ` Ochal Christophe
2006-01-02 18:57 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051229133902.GD3811@stusta.de \
--to=bunk@stusta.de \
--cc=ak@suse.de \
--cc=discuss@x86-64.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.