Re: MPTable can not be high-memory on Linux

From: Yinghai Lu
Date: Mon Feb 23 2009 - 01:16:19 EST


Ingo Molnar wrote:
> * Kevin O'Connor <kevin@xxxxxxxxxxxx> wrote:
>
>> On Sun, Feb 22, 2009 at 01:33:35PM -0800, Yinghai Lu wrote:
>> [...]
>>>>>> BIOS-e820: 0000000000090000 - 0000000000100000 (reserved)
>>>>>> BIOS-e820: 0000000000100000 - 000000003f7f0000 (usable)
>>>>>> BIOS-e820: 000000003f7f0000 - 0000000040000000 (reserved)
>> [...]
>>>>>> found SMP MP-table at [c00f9fc0] 000f9fc0
>> [...]
>>> that should work for a long time.
>>>
>>> 0xf9fc0 < 1M is quite < max_low_pfn, so wonder why bootmem could panic.
>> On this machine the mptable "floating" structure is at
>> 0xf9fc0. It points to the rest of the table which is in the
>> 0x3f7f0000 area.
>>
>> Note, that this is on a Coreboot+SeaBIOS machine - so we can
>> change the bios. However, the mptable spec does allow for
>> part of the table to be high memory.
>
> yes, and i'd prefer if it worked fine even if it's that high.
>

please check

[PATCH] x86: check physptr with max_low_pfn on 32bit

Impact: fix bug

coreboot aka LinuxBIOS try to put mptable on somewhere much high than
max_low_pfn, it cause panic

so need to check physptr with max_low_pfn * PAGE_SIZE.

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
arch/x86/kernel/mpparse.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -710,13 +710,22 @@ static int __init smp_scan_config(unsign
* of physical memory; so that simply reserving
* PAGE_SIZE from mpf->physptr yields BUG()
* in reserve_bootmem.
+ * also need to make sure physptr is below than
+ * max_low_pfn
+ * we don't need reserve the area above max_low_pfn
*/
unsigned long end = max_low_pfn * PAGE_SIZE;
- if (mpf->physptr + size > end)
- size = end - mpf->physptr;
-#endif
+
+ if (mpf->physptr < end) {
+ if (mpf->physptr + size > end)
+ size = end - mpf->physptr;
+ reserve_bootmem_generic(mpf->physptr, size,
+ BOOTMEM_DEFAULT);
+ }
+#else
reserve_bootmem_generic(mpf->physptr, size,
BOOTMEM_DEFAULT);
+#endif
}

return 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/