This is always a bug isn't it?
A quick check shows that the following files have non-__init functions
calling __init init_idle() in 2.5.65:
arch/ppc/kernel/smp.c
arch/um/kernel/smp.c
arch/mips/kernel/process.c
arch/mips64/kernel/process.c
arch/parisc/kernel/smp.c
arch/s390x/kernel/smp.c
arch/s390/kernel/smp.c
..Stu
> This is always a bug isn't it?
... unless they are guaranteed to be called in the init context only.
Andrzej
--
=======================================================================
Andrzej M. Krzysztofowicz [email protected]
phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math., Gdansk University of Technology
From: "Andrzej Krzysztofowicz" <[email protected]>
> From: "Stuart MacDonald" <[email protected]>
> > This is always a bug isn't it?
>
> ... unless they are guaranteed to be called in the init context only.
In which case those functions should also be marked __init so they can
be reclaimed, correct? So it's the reciprocal bug.
..Stu
> From: "Andrzej Krzysztofowicz" <[email protected]>
> > From: "Stuart MacDonald" <[email protected]>
> > > This is always a bug isn't it?
> >
> > ... unless they are guaranteed to be called in the init context only.
>
> In which case those functions should also be marked __init so they can
> be reclaimed, correct? So it's the reciprocal bug.
Not always possible.
__init A() {
...
}
__exit B() {
...
}
C() {
...
A();
...
#ifdef MODULE
B();
#endif
...
}
C cannot be marked __init for #define MODULE case. Even if it is called only
by some __init code. I can imagine other similar situations.
However it is not your case probably.
--
=======================================================================
Andrzej M. Krzysztofowicz [email protected]
phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math., Gdansk University of Technology
Andrzej Krzysztofowicz wrote:
> Not always possible.
>
> __init A() {
> ...
> }
>
> __exit B() {
> ...
> }
>
> C() {
> ...
> A();
> ...
> #ifdef MODULE
> B();
> #endif
> ...
> }
>
> C cannot be marked __init for #define MODULE case. Even if it is called only
> by some __init code. I can imagine other similar situations.
I thought that in the case of modules, __init is a noop? At least, that's what
this page says
http://www.netfilter.org/unreliable-guides/kernel-hacking/routines-init.html
So if MODULE is defined, it doesn't matter if C is labelled as __init or not,
and if it is not defined, it *should* be labelled as __init since it is itself
calling __init code.
Chris
--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: [email protected]
> Andrzej Krzysztofowicz wrote:
>
> > Not always possible.
> >
> > __init A() {
> > ...
> > }
> >
> > __exit B() {
> > ...
> > }
> >
> > C() {
> > ...
> > A();
> > ...
> > #ifdef MODULE
> > B();
> > #endif
> > ...
> > }
> >
> > C cannot be marked __init for #define MODULE case. Even if it is called only
> > by some __init code. I can imagine other similar situations.
>
> I thought that in the case of modules, __init is a noop? At least, that's what
> this page says
Currently - yes.
But I heard about patches that make __init usefull in modular case.
Why break them ?
> http://www.netfilter.org/unreliable-guides/kernel-hacking/routines-init.html
>
> So if MODULE is defined, it doesn't matter if C is labelled as __init or not,
> and if it is not defined, it *should* be labelled as __init since it is itself
> calling __init code.
Safely the following can be added:
+ #ifndef MODULE
+ __init
+ #endif
C() {
But I heard that our policy is avoiding extra #ifdefs if possible...
AFAIR, some __init functions were called (in 2.4 scsi code; I didn't check
newer code) indirectly, by pointers to them, from non __init code. It is
more dificult to detect such cases.
--
=======================================================================
Andrzej M. Krzysztofowicz [email protected]
phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math., Gdansk University of Technology