Re: kernel boot hangs after x86: insert_resorce for lapic addr after e820_reserve_resources

From: Yinghai Lu
Date: Mon May 19 2008 - 22:48:49 EST


On Mon, May 19, 2008 at 6:24 PM, Ciaran McCreesh
<ciaran.mccreesh@xxxxxxxxxxxxxx> wrote:
> On Mon, 19 May 2008 18:22:00 -0700
> "Yinghai Lu" <yhlu.kernel@xxxxxxxxx> wrote:
>> >> could be pci iomem conflicts...
>> >> please enable CONFIG_PCI_DEBUG=y
>> >> and apply the following two debug patches
>> >
>> > dmesg with debugging attached.
>>
>> the iomem allocation seems good...
>>
>> can you send out /proc/iomem?
>
> 00000000-0009ffff : pnp 00:09
> 000f0000-000fffff : pnp 00:09
> 00100000-d7feffff : pnp 00:09
> d7ff0000-d7ffffff : pnp 00:09
> d8000000-dfffffff : PCI Bus 0000:01
> d8000000-dfffffff : 0000:01:05.0
> e0000000-efffffff : PCI MMCONFIG 0
> e0000000-efffffff : pnp 00:08
> fdb00000-fdbfffff : PCI Bus 0000:03
> fdc00000-fdcfffff : PCI Bus 0000:03
> fdcff000-fdcff0ff : 0000:03:05.0
> fdcff000-fdcff0ff : 8139too
> fdd00000-fddfffff : PCI Bus 0000:02
> fdd00000-fdd1ffff : 0000:02:00.0
> fde00000-fdefffff : PCI Bus 0000:02
> fdeff000-fdefffff : 0000:02:00.0
> fdeff000-fdefffff : r8169
> fdf00000-fdffffff : PCI Bus 0000:01
> fdf00000-fdf03fff : 0000:01:05.2
> fdf00000-fdf03fff : ICH HD audio
> fdff0000-fdffffff : 0000:01:05.0
> fe024000-fe027fff : 0000:00:14.2
> fe024000-fe027fff : ICH HD audio
> fe029000-fe0290ff : 0000:00:13.5
> fe029000-fe0290ff : ehci_hcd
> fe02a000-fe02afff : 0000:00:13.4
> fe02a000-fe02afff : ohci_hcd
> fe02b000-fe02bfff : 0000:00:13.3
> fe02b000-fe02bfff : ohci_hcd
> fe02c000-fe02cfff : 0000:00:13.2
> fe02c000-fe02cfff : ohci_hcd
> fe02d000-fe02dfff : 0000:00:13.1
> fe02d000-fe02dfff : ohci_hcd
> fe02e000-fe02efff : 0000:00:13.0
> fe02e000-fe02efff : ohci_hcd
> fe02f000-fe02f3ff : 0000:00:12.0
> fe02f000-fe02f3ff : ahci
> fec00000-fec00fff : IOAPIC 0
> fec00000-fec00fff : pnp 00:09
> fed00000-fed003ff : HPET 0
> fed00000-fed003ff : 0000:00:14.0
> fed00000-fed000ff : pnp 00:09
> fee00000-fee00fff : Local APIC
> fee00000-fee00fff : pnp 00:09
> ffff0000-ffffffff : pnp 00:09
> 100000000-11fffffff : System RAM
> 00200000-005d348d : Kernel code
> 005d348e-00771927 : Kernel data
> 007df000-0085f74f : Kernel bss


seems acpi pnp resource cause some problem....

please try attached patch and send out /proc/mtrr

YH
[PATCH] x86: use request instead of insert resource for e820 - 64bit

to prevent acpi pnp messing it up later with request.
otherwise some system will show
00000000-0009ffff : pnp 00:09
000f0000-000fffff : pnp 00:09
00100000-d7feffff : pnp 00:09
d7ff0000-d7ffffff : pnp 00:09

instead of System RAM...

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

Index: linux-2.6/arch/x86/kernel/e820_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820_64.c
+++ linux-2.6/arch/x86/kernel/e820_64.c
@@ -88,7 +88,7 @@ void __init e820_reserve_resources(void)
res->start = e820.map[i].addr;
res->end = res->start + e820.map[i].size - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
- insert_resource(&iomem_resource, res);
+ request_resource(&iomem_resource, res);
res++;
}
}
Index: linux-2.6/arch/x86/kernel/setup_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup_64.c
+++ linux-2.6/arch/x86/kernel/setup_64.c
@@ -361,11 +361,6 @@ void __init setup_arch(char **cmdline_p)

finish_e820_parsing();

- /* after parse_early_param, so could debug it */
- insert_resource(&iomem_resource, &code_resource);
- insert_resource(&iomem_resource, &data_resource);
- insert_resource(&iomem_resource, &bss_resource);
-
early_gart_iommu_check();

e820_register_active_regions(0, 0, -1UL);
@@ -471,6 +466,11 @@ void __init setup_arch(char **cmdline_p)
}
}
#endif
+ e820_reserve_resources();
+ insert_resource(&iomem_resource, &code_resource);
+ insert_resource(&iomem_resource, &data_resource);
+ insert_resource(&iomem_resource, &bss_resource);
+
reserve_crashkernel();

reserve_ibft_region();
@@ -502,7 +502,6 @@ void __init setup_arch(char **cmdline_p)
/*
* We trust e820 completely. No explicit ROM probing in memory.
*/
- e820_reserve_resources();
e820_mark_nosave_regions();

/* request I/O space for devices used on all i[345]86 PCs */