It is currently Tue, 07 Dec 2021 03:37:37 GMT



 
Author Message
 Non-__init functions calling __init functions
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at   http://www.**-**.com/
Please read the FAQ at   http://www.**-**.com/



 Mon, 05 Sep 2005 17:10:09 GMT   
 Non-__init functions calling __init functions

... unless they are guaranteed to be called in the init context only.

Andrzej

--
=======================================================================
  Andrzej M. Krzysztofowicz               an...@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Gdansk University of Technology
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



 Mon, 05 Sep 2005 17:20:11 GMT   
 Non-__init functions calling __init functions
From: "Andrzej Krzysztofowicz" <an...@green.mif.pg.gda.pl>

In which case those functions should also be marked __init so they can
be reclaimed, correct? So it's the reciprocal bug.

..Stu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



 Mon, 05 Sep 2005 17:30:11 GMT   
 Non-__init functions calling __init functions

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               an...@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Gdansk University of Technology
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



 Mon, 05 Sep 2005 17:40:08 GMT   
 Non-__init functions calling __init functions

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-in...

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: cfrie...@nortelnetworks.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



 Mon, 05 Sep 2005 18:10:16 GMT   
 Non-__init functions calling __init functions

Currently - yes.
But I heard about patches that make __init usefull in modular case.
Why break them ?

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               an...@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Gdansk University of Technology
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



 Tue, 06 Sep 2005 10:20:06 GMT   
 
   [ 6 post ] 

Similar Threads

1. __init functions called by non-__init

2. Browser calls CGI C function which sets an env var and call a c function crashes

3. NSAPI Init Functions Heinous Behavior

4. Question:How to pass parameter from bios to kernel(the last part of init function)

5. a new __init function in random.c

6. __init functions (possible bugs)

7. debugging init function in shared library?

8. /etc/init.d/function:daemon()

9. __init function

10. Details on etc/init.d/functions


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software