Skip to contentSkip to conversation

el3_common_init() should be __devinit, not __init

PATCH Applied Al Viro 6 participants 10 messages Nov 1, 2008 – Nov 6, 2008 Network drivers

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 el3_common_init() should be __devinit, not __init

---
 drivers/net/3c509.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/3c509.c +3 -3
index 3a7bc52..c7a4f3b 100644
@@ -94,7 +94,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [email protected]\n";
+static char version[] __devinitdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " [email protected]\n";
 
 #ifdef EL3_DEBUG
 static int el3_debug = EL3_DEBUG;
@@ -186,7 +186,7 @@ static int max_interrupt_work = 10;
 static int nopnp;
 #endif
 
-static int __init el3_common_init(struct net_device *dev);
+static int __devinit el3_common_init(struct net_device *dev);
 static void el3_common_remove(struct net_device *dev);
 static ushort id_read_eeprom(int index);
 static ushort read_eeprom(int ioaddr, int index);
@@ -537,7 +537,7 @@ static struct mca_driver el3_mca_driver = {
 static int mca_registered;
 #endif /* CONFIG_MCA */
 
-static int __init el3_common_init(struct net_device *dev)
+static int __devinit el3_common_init(struct net_device *dev)
 {
 	struct el3_private *lp = netdev_priv(dev);
 	int err;
Signature · 1 line
1.5.6.5
#1 lore raw

Review

Quoted 2 lines · Al Viro
(quoted diff) +1 -1
-static int __init el3_common_init(struct net_device *dev)
+static int __devinit el3_common_init(struct net_device *dev)

Al, here is much better patch:

include/linux/init.h +18 -18
@@ -83,20 +83,20 @@
 #define __exit          __section(.exit.text) __exitused __cold
 
 /* Used for HOTPLUG */
-#define __devinit        __section(.devinit.text) __cold
-#define __devinitdata    __section(.devinit.data)
-#define __devinitconst   __section(.devinit.rodata)
-#define __devexit        __section(.devexit.text) __exitused __cold
-#define __devexitdata    __section(.devexit.data)
-#define __devexitconst   __section(.devexit.rodata)
+#define __devinit        __cold
+#define __devinitdata
+#define __devinitconst
+#define __devexit        __exitused __cold
+#define __devexitdata
+#define __devexitconst
 
 /* Used for HOTPLUG_CPU */
-#define __cpuinit        __section(.cpuinit.text) __cold
-#define __cpuinitdata    __section(.cpuinit.data)
-#define __cpuinitconst   __section(.cpuinit.rodata)
-#define __cpuexit        __section(.cpuexit.text) __exitused __cold
-#define __cpuexitdata    __section(.cpuexit.data)
-#define __cpuexitconst   __section(.cpuexit.rodata)
+#define __cpuinit        __cold
+#define __cpuinitdata
+#define __cpuinitconst
+#define __cpuexit        __cold
+#define __cpuexitdata
+#define __cpuexitconst
 
 /* Used for MEMORY_HOTPLUG */
 #define __meminit        __section(.meminit.text) __cold
@@ -115,13 +115,13 @@
 #define __INITRODATA	.section	".init.rodata","a"
 #define __FINITDATA	.previous
 
-#define __DEVINIT        .section	".devinit.text", "ax"
-#define __DEVINITDATA    .section	".devinit.data", "aw"
-#define __DEVINITRODATA  .section	".devinit.rodata", "a"
+#define __DEVINIT
+#define __DEVINITDATA
+#define __DEVINITRODATA
 
-#define __CPUINIT        .section	".cpuinit.text", "ax"
-#define __CPUINITDATA    .section	".cpuinit.data", "aw"
-#define __CPUINITRODATA  .section	".cpuinit.rodata", "a"
+#define __CPUINIT
+#define __CPUINITDATA
+#define __CPUINITRODATA
 
 #define __MEMINIT        .section	".meminit.text", "ax"
 #define __MEMINITDATA    .section	".meminit.data", "aw"
#2 lore raw
Quoted 5 lines · Alexey Dobriyan

Review

Quoted 2 lines · Al Viro
(quoted diff) +1 -1
-static int __init el3_common_init(struct net_device *dev)
+static int __devinit el3_common_init(struct net_device *dev)

Al, here is much better patch:

[essentially kill devinit/cpuinit]

What the hell makes it better?

#3 lore raw
Quoted 10 lines · Al Viro
Quoted 5 lines · Alexey Dobriyan

Review

Quoted 2 lines · Al Viro
(quoted diff) +1 -1
-static int __init el3_common_init(struct net_device *dev)
+static int __devinit el3_common_init(struct net_device *dev)

Al, here is much better patch:

[essentially kill devinit/cpuinit]

What the hell makes it better?

Wasting efforts for too little gain?

More or less every distro enables HOTPLUG and HOTPLUG_CPU.

#4 lore raw
Quoted 8 lines · Alexey Dobriyan
Quoted 7 lines · Al Viro
Quoted 5 lines · Alexey Dobriyan

Review

Quoted 2 lines · Al Viro
(quoted diff) +1 -1
-static int __init el3_common_init(struct net_device *dev)
+static int __devinit el3_common_init(struct net_device *dev)

Al, here is much better patch:

Quoted 7 lines
Quoted 3 lines

[essentially kill devinit/cpuinit]

What the hell makes it better?

Wasting efforts for too little gain?

More or less every distro enables HOTPLUG and HOTPLUG_CPU.

More or less every distro shits udev and hald; it's not a reason to make the corrsponding stuff in the kernel mandatory. The same applies here...

#5 lore raw
In reply to Alexey Dobriyan
Quoted 8 lines · Alexey Dobriyan
Quoted 7 lines · Al Viro
Quoted 5 lines · Alexey Dobriyan

Review

Quoted 2 lines · Al Viro
(quoted diff) +1 -1
-static int __init el3_common_init(struct net_device *dev)
+static int __devinit el3_common_init(struct net_device *dev)

Al, here is much better patch:

Quoted 5 lines
Quoted 3 lines

[essentially kill devinit/cpuinit]

What the hell makes it better?

Wasting efforts for too little gain?

And what is the wasted gain - numbers please.
And please come up with relevant numbers for a number of embedded configs. The normal desktop/server usage does not count here.

For cpuinit/cpuexit the gain turned out to be minimal. But I have so far seen _zero_ numbers on the real gain for devinit/devexit and meminit/memexit.

Sam

#6 lore raw
Quoted 2 lines · Sam Ravnborg

For cpuinit/cpuexit the gain turned out to be minimal.

Quite frankly, I'm not convinced.

Yeah, yeah, most distro's end up always enabling CPU hotplug due to suspend/resume, but:

- desktop PC's aren't where most memory pressures are anyway

- on UP, CONFIG_HOTPLUG_CPU isn't on even if you do have suspend/resume

- we should still care about embedded devices, and while some of them are growing up (and having SMP and not caring about a few tens of kB of memory), I don't think that's a valid argument for the other ones.

So. I'd rather we try to keep our init sections, and continue to spend effort on fixing them. If at all possible.

Linus

#7 lore raw
Quoted 13 lines · Linus Torvalds
Quoted 2 lines · Sam Ravnborg

For cpuinit/cpuexit the gain turned out to be minimal.

Quite frankly, I'm not convinced.

Yeah, yeah, most distro's end up always enabling CPU hotplug due to suspend/resume, but:

- desktop PC's aren't where most memory pressures are anyway

Quoted 8 lines

- on UP, CONFIG_HOTPLUG_CPU isn't on even if you do have suspend/resume

- we should still care about embedded devices, and while some of them are growing up (and having SMP and not caring about a few tens of kB of memory), I don't think that's a valid argument for the other ones.

So. I'd rather we try to keep our init sections, and continue to spend effort on fixing them. If at all possible.

FWIW, I've tweaked that stuff yesterday for a while. Results so far:
alpha, arm[*], s390, s390x, uml - all down to zero section conflicts; amd64 (UP and SMP) - one conflict, and it looks like a real issue. i386 - same + one false positive.
sparc32 - one potential real issue (cpuinit, BTW)
sparc64 - one conflict, again likely to be a real problem
m68k - 3 conflicts, one of them looking like a real bug
m32r - 4 conflicts, by the look of it boiling down to single misannotation ppc, ppc64, ia64 - 7--10 conflicts on each, hadn't looked into them yet.

That - from one afternoon of hacking. And I'm yet to look at ppc/ppc64/ia64; I would be very surprised if these didn't have low-hanging fruits.

[*] 2 arm configs I have sitting around - didn't do all subarchitectures.

Now, what we *really* ought to do is taking that crap to sparse where it really can be handled sanely, without "variable name ends on magical string '_shp', so we won't complain about pointers to .init.text anywhere in it" kind of "logics".

What we need is something along the lines of "->probe() in pci_driver can be in .devinit.text and it can be called only if...". Which is much, _much_ easier for sparse to handle. We need to figure out what to do with *.S, but other than that... this is really not a job for modpost.

#8 lore raw
In reply to Linus Torvalds
Quoted 11 lines · Linus Torvalds
Quoted 2 lines · Sam Ravnborg

For cpuinit/cpuexit the gain turned out to be minimal.

Quite frankly, I'm not convinced.

Yeah, yeah, most distro's end up always enabling CPU hotplug due to suspend/resume, but:

Quoted 7 lines

- desktop PC's aren't where most memory pressures are anyway

- on UP, CONFIG_HOTPLUG_CPU isn't on even if you do have suspend/resume

- we should still care about embedded devices, and while some of them are growing up (and having SMP and not caring about a few tens of kB of memory), I don't think that's a valid argument for the other ones.

I benchmarked by investigating a common arm config and not some bloated x86 desktop config when analysing the cpuinit/cpuexit case.

Another reason why I like to see cpuinit dropped is that it is misused all over. __cpuinit are used for two purposes:
- to annotate code/data that is only used in the early init phase if HOTPLUG_CPU is not enabled
- to annotate code/data that is only used if HOTPLUG_CPU is enabled

The latter use is plain wrong but I never managed to really get to the bottom of it.

If we could use our config ssytem in the normals ways to cover with code that is only used for HOTPLUG_CPU then things would be much simpler.

When I have done sweep fixing all section mismatchs it has almost always been cpuinit that has caused me most troubles. The others has been trivial to deal with.

As Al points out in his reply a full day effort can fix a lot of the remaining ones.

For devinit/devexit there is in my mind no questions that they shall remain.

The most important topic to address is to get better detection. What we can do in modpost is limited :-(

Sam