x86: fix 2 section mismatch warnings - find_and_reserve_crashkernel
PATCH 1/1 x86: fix 2 section mismatch warnings - find_and_reserve_crashkernel
WARNING: vmlinux.o(.text+0xcd1f): Section mismatch in reference from the function find_and_reserve_crashkernel() to the function .init.text:find_e820_area() The function find_and_reserve_crashkernel() references
the function __init find_e820_area().
This is often because find_and_reserve_crashkernel lacks a __init
annotation or the annotation of find_e820_area is wrong.
WARNING: vmlinux.o(.text+0xcd38): Section mismatch in reference from the function find_and_reserve_crashkernel() to the function .init.text:reserve_bootmem_generic() The function find_and_reserve_crashkernel() references
the function __init reserve_bootmem_generic().
This is often because find_and_reserve_crashkernel lacks a __init
annotation or the annotation of reserve_bootmem_generic is wrong.
find_and_reserve_crashkernel is called from __init function (reserve_crashkernel) and calls 2 __init functions (find_e820_area, reserve_bootmem_generic), so mark it __init
--- arch/x86/kernel/setup.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/setup.c +1 -1
@@ -445,7 +445,7 @@ static void __init reserve_early_setup_data(void)* @size: Size of the crashkernel memory to reserve. * Returns the base address on success, and -1ULL on failure. */ -unsigned long long find_and_reserve_crashkernel (unsigned long long size) +unsigned long long __init find_and_reserve_crashkernel (unsigned long long size) {const unsigned long long alignment =16 <<20 ;/* 16M */ unsigned long long start =0LL ;
Signature · 1 line
1.5.4.5
Ingo Molnar
Appliedapplied these fixes of yours to tip/x86/urgent:
# f0b0d88: x86: fix 2 section mismatch warnings - find_and_reserve_crashkernel # 844342a: x86: fix section mismatch warning - spp_getpage()
# c9d08f0: x86: fix 2 section mismatch warnings - map_high()
thanks Marcin.
Ingo
Quoted 1 line · Ingo Molnar
# 844342a: x86: fix section mismatch warning -
spp_getpage()
i've reverted this one as it's wrong and can cause crashes. For example native_set_fixmap() gets called on 32-bit kernels from the ELF loader, via arch_setup_additional_pages().
Ingo
Quoted 8 lines · Ingo Molnar
Quoted 1 line · Ingo Molnar
# 844342a: x86: fix section mismatch warning -
spp_getpage()i've reverted this one as it's wrong and can cause crashes. For example
native_set_fixmap()gets called on 32-bit kernels from the ELF loader, viaarch_setup_additional_pages().
$ git grep arch_setup_additional_pages | cat arch/powerpc/include/asm/elf.h:/* vDSO has arch_setup_additional_pages */ arch/powerpc/include/asm/elf.h:extern int arch_setup_additional_pages(struct linux_binprm *bprm, arch/powerpc/kernel/vdso.c:int arch_setup_additional_pages(struct linux_binprm *bprm, arch/sh/include/asm/elf.h:/* vDSO has arch_setup_additional_pages */ arch/sh/include/asm/elf.h:extern int arch_setup_additional_pages(struct linux_binprm *bprm, arch/sh/kernel/vsyscall/vsyscall.c:int arch_setup_additional_pages(struct linux_binprm *bprm, arch/x86/vdso/vdso32-setup.c:#define arch_setup_additional_pages syscall32_setup_pages arch/x86/vdso/vdso32-setup.c:int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) arch/x86/vdso/vma.c:int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack) fs/binfmt_elf.c: retval = arch_setup_additional_pages(bprm, executable_stack); fs/compat_binfmt_elf.c:#ifdef compat_arch_setup_additional_pages fs/compat_binfmt_elf.c:#undef arch_setup_additional_pages fs/compat_binfmt_elf.c:#define arch_setup_additional_pages compat_arch_setup_additional_pages include/asm-x86/elf.h:extern int arch_setup_additional_pages(struct linux_binprm *bprm, include/asm-x86/elf.h:#define compat_arch_setup_additional_pages syscall32_setup_pages
$ git grep native_set_fixmap | cat arch/x86/kernel/paravirt.c: .set_fixmap = native_set_fixmap, arch/x86/mm/pgtable.c:void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) arch/x86/mm/pgtable.c:void native_set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags) arch/x86/mm/pgtable.c: __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags)); arch/x86/xen/enlighten.c: __native_set_fixmap(idx, pte); include/asm-x86/fixmap.h:void __native_set_fixmap(enum fixed_addresses idx, pte_t pte); include/asm-x86/fixmap.h:void native_set_fixmap(enum fixed_addresses idx, include/asm-x86/fixmap.h: native_set_fixmap(idx, phys, flags);
I looked at both implementations of arch_setup_additional_pages and didn't see any call to native_set_fixmap or function which calls directly native_set_fixmap... Can you tell me what's the callchain?
Marcin
Quoted 3 lines · Marcin Slusarz
I looked at both implementations of
arch_setup_additional_pagesand didn't see any call tonative_set_fixmapor function which calls directlynative_set_fixmap... Can you tell me what's the callchain?
the callchain would be:
[ 20.116039] PM: Adding info for No Bus:vcsa1 [ 20.180039] BUG: unable to handle kernel paging request at c0833e44 [ 20.180039] IP: [<c0833e44>] native_set_fixmap+0x0/0x1d [ 20.180039] *pde = 36f2a163 *pte = 00833162 [ 20.180039] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC [ 20.180039] Modules linked in: [ 20.180039] [ 20.180039] Pid: 1, comm: init Not tainted (2.6.27-rc3-00005-g844342a-dirty #24071) [ 20.180039] EIP: 0060:[<c0833e44>] EFLAGS: 00010216 CPU: 0 [ 20.180039] EIP is at native_set_fixmap+0x0/0x1d [ 20.180039] EAX: 00000001 EBX: 00000001 ECX: 00000025 EDX: 3782e000 [ 20.180039] ESI: 00000000 EDI: f671c000 EBP: f7836e68 ESP: f7836e4c [ 20.180039] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 [ 20.180039] Process init (pid: 1, ti=f7836000 task=f7870000 task.ti=f7836000) [ 20.180039] Stack: c011d580 f671c034 c018bbea 00000025 00000000 00000988 f6ef2000 f7836f1c [ 20.180039] c01b43d6 00000003 00000008 f7836f7c f782fd10 00000003 f78b6100 08048000 [ 20.180039] 00000000 00000001 f67a2500 08050b99 08050b99 00000000 00000000 00000000 [ 20.180039] Call Trace: [ 20.180039] [<c011d580>] ? arch_setup_additional_pages+0x8c/0x124 [ 20.180039] [<c018bbea>] ? try_module_get+0x8/0x2f [ 20.180039] [<c01b43d6>] ? load_elf_binary+0xae6/0x1108 [ 20.180039] [<c0144c6d>] ? lock_release_holdtime+0x43/0x48 [ 20.180039] [<c018c0c0>] ? search_binary_handler+0x92/0x1e5 [ 20.180039] [<c01b38f0>] ? load_elf_binary+0x0/0x1108 [ 20.180039] [<c018d2d7>] ? do_execve+0x14c/0x1d8 [ 20.180039] [<c0101dd8>] ? sys_execve+0x2e/0x56 [ 20.180039] [<c01030ca>] ? syscall_call+0x7/0xb [ 20.180039] [<c01067c8>] ? kernel_execve+0x1c/0x21 [ 20.180039] [<c0101286>] ? run_init_process+0x1c/0x1e [ 20.180039] [<c0101333>] ? init_post+0xab/0xd4 [ 20.180039] [<c0103d07>] ? kernel_thread_helper+0x7/0x10 [ 20.180039] ======================= [ 20.180039] Code: Bad EIP value.
Ingo
PATCH v2 1/1 x86: fix section mismatch warning - spp_getpage()
Quoted 43 lines · Ingo Molnar
Quoted 3 lines · Marcin Slusarz
I looked at both implementations of
arch_setup_additional_pagesand didn't see any call tonative_set_fixmapor function which calls directlynative_set_fixmap... Can you tell me what's the callchain?the callchain would be:
[ 20.116039] PM: Adding info for No Bus:vcsa1 [ 20.180039] BUG: unable to handle kernel paging request at c0833e44 [ 20.180039] IP: [<c0833e44>] native_set_fixmap+0x0/0x1d [ 20.180039] *pde = 36f2a163 *pte = 00833162 [ 20.180039] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC [ 20.180039] Modules linked in: [ 20.180039] [ 20.180039] Pid: 1, comm: init Not tainted (2.6.27-rc3-00005-g844342a-dirty #24071) [ 20.180039] EIP: 0060:[<c0833e44>] EFLAGS: 00010216 CPU: 0 [ 20.180039] EIP is at native_set_fixmap+0x0/0x1d [ 20.180039] EAX: 00000001 EBX: 00000001 ECX: 00000025 EDX: 3782e000 [ 20.180039] ESI: 00000000 EDI: f671c000 EBP: f7836e68 ESP: f7836e4c [ 20.180039] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 [ 20.180039] Process init (pid: 1, ti=f7836000 task=f7870000 task.ti=f7836000) [ 20.180039] Stack: c011d580 f671c034 c018bbea 00000025 00000000 00000988 f6ef2000 f7836f1c [ 20.180039] c01b43d6 00000003 00000008 f7836f7c f782fd10 00000003 f78b6100 08048000 [ 20.180039] 00000000 00000001 f67a2500 08050b99 08050b99 00000000 00000000 00000000 [ 20.180039] Call Trace: [ 20.180039] [<c011d580>] ? arch_setup_additional_pages+0x8c/0x124 [ 20.180039] [<c018bbea>] ? try_module_get+0x8/0x2f [ 20.180039] [<c01b43d6>] ? load_elf_binary+0xae6/0x1108 [ 20.180039] [<c0144c6d>] ? lock_release_holdtime+0x43/0x48 [ 20.180039] [<c018c0c0>] ? search_binary_handler+0x92/0x1e5 [ 20.180039] [<c01b38f0>] ? load_elf_binary+0x0/0x1108 [ 20.180039] [<c018d2d7>] ? do_execve+0x14c/0x1d8 [ 20.180039] [<c0101dd8>] ? sys_execve+0x2e/0x56 [ 20.180039] [<c01030ca>] ? syscall_call+0x7/0xb [ 20.180039] [<c01067c8>] ? kernel_execve+0x1c/0x21 [ 20.180039] [<c0101286>] ? run_init_process+0x1c/0x1e [ 20.180039] [<c0101333>] ? init_post+0xab/0xd4 [ 20.180039] [<c0103d07>] ? kernel_thread_helper+0x7/0x10 [ 20.180039] ======================= [ 20.180039] Code: Bad EIP value.
Quoted 1 line
Ingo
Thanks.arch_setup_additional_pages -> map_compat_vdso -> __set_fixmap -> native_set_fixmap
How about this one?
---
From: Marcin Slusarz <[email protected]>
Subject: [PATCH v2] x86: fix section mismatch warning - spp_getpage()
WARNING: vmlinux.o(.text+0x17a3e): Section mismatch in reference from the function set_pte_vaddr_pud() to the function .init.text:spp_getpage() The function set_pte_vaddr_pud() references
the function __init spp_getpage().
This is often because set_pte_vaddr_pud lacks a __init
annotation or the annotation of spp_getpage is wrong.
spp_getpage is called from __init (__init_extra_mapping) and non __init (set_pte_vaddr_pud) functions, so it can't be __init. Unfortunately it calls alloc_bootmem_pages which is __init, but does it only when bootmem allocator is available (after_bootmem == 0).
--- arch/x86/mm/init_64.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/mm/init_64.c +5 -1
@@ -88,7 +88,11 @@ early_param("gbpages", parse_direct_gbpages_on);int after_bootmem; -static __init void *spp_getpage (void ) +/* +* NOTE: This function is marked __ref because it calls __init function +* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. +*/ +static __ref void *spp_getpage (void ) {void *ptr;
Signature · 1 line
1.5.4.5
Re: [PATCH v2] x86: fix section mismatch warning - spp_getpage()
arch/x86/mm/init_64.c early_param("gbpages", parse_direct_gbpages_on); · line 95
Quoted 6 lines · Marcin Slusarz
arch/x86/mm/init_64.c +5
-1-static __init void *spp_getpage (void ) +/* +* NOTE: This function is marked __ref because it calls __init function +* (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. +*/ +static __ref void *spp_getpage (void )
perfect - applied to tip/x86/urgent, thanks Marcin.
Ingo