Re: [PATCH] x86: pgtable_32.h - prototype and section mismatch fixes

From: Sam Ravnborg
Date: Mon Apr 14 2008 - 14:31:55 EST


>
> GCC is ok, I mean it inlines paravirt_pagetable_setup_[start,done] even with
> CONFIG_OPTIMIZE_INLINING=y:
> $ objdump -t vmlinux.o | grep pagetable_setup_start
> 0000a418 g F .init.text 000000a1 native_pagetable_setup_start
>
> While running with CONFIG_DEBUG_SECTION_MISMTCH=y it does not inline
> paravirt_pagetable_setup_start (_done is OK):
> $ objdump -t vmlinux.o | grep pagetable_setup_start
> 00017100 l F .text 0000000b paravirt_pagetable_setup_start
> 00009fb0 g F .init.text 00000089 native_pagetable_setup_start
>
> DEBUG_SECTION_MISMATCH probably generated mismatch with smpboot_setup_io_apic()
> (commit: 96c968742fa1e6d64f979464acf2fd90cdc117b3, already merged). I will check
> and if __init is really superfluous I will post delta patch to remove all those
> __init annotations.
>
> Similar situation might be found with unlock_ExtINT_logic()
> (arch/x86/kernel/io_apic_32.c), which I annotated with __init in one of previous
> patches, but here, this function IMO shouldn't be marked inline.

Hi Jacek.

Please consider following code snippet:

static void __init foo() {}

static void __init bar() { foo(); }

static void __init baz() { bar(); }

Browsing this code it makes perfect sense that when baz()
is annotated __init bar and suddenly foo() has same annotation.

There is no point in removing the __init annotation of bar()
just becasue we happen to know it will be inlined by gcc.
Removing the __init anotation is actually wrong - because
the __init annotation has a two-fold purpose.
It is used to locate this function in a section that
is later discarded.
But it is also used to document that this function
is only used in the early init of this driver/what-ever.
So using this function in non-__init code is wrong.

Therefore I recommend to keep the __init annotation
also for the inline functions - assuming these functions
are supposed to be used only in the early init as the annotation
says they are.

Sam
--
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/