* smart gcc inliner...
@ 2007-03-27 15:07 Paweł Sikora
2007-03-27 16:55 ` Andi Kleen
2007-03-28 2:05 ` Jan Engelhardt
0 siblings, 2 replies; 6+ messages in thread
From: Paweł Sikora @ 2007-03-27 15:07 UTC (permalink / raw)
To: Linux Kernel list
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: smart gcc inliner...
2007-03-27 15:07 smart gcc inliner Paweł Sikora
@ 2007-03-27 16:55 ` Andi Kleen
2007-03-28 2:55 ` Jeremy Fitzhardinge
2007-03-28 2:05 ` Jan Engelhardt
1 sibling, 1 reply; 6+ messages in thread
From: Andi Kleen @ 2007-03-27 16:55 UTC (permalink / raw)
To: Paweł Sikora; +Cc: Linux Kernel list
Paweł Sikora <pluto@agmk.net> writes:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: smart gcc inliner...
2007-03-27 15:07 smart gcc inliner Paweł Sikora
2007-03-27 16:55 ` Andi Kleen
@ 2007-03-28 2:05 ` Jan Engelhardt
1 sibling, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2007-03-28 2:05 UTC (permalink / raw)
To: Paweł Sikora; +Cc: Linux Kernel list
On Mar 27 2007 17:07, Paweł Sikora wrote:
>
> 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
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: smart gcc inliner...
2007-03-27 16:55 ` Andi Kleen
@ 2007-03-28 2:55 ` Jeremy Fitzhardinge
2007-03-30 19:32 ` Adrian Bunk
0 siblings, 1 reply; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-28 2:55 UTC (permalink / raw)
To: Andi Kleen; +Cc: Paweł Sikora, Linux Kernel list
Andi Kleen wrote:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: smart gcc inliner...
2007-03-28 2:55 ` Jeremy Fitzhardinge
@ 2007-03-30 19:32 ` Adrian Bunk
2007-03-30 19:39 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2007-03-30 19:32 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: Andi Kleen, Paweł Sikora, Linux Kernel list
On Tue, Mar 27, 2007 at 07:55:38PM -0700, Jeremy Fitzhardinge wrote:
> Andi Kleen wrote:
> > 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)?
- ...
> J
cu
Adrian
--
"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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: smart gcc inliner...
2007-03-30 19:32 ` Adrian Bunk
@ 2007-03-30 19:39 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2007-03-30 19:39 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Andi Kleen, Paweł Sikora, Linux Kernel list
Adrian Bunk wrote:
> On Tue, Mar 27, 2007 at 07:55:38PM -0700, Jeremy Fitzhardinge wrote:
>
>> Andi Kleen wrote:
>>
>>> 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
>
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.
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-30 19:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-27 15:07 smart gcc inliner Paweł Sikora
2007-03-27 16:55 ` Andi Kleen
2007-03-28 2:55 ` Jeremy Fitzhardinge
2007-03-30 19:32 ` Adrian Bunk
2007-03-30 19:39 ` Jeremy Fitzhardinge
2007-03-28 2:05 ` Jan Engelhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox