linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] In-kernel module loader 1/7
Date: Wed, 25 Sep 2002 23:28:36 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0209252003370.338-100000@serv> (raw)
In-Reply-To: <20020925125556.6321A2C387@lists.samba.org>

Hi,

On Wed, 25 Sep 2002, Rusty Russell wrote:

> Once you move the linking outside the kernel, you need to communicate
> more information.  You need some form of "allocate", and "here is all
> the other symbol information", then "please tell me what you used so I
> can update the reference counts" and "place linked module".  So you've
> added some complexity to deal with synchronization of these acts with
> a userspace process.

With the new module layout this will be avoided as much as possible. This
information is already mostly generated during compile time and only
extracted by insmod. So to avoid this we only need to store the
information in a way the kernel can find it itself without insmod help.
Now let's look at the new module interface:

DEFINE_MODULE
	.init	= init_affs_fs,
	.exit	= exit_affs_fs,
DEFINE_MODULE_END

DEFINE_MODULE is used to define a structure, which looks like this:

struct module __this_module = {
	.ex_table_start	= __ex_table_start,
	.ex_table_end	= __ex_table_end,
	.syms_start	= __syms_start,
	.syms_end	= __syms_end,

Now we can use a linker script like this:

SECTIONS
{
	.module : { *(.module_struct) }
	.text : { *(.text) }
	.data : { *(.data) }
	.syms : {
		__syms_start = .;
		*(__ksymtab)
		__syms_end = .;
	}
	.ex_table : {
		__ex_table_start = .;
		*(__ex_table)
		__ex_table_end = .;
	}
	.bss : { *(.bss) }
}

which can be used to add all the information usually added by insmod. So
ld does already most of the work and insmod only needs to do the
relocation and the kernel finds at the start of the module all
information it needs. The only information which is left to be added are
the module arguments.

> Now, say your architecture decided that it wanted to try to allocate
> its modules: it wants to allocate one part for init and one for core
> (so the init can be easily discarded), but if they're not close
> enough, it'll give up and allocate one big one and not discard init.
>
> But half if it is in userspace, so you have to support both in the
> kernel and both in userspace while you are in transition.  Or, say the
> kernel slightly changes the way it parses boot paramters and you
> wanted the module to match?  Or you wanted to change the version
> encoding?  Or something else I don't know about yet?

A possible solution would be to do something what I'm planning to do for
kernel conf - export it as library, then external tools can link the
module linker in dynamically.

> Let's look at what we can expect to remove from the kernel by moving
> the linking stage out.  Probably the most complex architecture to link
> is ia64.  And that linker is 507 lines (approx, it needs to be updated
> to the latest patch).  x86 is 130 lines.  Add maybe 200 lines of
> arch-independent code to help.
>
> It it *now* clear why I'm not interested in saving a few hundred lines
> of kernel code, even if the communication overhead didn't eat them up
> again?

It's not only this. A kernel linker would force us to keep all symbol
information in kernel space. Doing the linking in userspace would allow us
to remove all symbol information from the kernel (and only keep them for
debugging, e.g. kksymoops), even module dependency tracking could be done
completely from userspace. Module related information could be reduced to
an absolute minimum, so that a nonmodular kernel had no advantage to a
modular kernel anymore.

bye, Roman


  reply	other threads:[~2002-09-25 21:23 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-18  2:05 [PATCH] In-kernel module loader 1/7 Rusty Russell
2002-09-18 22:59 ` Roman Zippel
2002-09-19  1:00   ` Rusty Russell
2002-09-19  2:19     ` Daniel Jacobowitz
2002-09-19  3:57       ` Rusty Russell
2002-09-19 10:44     ` Roman Zippel
2002-09-19 12:51       ` Rusty Russell
2002-09-19 13:54         ` Roman Zippel
2002-09-19 18:38           ` Greg KH
2002-09-19 18:58             ` Alan Cox
2002-09-19 20:11               ` Greg KH
2002-09-19 20:42                 ` Roman Zippel
2002-09-30 15:32                 ` Daniel Phillips
2002-10-03 18:53                   ` Rob Landley
2002-10-04  0:10                     ` Daniel Phillips
2002-10-15  3:25                   ` Rusty Russell
2002-10-15 15:28                     ` Daniel Phillips
2002-10-15 23:53                       ` Rusty Russell
2002-10-16  2:59                         ` Daniel Phillips
2002-10-16  6:11                           ` Rusty Russell
2002-10-16 17:33                             ` Daniel Phillips
2002-10-16 22:48                               ` Rusty Russell
2002-10-17  1:57                                 ` Daniel Phillips
2002-10-17  7:41                                   ` Rusty Russell
2002-10-17 14:49                                     ` Roman Zippel
2002-10-17 14:56                                     ` your mail Kai Germaschewski
2002-10-18  2:47                                       ` Rusty Russell
2002-10-18 21:50                                         ` Kai Germaschewski
2002-10-17 17:20                                     ` [RFC] change format of LSM hooks Daniel Phillips
2002-10-18  2:04                                       ` Rusty Russell
2002-10-17 17:25                                     ` Daniel Phillips
2002-10-16  8:15                         ` [PATCH] In-kernel module loader 1/7 Chris Wright
2002-09-19 20:10             ` Roman Zippel
2002-09-20  1:22             ` Rusty Russell
2002-09-20  4:32               ` Greg KH
2002-09-20  9:25                 ` Rusty Russell
2002-09-21  7:38               ` Kevin O'Connor
2002-09-22 23:31                 ` Rusty Russell
2002-09-19 23:44           ` Rusty Russell
2002-09-20  9:32             ` Roman Zippel
2002-09-21  4:17               ` Rusty Russell
2002-09-21 17:09                 ` Roman Zippel
2002-09-23  0:20                   ` Rusty Russell
2002-09-24 10:16                     ` Roman Zippel
2002-09-24 14:54                       ` Rusty Russell
2002-09-25  0:46                         ` Roman Zippel
2002-09-25  5:50                           ` Rusty Russell
2002-09-25 11:36                             ` Roman Zippel
2002-09-25 12:53                               ` Rusty Russell
2002-09-25 21:28                                 ` Roman Zippel [this message]
2002-09-26  1:49                                   ` Rusty Russell
2002-09-26 23:38                                     ` Roman Zippel
2002-09-27  1:11                                       ` Scott Murray
2002-09-27  1:34                                         ` Roman Zippel
2002-09-28  0:48                                           ` David Lang
2002-10-15  4:53                                       ` Rusty Russell

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.0209252003370.338-100000@serv \
    --to=zippel@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).