Re: [Bug 41722] Clevo M5X0JE hangs in ACPI init

From: Yinghai Lu
Date: Tue Jan 24 2012 - 19:19:21 EST


2012/1/24 Rogério Brito <rbrito@xxxxxxxxxx>:
>> it seems not related. or could be ioremap etc have problem?
>>
>> So can you try to boot with nopat?
>
> I have experimented with Linux 3.3.0-rc1-00080-g16111ea, which is a merge of:
>
> * yinghai's usb_smi_disable_early branch with HEAD = a3a6c096
> * linus's master branch with HEAD = 4a7cbb56
>
> I have booted the kernel as above, configured, as Yinghai asked, with
> OHCI disabled, but no other changes from the previous times.  I
> registered in video two boots with only a slight change in options
> passed to the kernel, with:
>
> 1 - http://youtu.be/fKYubKaNhuc being with options
>    `acpi=off pnpbios=off noapic debug ignore_loglevel pci=earlydump
> boot_delay=10`
>
> 2 - http://youtu.be/Gll9RLfXS_c being with options
>    `acpi=off pnpbios=off noapic debug ignore_loglevel pci=earlydump
> nopat boot_delay=10`
>
> The only change is the `nopat` option, as suggested by Yinghai.
>
> As you can see in the two videos, some things seem to have progressed:
> the kernel actually gets to boot, gets to mount/load the initramfs,
> passes things to init and, when it is loading things, I get a hang
> with a messed screen, as before.

Your bios does not have RAM page aligned...

[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009dc00 (usable)
[ 0.000000] BIOS-e820: 000000000009dc00 - 00000000000a0000 (reserved)

assume that partial page is used SMI. let's leave the whole page alone for SMI

Can you please apply attached patch about e820 ram page alignement?

Thanks

Yinghai
Subject: [PATCH] x86: Align e820 ram range to page

Some bios provided e820 ram entries are not page aligned.

To make later processing simple. We could round up those range to
to page aligned.

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

---
arch/x86/kernel/e820.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -880,6 +880,47 @@ static int __init parse_memmap_opt(char
}
early_param("memmap", parse_memmap_opt);

+static void __init e820_align_ram_page(void)
+{
+ int i;
+ bool changed = false;;
+
+ for (i = 0; i < e820.nr_map; i++) {
+ struct e820entry *entry = &e820.map[i];
+ u64 start, end;
+ u64 start_aligned, end_aligned;
+
+ if (entry->type != E820_RAM)
+ continue;
+
+ start = entry->addr;
+ end = start + entry->size;
+
+ start_aligned = round_up(start, PAGE_SIZE);
+ end_aligned = round_down(end, PAGE_SIZE);
+
+ if (end_aligned <= start_aligned) {
+ e820_update_range(start, end - start, E820_RAM, E820_RESERVED);
+ changed = true;
+ continue;
+ }
+ if (start < start_aligned) {
+ e820_update_range(start, start_aligned - start, E820_RAM, E820_RESERVED);
+ changed = true;
+ }
+ if (end_aligned < end) {
+ e820_update_range(end_aligned, end - end_aligned, E820_RAM, E820_RESERVED);
+ changed = true;
+ }
+ }
+
+ if (changed) {
+ sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+ printk(KERN_INFO "aligned physical RAM map:\n");
+ e820_print_map("aligned");
+ }
+}
+
void __init finish_e820_parsing(void)
{
if (userdef) {
@@ -892,6 +933,9 @@ void __init finish_e820_parsing(void)
printk(KERN_INFO "user-defined physical RAM map:\n");
e820_print_map("user");
}
+
+ /* In case, We have RAM entres that are not PAGE aligned */
+ e820_align_ram_page();
}

static inline const char *e820_type_to_string(int e820_type)