Skip to contentSkip to conversation

smart gcc inliner...

DISCUSSION Paweł Sikora 5 participants 6 messages Mar 27, 2007 – Mar 30, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

The recent gcc (3.4/4.x) optimizer inlines functions across sections which is definitely not we want, e.g. inlining functions from .init.text section.

I think, the __init' macro needs noinline' attribute and all the static inline __{dev}init' functions need inline' attribute removal to avoid gcc error (inlining failed, function not inlinable).

Full discussion at: http://gcc.gnu.org/PR31362

BR,
Pawel.

#1 lore raw
Quoted 10 lines · Paweł Sikora

Hi,

The recent gcc (3.4/4.x) optimizer inlines functions across sections which is definitely not we want, e.g. inlining functions from .init.text section.

I think, the __init' macro needs noinline' attribute and all the static inline __{dev}init' functions need inline' attribute removal to avoid gcc error (inlining failed, function not inlinable).

init functions should only ever be called from other init functions.

So this should not happen. If it happens the annotations need to be fixed.

This is already warned for for modules at build time with pending patches to do the same for vmlinux.

There are already a couple of patches pending for this and many went into .21.

-Andi

#2 lore raw
Quoted 4 lines · Andi Kleen

init functions should only ever be called from other init functions.

So this should not happen. If it happens the annotations need to be fixed.

I've seen some versions of gcc inline weak functions too.

J

#3 lore raw
Quoted 6 lines · Jeremy Fitzhardinge
Quoted 3 lines · Andi Kleen

init functions should only ever be called from other init functions.

So this should not happen. If it happens the annotations need to be fixed.

I've seen some versions of gcc inline weak functions too.

Please be more precise:
- gcc version
- example code
- bug number in the gcc Bugzilla

This would also help understanding what you are talking about:
- Did gcc inline a global function?
- Or was a static function declared as weak (which might be an error by the programmer)?
- ...

Quoted 1 line

J

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#4 lore raw
Quoted 8 lines · Adrian Bunk
Quoted 6 lines · Jeremy Fitzhardinge
Quoted 4 lines · Andi Kleen

init functions should only ever be called from other init functions.

So this should not happen. If it happens the annotations need to be fixed.

Quoted 8 lines
Quoted 2 lines

I've seen some versions of gcc inline weak functions too.

Please be more precise:
- gcc version
- example code
- bug number in the gcc Bugzilla

Sorry, it was a while ago, and I didn't take the time to fully report it. It was FC6 on x86_64, doing a 32-bit cross-build. I'll see if I can repro it.

Quoted 6 lines

This would also help understanding what you are talking about:
- Did gcc inline a global function?
- Or was a static function declared as weak (which might be an error by the programmer)?
- ...

It was, specifically, smp_setup_processor_id getting inlined into start_kernel.

J

#5 lore raw
In reply to Paweł Sikora
Quoted 6 lines · Paweł Sikora

The recent gcc (3.4/4.x) optimizer inlines functions across sections which is definitely not we want, e.g. inlining functions from .init.text section.

I think, the __init' macro needs noinline' attribute and all

An function from the .init section may very well inline a function from the regular section, though.

Jan