* Suggestion for module .init.{text,data} sections
@ 2001-04-27 4:49 Adam J. Richter
2001-04-27 8:35 ` Ingo Oeser
0 siblings, 1 reply; 5+ messages in thread
From: Adam J. Richter @ 2001-04-27 4:49 UTC (permalink / raw)
To: kaos; +Cc: linux-kernel
A while ago, on linux-kernel, we had a discussion about
adding support for __initdata and __init in modules. Somebody
(whose name escapes me) had implemented it by essentially adding
a vmrealloc() facility in the kernel. I think I've thought of a
simpler way, that would require almost no kernel changes.
Have insmod split the module into two parts and load them
as two modules. First, create the regular part of the module as usual
(without .data.init and .text.init), except with no initialization
routine set. Second, create a module from the .data.init and the
.text.init sections (if any), with it's initialization routine set
to the module's init_module routine, even if that routine resides
in the first module. Third, there will be cross references between
these two modules, so will generally be necessary to resolve the
relocations before loading either module. Fourth, load the first
module. This will always succeed, since there is no initialization
routine to fail. Fifth, load the second module, the one made of .data.init
and .text.init. It will run the actual module_init function. If the
module initialization routine fails, both modules are unloaded and
the usual failure behavior happens. If the module initialization
succeeds, the ".init" module (the second module) is unloaded.
Potentially, this could save some memory footprint in
highly modularized systems and cleanup linux/include/init.h.
I guess I would imagine this as a potential 2.5 feature, or
perhaps as a default-off option intended soley for stress testing
in 2.4.
I started looking through the modutils sources, but I was
a little disappointed to discover that it is ELF-specific rather
than written in bfd, as I am pretty unfamiliar with ELF innards but
a little more conversant in bfd. Maybe I'll take a whack at it yet,
but I figure I should at least pass the idea along and see if I'm
overlooking anything obvious.
Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Suggestion for module .init.{text,data} sections
2001-04-27 4:49 Suggestion for module .init.{text,data} sections Adam J. Richter
@ 2001-04-27 8:35 ` Ingo Oeser
2001-04-27 13:14 ` Brian Gerst
2001-04-29 1:05 ` Pavel Machek
0 siblings, 2 replies; 5+ messages in thread
From: Ingo Oeser @ 2001-04-27 8:35 UTC (permalink / raw)
To: Adam J. Richter; +Cc: kaos, linux-kernel
On Thu, Apr 26, 2001 at 09:49:05PM -0700, Adam J. Richter wrote:
> A while ago, on linux-kernel, we had a discussion about
> adding support for __initdata and __init in modules. Somebody
> (whose name escapes me) had implemented it by essentially adding
> a vmrealloc() facility in the kernel. I think I've thought of a
> simpler way, that would require almost no kernel changes.
>
[implementation details snipped]
While you are at this, you could make the .exit.{text,data}
sections swappable for modules (by allocating swappable pages fro
them?) and only mark them unswappable, while the module is
exiting.
Rationale: A device needed for swaping will never call exit
stuff, because it is still in use. So I see no obvious race here.
Regards
Ingo Oeser
--
10.+11.03.2001 - 3. Chemnitzer LinuxTag <http://www.tu-chemnitz.de/linux/tag>
<<<<<<<<<<<< been there and had much fun >>>>>>>>>>>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Suggestion for module .init.{text,data} sections
2001-04-27 8:35 ` Ingo Oeser
@ 2001-04-27 13:14 ` Brian Gerst
2001-04-29 1:05 ` Pavel Machek
1 sibling, 0 replies; 5+ messages in thread
From: Brian Gerst @ 2001-04-27 13:14 UTC (permalink / raw)
To: Ingo Oeser; +Cc: Adam J. Richter, kaos, linux-kernel
Ingo Oeser wrote:
>
> On Thu, Apr 26, 2001 at 09:49:05PM -0700, Adam J. Richter wrote:
> > A while ago, on linux-kernel, we had a discussion about
> > adding support for __initdata and __init in modules. Somebody
> > (whose name escapes me) had implemented it by essentially adding
> > a vmrealloc() facility in the kernel. I think I've thought of a
> > simpler way, that would require almost no kernel changes.
> >
> [implementation details snipped]
>
> While you are at this, you could make the .exit.{text,data}
> sections swappable for modules (by allocating swappable pages fro
> them?) and only mark them unswappable, while the module is
> exiting.
>
> Rationale: A device needed for swaping will never call exit
> stuff, because it is still in use. So I see no obvious race here.
>
> Regards
__exit functions and data are usually too small to make the effort worth
it. __init functions and data on the other hand could be quite large,
if they contain firmware data for example.
--
Brian Gerst
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Suggestion for module .init.{text,data} sections
2001-04-27 8:35 ` Ingo Oeser
2001-04-27 13:14 ` Brian Gerst
@ 2001-04-29 1:05 ` Pavel Machek
2001-04-29 20:40 ` Dominik Kubla
1 sibling, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2001-04-29 1:05 UTC (permalink / raw)
To: Ingo Oeser; +Cc: Adam J. Richter, kaos, linux-kernel
Hi!
> > A while ago, on linux-kernel, we had a discussion about
> > adding support for __initdata and __init in modules. Somebody
> > (whose name escapes me) had implemented it by essentially adding
> > a vmrealloc() facility in the kernel. I think I've thought of a
> > simpler way, that would require almost no kernel changes.
> >
> [implementation details snipped]
>
> While you are at this, you could make the .exit.{text,data}
> sections swappable for modules (by allocating swappable pages fro
> them?) and only mark them unswappable, while the module is
> exiting.
>
> Rationale: A device needed for swaping will never call exit
> stuff, because it is still in use. So I see no obvious race here.
You can't do that. Think about interrupt routine being swapped out.
Kernel is *not* preemptible.
--
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Suggestion for module .init.{text,data} sections
2001-04-29 1:05 ` Pavel Machek
@ 2001-04-29 20:40 ` Dominik Kubla
0 siblings, 0 replies; 5+ messages in thread
From: Dominik Kubla @ 2001-04-29 20:40 UTC (permalink / raw)
To: Pavel Machek; +Cc: Ingo Oeser, Adam J. Richter, kaos, linux-kernel
On Sun, Apr 29, 2001 at 01:05:23AM +0000, Pavel Machek wrote:
>
> You can't do that. Think about interrupt routine being swapped out.
>
> Kernel is *not* preemptible.
Quite a statement. Would you care to elaborate? I thought there are Unix
(or Unix-like) kernels out there that allow pageing and premption of kernel
parts. Or am i mistaken?
Dominik
--
A lovely thing to see: Kobayashi Issa
through the paper window's holes (1763-1828)
the galaxy. [taken from: David Brin - Sundiver]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-04-29 20:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-27 4:49 Suggestion for module .init.{text,data} sections Adam J. Richter
2001-04-27 8:35 ` Ingo Oeser
2001-04-27 13:14 ` Brian Gerst
2001-04-29 1:05 ` Pavel Machek
2001-04-29 20:40 ` Dominik Kubla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox