x86: remove kernel_physical_mapping_init() from init section
authorGary Hade <garyhade@us.ibm.com>
Mon, 19 Jan 2009 21:46:41 +0000 (13:46 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 19 Jan 2009 23:31:43 +0000 (00:31 +0100)
Impact: fix crash with memory hotplug enabled

kernel_physical_mapping_init() is called during memory hotplug
so it does not belong in the init section.

If the kernel is built with CONFIG_DEBUG_SECTION_MISMATCH=y on
the make command line, arch/x86/mm/init_64.c is compiled with
the -fno-inline-functions-called-once gcc option defeating
inlining of kernel_physical_mapping_init() within init_memory_mapping().

When kernel_physical_mapping_init() is not inlined it is placed
in the .init.text section according to the __init in it's current
declaration.  A later call to kernel_physical_mapping_init() during
a memory hotplug operation encounters an int3 trap because the
.init.text section memory has been freed.

This patch eliminates the crash caused by the int3 trap by moving the
non-inlined kernel_physical_mapping_init() from .init.text to .meminit.text.

Signed-off-by: Gary Hade <garyhade@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/init_64.c

index 23f68e77ad1fde95975c5b6e3cf163eb7850f305..e6d36b490250bed6952f2d93de3d1f337c3cf7f4 100644 (file)
@@ -596,7 +596,7 @@ static void __init init_gbpages(void)
                direct_gbpages = 0;
 }
 
-static unsigned long __init kernel_physical_mapping_init(unsigned long start,
+static unsigned long __meminit kernel_physical_mapping_init(unsigned long start,
                                                unsigned long end,
                                                unsigned long page_size_mask)
 {