2008-11-01 18:21:08

by Al Viro

[permalink] [raw]
Subject: [PATCH] el3_common_init() should be __devinit, not __init


Signed-off-by: Al Viro <[email protected]>
---
drivers/net/3c509.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index 3a7bc52..c7a4f3b 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -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;
--
1.5.6.5


2008-11-01 19:09:58

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

On Sat, Nov 01, 2008 at 06:20:19PM +0000, Al Viro wrote:
> -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:

--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -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"

2008-11-01 19:16:25

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

On Sat, Nov 01, 2008 at 10:12:50PM +0300, Alexey Dobriyan wrote:
> On Sat, Nov 01, 2008 at 06:20:19PM +0000, Al Viro wrote:
> > -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?

2008-11-01 19:24:53

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

On Sat, Nov 01, 2008 at 07:16:14PM +0000, Al Viro wrote:
> On Sat, Nov 01, 2008 at 10:12:50PM +0300, Alexey Dobriyan wrote:
> > On Sat, Nov 01, 2008 at 06:20:19PM +0000, Al Viro wrote:
> > > -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.

2008-11-01 19:33:17

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

On Sat, Nov 01, 2008 at 10:27:57PM +0300, Alexey Dobriyan wrote:
> On Sat, Nov 01, 2008 at 07:16:14PM +0000, Al Viro wrote:
> > On Sat, Nov 01, 2008 at 10:12:50PM +0300, Alexey Dobriyan wrote:
> > > On Sat, Nov 01, 2008 at 06:20:19PM +0000, Al Viro wrote:
> > > > -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.

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

2008-11-02 17:30:52

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

On Sat, Nov 01, 2008 at 10:27:57PM +0300, Alexey Dobriyan wrote:
> On Sat, Nov 01, 2008 at 07:16:14PM +0000, Al Viro wrote:
> > On Sat, Nov 01, 2008 at 10:12:50PM +0300, Alexey Dobriyan wrote:
> > > On Sat, Nov 01, 2008 at 06:20:19PM +0000, Al Viro wrote:
> > > > -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?

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

2008-11-02 18:15:34

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init



On Sat, 1 Nov 2008, Sam Ravnborg wrote:
>
> 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

2008-11-02 18:54:40

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

On Sun, Nov 02, 2008 at 10:13:03AM -0800, Linus Torvalds wrote:
>
>
> On Sat, 1 Nov 2008, Sam Ravnborg wrote:
> >
> > 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.

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.

2008-11-02 20:33:19

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

On Sun, Nov 02, 2008 at 10:13:03AM -0800, Linus Torvalds wrote:
>
>
> On Sat, 1 Nov 2008, Sam Ravnborg wrote:
> >
> > 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.

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

2008-11-06 05:43:00

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] el3_common_init() should be __devinit, not __init

Al Viro wrote:
> Signed-off-by: Al Viro <[email protected]>
> ---
> drivers/net/3c509.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)

applied