mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: "Adam J. Richter" <adam@yggdrasil.com>
Cc: linux-kernel@vger.kernel.org, <vandrove@vc.cvut.cz>
Subject: Re: [RFC] module fs or how to not break everything at once
Date: Fri, 22 Nov 2002 21:28:31 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.44.0211222013110.2113-100000@serv> (raw)
In-Reply-To: <200211221810.KAA17210@adam.yggdrasil.com>

Hi,

On Fri, 22 Nov 2002, Adam J. Richter wrote:

> 	I meant "what real advantage does a _filesystem_ interface
> give you?"

- more flexibility, you get a lot for free from libfs.c and other parts of 
the kernel. Check how small the modfs example is, much more isn't needed.
- no extra syscalls needed, which might have to be emulated by 64bit 
system. Module objects are normal files, why waste a syscall if you can 
just write() them to the kernel?

> 	Thanks for the pointer.  Looking at your mini-loader, it seems
> to me that you could eliminate your modules.lds script if you would
> split module-init.c into module-init.c and module-finish.c, which would
> simplify the ability to link multiple modules together or have
> a module with multiple module_init() functions if we used the
> definition of module_init() that is used for kernel objects (more
> on this below).

The linker script will not go away, it makes the loader a _lot_ easier and 
I want to keep it this way. Multiple module_init() calls won't happen, 
don't even try it.

> >Synchronizing multiple insmod is needed in user space anyway, this doesn't 
> >make the kernel side more complex.
> 
> 	Then a module_init function that may cause another module to
> be loaded can deadlock.  I'll have to think about whether that is
> a problem.

The user space locking should of course be a bit more intelligent than one 
big lock.

> 	By the way, if you do serialize all rmmod and insmod calls,
> you still have the question of how to convey dependency information to
> the kernel if you do not want the loader to know about kernel data
> formats like struct module and struct module_ref.  Conceivably you
> could represent these dependencies by doing something like "ln
> /proc/modfs/libmodule/control /proc/modfs/mymodule/deps/libmodule".
> So, it may be possible to have a scheme where you do not need complete
> serialization of depmod and insmod, although I don't know if that will
> prove to be important.

The kernel doesn't need the dependency information, they can stay as well 
in user space. The checks currently done don't have to be done in the 
kernel.

> >That's a mostly user space problem and I'd rather do this right, why 
> >should I keep invalid symbols?
> 
> 	My point was just about being resiliant against, say, someone
> accidentally hitting a control-C or a kill signal during one of these
> programs, such as during an aborted shutdown.  However, now that you
> mention it, it would be useful for developers to have an rmmod option
> to retain symbols for debugging a bad memory reference that happens
> after a module has been unloaded.

I want to keep the kernel implementation simple, this would only bloat it.
Cleaning up after a signal shouldn't bother the kernel (at least as far 
as modfs is concerned).

> 	Even if you don't want to support circular dependencies
> (loading multiple .o's together) or multiple module_{init,exit}
> functions, having insmod load separate modules for the init and
> non-init parts will shrink the kernel code.  It would be nice
> for insmod to be able to do ELF section manipulations like this
> also to implement things like having .exit{,func} sections
> that insmod could drop if it were given a flag to load the
> module "permanently."

The point of the linker script is to avoid that the loader has to play 
around with the sections. If you want to get rid of init data, put it at 
the end and truncate() it when you're done. This is trivial to do with a 
module fs.

> >Reference loops are never a good idea,
> 
> 	An advantage of allowing circular loops is that everything
> would be modularized or nearly modularized with only a few changes.
> For example, I want to modularize CONFIG_NET (not just CONFIG_INET).
> However, there is a circular reference:

You're trying to move your problems to someone else - very bad idea.
If you can't get modules references right, you have very likely more 
problems like module initialization races. Link everything together and 
make the initialization explicit and don't rely on that the linker/loader 
gets it magically right.

bye, Roman


  reply	other threads:[~2002-11-22 20:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-22 18:10 Adam J. Richter
2002-11-22 20:28 ` Roman Zippel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-11-23  4:58 Adam J. Richter
2002-11-23 12:34 ` Roman Zippel
2002-11-22 22:11 Adam J. Richter
2002-11-22 23:24 ` Roman Zippel
2002-11-21 23:59 Adam J. Richter
2002-11-21 23:21 Adam J. Richter
2002-11-22 10:50 ` Roman Zippel
2002-11-20 21:06 Roman Zippel
2002-11-20 22:03 ` Petr Vandrovec
2002-11-20 23:32   ` Roman Zippel
2002-11-21  1:59     ` Petr Vandrovec
2002-11-21 19:46       ` Roman Zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0211222013110.2113-100000@serv \
    --to=zippel@linux-m68k.org \
    --cc=adam@yggdrasil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vandrove@vc.cvut.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®