public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: 32bit numa srat fix early_ioremap leak
Date: Thu, 29 May 2008 16:25:56 -0700	[thread overview]
Message-ID: <200805291625.56942.yhlu.kernel@gmail.com> (raw)
In-Reply-To: <200805251000.10205.yhlu.kernel@gmail.com>


on two node system (16g RAM) with numa config got

get_memcfg_from_srat: assigning address to rsdp
RSD PTR  v0 [ACPIAM]
ACPI: Too big length in RSDT: 92
failed to get NUMA memory information from SRAT table
NUMA - single node, flat memory mode
Node: 0, start_pfn: 0, end_pfn: 153
 Setting physnode_map array to node 0 for pfns:
 0
...
Pid: 0, comm: swapper Not tainted 2.6.26-rc4 #4
 [<80b41289>] hlt_loop+0x0/0x3
 [<8011efa0>] ? alloc_remap+0x50/0x70
 [<8079e32e>] alloc_node_mem_map+0x5e/0xa0
 [<8012e77b>] ? printk+0x1b/0x20
 [<80b590f6>] free_area_init_node+0xc6/0x470
 [<80b588fc>] ? __alloc_bootmem_node+0x2c/0x50
 [<80b58ad8>] ? find_min_pfn_for_node+0x38/0x70
 [<8012e77b>] ? printk+0x1b/0x20
 [<80b597c4>] free_area_init_nodes+0x254/0x2d0
 [<80b544d7>] zone_sizes_init+0x97/0xa0
 [<80b48a03>] setup_arch+0x383/0x530
 [<8012e77b>] ? printk+0x1b/0x20
 [<80b41aa4>] start_kernel+0x64/0x350
 [<80b412d8>] i386_start_kernel+0x8/0x10
 =======================

this patch increase the acpi table limit to 32
match early_ioremap with early_iounmap

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

diff --git a/arch/x86/kernel/srat_32.c b/arch/x86/kernel/srat_32.c
index 70e4a37..88971ee 100644
--- a/arch/x86/kernel/srat_32.c
+++ b/arch/x86/kernel/srat_32.c
@@ -261,7 +261,7 @@ out_fail:
 
 struct acpi_static_rsdt {
 	struct acpi_table_rsdt table;
-	u32 padding[7]; /* Allow for 7 more table entries */
+	u32 padding[32]; /* Allow for 32 more table entries */
 };
 
 int __init get_memcfg_from_srat(void)
@@ -297,7 +297,7 @@ int __init get_memcfg_from_srat(void)
 	}
 
 	rsdt = (struct acpi_table_rsdt *)
-	    early_ioremap(rsdp->rsdt_physical_address, sizeof(struct acpi_table_rsdt));
+	    early_ioremap(rsdp->rsdt_physical_address, sizeof(saved_rsdt));
 
 	if (!rsdt) {
 		printk(KERN_WARNING
@@ -310,6 +310,7 @@ int __init get_memcfg_from_srat(void)
 
 	if (strncmp(header->signature, ACPI_SIG_RSDT, strlen(ACPI_SIG_RSDT))) {
 		printk(KERN_WARNING "ACPI: RSDT signature incorrect\n");
+		early_iounmap(rsdt, sizeof(saved_rsdt));
 		goto out_err;
 	}
 
@@ -319,37 +320,51 @@ int __init get_memcfg_from_srat(void)
 	 * size of RSDT) divided by the size of each entry
 	 * (4-byte table pointers).
 	 */
-	tables = (header->length - sizeof(struct acpi_table_header)) / 4;
+	tables = (header->length - sizeof(struct acpi_table_header)) / sizeof(u32);
 
 	if (!tables)
 		goto out_err;
 
 	memcpy(&saved_rsdt, rsdt, sizeof(saved_rsdt));
-
+	early_iounmap(rsdt, sizeof(saved_rsdt));
 	if (saved_rsdt.table.header.length > sizeof(saved_rsdt)) {
 		printk(KERN_WARNING "ACPI: Too big length in RSDT: %d\n",
 		       saved_rsdt.table.header.length);
 		goto out_err;
 	}
 
-	printk("Begin SRAT table scan....\n");
+	printk("Begin SRAT table scan....%d\n", tables);
 
-	for (i = 0; i < tables; i++) {
+	for (i = 0; i < tables; i++){
+		int result;
+		u32 length;
 		/* Map in header, then map in full table length. */
 		header = (struct acpi_table_header *)
 			early_ioremap(saved_rsdt.table.table_offset_entry[i], sizeof(struct acpi_table_header));
 		if (!header)
 			break;
+
+                printk(KERN_INFO "ACPI: %4.4s %08lX, %04X\n",
+                           header->signature,
+		   (unsigned long)saved_rsdt.table.table_offset_entry[i],
+                           header->length);
+
+		if (strncmp((char *) &header->signature, ACPI_SIG_SRAT, 4)) {
+			early_iounmap(header, sizeof(struct acpi_table_header));
+			continue;
+		}
+
+		length = header->length;
+		early_iounmap(header, sizeof(struct acpi_table_header));
 		header = (struct acpi_table_header *)
-			early_ioremap(saved_rsdt.table.table_offset_entry[i], header->length);
+			early_ioremap(saved_rsdt.table.table_offset_entry[i], length);
 		if (!header)
 			break;
 
-		if (strncmp((char *) &header->signature, ACPI_SIG_SRAT, 4))
-			continue;
-
 		/* we've found the srat table. don't need to look at any more tables */
-		return acpi20_parse_srat((struct acpi_table_srat *)header);
+		result = acpi20_parse_srat((struct acpi_table_srat *)header);
+		early_iounmap(header, length);
+		return result;
 	}
 out_err:
 	remove_all_active_ranges();

  parent reply	other threads:[~2008-05-29 23:26 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-11  7:30 [PATCH] x86: make e820.c to have common functions Yinghai Lu
2008-05-13 13:05 ` Ingo Molnar
2008-05-13 17:35   ` Yinghai Lu
2008-05-18  8:18 ` [PATCH] x86: extend e820 ealy_res support 32bit Yinghai Lu
2008-05-21  3:10   ` [PATCH] x86: move e820_mark_nosave_regions to e820.c Yinghai Lu
2008-05-22  1:40   ` [PATCH] x86: extend e820 ealy_res support 32bit - fix Yinghai Lu
2008-05-22 10:12     ` Jeremy Fitzhardinge
2008-05-22 17:58       ` Yinghai Lu
2008-05-22 22:20     ` [PATCH] x86: extend e820 ealy_res support 32bit - fix v2 Yinghai Lu
2008-05-23 23:08       ` Yinghai Lu
2008-05-23 23:32         ` Jeremy Fitzhardinge
2008-05-23 23:38         ` Jeremy Fitzhardinge
2008-05-24  0:01           ` Yinghai Lu
2008-05-24  0:09             ` Yinghai Lu
2008-05-24  8:54       ` Jeremy Fitzhardinge
2008-05-24  9:49         ` [PATCH] xen: boot via i386_start_kernel to get early reservations Jeremy Fitzhardinge
2008-05-24 22:04           ` Yinghai Lu
2008-05-24 19:57         ` [PATCH] x86: extend e820 ealy_res support 32bit - fix v2 Yinghai Lu
2008-05-25 17:00     ` [PATCH] x86: extend e820 ealy_res support 32bit - fix #2 Yinghai Lu
2008-05-27 15:44       ` Thomas Gleixner
2008-05-27 20:37         ` Jeremy Fitzhardinge
2008-05-27 20:58           ` Thomas Gleixner
2008-05-27 21:06             ` Jeremy Fitzhardinge
2008-05-27 21:06           ` Yinghai Lu
2008-05-27 21:22             ` Jeremy Fitzhardinge
2008-05-27 21:35               ` Yinghai Lu
2008-05-27 21:47                 ` Jeremy Fitzhardinge
2008-05-27 22:52                   ` Yinghai Lu
2008-05-28 10:01                     ` Jeremy Fitzhardinge
2008-05-28 20:48                       ` Yinghai Lu
2008-05-28 21:24                         ` Jeremy Fitzhardinge
2008-05-29 13:37                         ` Jeremy Fitzhardinge
2008-05-29 18:41                           ` Yinghai Lu
2008-05-29 18:58                             ` H. Peter Anvin
2008-05-29 18:52                           ` Yinghai Lu
2008-05-29 19:14                             ` Yinghai Lu
2008-05-30 15:50                               ` Jeremy Fitzhardinge
2008-05-29 19:56       ` [PATCH] x86: extend e820 early_res support 32bit -fix #3 Yinghai Lu
2008-05-29 19:57       ` [PATCH] x86: extend e820 early_res support 32bit -fix #4 Yinghai Lu
2008-05-29 19:58       ` [PATCH] x86: extend e820 early_res support 32bit -fix #5 Yinghai Lu
2008-05-29 23:25       ` Yinghai Lu [this message]
2008-05-31  8:01         ` [PATCH] x86: 32bit numa srat fix early_ioremap leak Ingo Molnar
2008-06-01  5:51         ` [PATCH] x86: 32bit numa increase max_elements to 1024 Yinghai Lu
2008-06-01  5:52           ` [PATCH] x86: change propagate_e820_map back to find_max_pfn -32bit Yinghai Lu
2008-06-01  5:53             ` [PATCH] x86: set node_remap_size[0] in fallback path Yinghai Lu
2008-06-01  5:56               ` [PATCH] x86: numa_32 print out debug info all kva Yinghai Lu
2008-06-01 20:15                 ` [PATCH] x86: numa_32 print out debug info all kva v2 Yinghai Lu
2008-06-03  2:16             ` [PATCH] x86: change propagate_e820_map back to find_max_pfn -32bit -v2 Yinghai Lu
2008-06-02  4:06         ` [PATCH] x86: numa_32 avoid clash between ramdisk and kva Yinghai Lu
2008-06-02  6:53           ` [PATCH] x86: cleanup max_pfn_mapped usage - 32bit Yinghai Lu
2008-06-02  6:55           ` [PATCH] x86: cleanup max_pfn_mapped usage - 64bit Yinghai Lu

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=200805291625.56942.yhlu.kernel@gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox