mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org, linux-modules@vger.org
Subject: Re: [PATCH 2/4] kbuild: sort the list of symbols exported by the kernel (__ksymtab)
Date: Wed, 23 Sep 2009 19:38:54 +0200	[thread overview]
Message-ID: <20090923173854.GA32419@merkur.ravnborg.org> (raw)
In-Reply-To: <4AB8E887.1020507@tuffmail.co.uk>

On Tue, Sep 22, 2009 at 04:08:55PM +0100, Alan Jenkins wrote:
> Sam Ravnborg wrote:
> > On Tue, Sep 22, 2009 at 02:38:36PM +0100, Alan Jenkins wrote:
> >   
> >> modpost of vmlinux.o now extracts the ksymtab sections and outputs
> >> sorted versions of them as .tmp_exports.c.  These sorted sections
> >> are linked into vmlinux and the original unsorted sections are
> >> discarded.
> >>
> >> This will allow modules to be loaded faster, resolving symbols using
> >> binary search, without any increase in the memory needed for the
> >> symbol tables.
> >>
> >> This does not affect the building of modules, so hopefully it won't
> >> affect compile times too much.
> >>     
> >
> > I do not quite follow you here.
> >
> > With your patch:
> >
> > For vmlinux we define our symbols in sections
> > named *_sorted - but they are not sorted.
> >
> > We than create a small .c file that uses the original sections names
> > which is what is used in the final vmlinux.
> >   
> 
> Actually it's intended to work the other way round.
> 
> EXPORT_SYMBOL() generates symbols in __ksymtab as usual.  These get as
> far as vmlinux.o before I start changing anything.
> 
> My .c file then uses __EXPORT_SYMBOL_SORTED() to generate symbols in
> __ksymtab_sorted (or __ksymtab_gpl_sorted etc.), based on the symbols in
> vmlinux.o.  So the _sorted sections _are_ sorted.
> 
> Finally, I changed the vmlinux linker script to effectively rename
> __ksymtab_sorted and discard the original unsorted __ksymtab.
> 
> I hope that clears that up.
> 
> > Could we replace the content of these sections rather than playing
> > games with the names?
> >
> > 	Sam
> >   
> 
> Thinking about it, I guess I could avoid using new section names.  I
> could change the vmlinux linker script to discard all __ksymtab
> sections, _except_ those which came from the file .tmp_exports.o.  (And
> maybe rename .tmp_exports.o to .tmp_sorted_exports.o to make it more
> obvious).
> 
> That would avoid the need to add separate __EXPORT_SYMBOL_NAME() and
> __EXPORT_SYMBOL_SORTED().  OTOH, it means the linker script uses more
> features and is more tightly coupled to the build system.  I.e. the
> script references a specific file.
> 
> I prefer my original method, but I can change it if you disagree :-).

One of the problems you hit is that we use the same linker script for
all the links we do of the kernel image.
I had a patchset that pulled out the final link from the top-level
Makefile and made it a simple shell script.
I should give that another go which would then be a good basis for
this patchset and a simplied final linking.

	Sam

  reply	other threads:[~2009-09-23 17:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-22 13:38 module: Speed up symbol resolution during module loading Alan Jenkins
2009-09-22 13:38 ` [PATCH 1/4] module: extract __ExPORT_SYMBOL from module.h into mod_export.h Alan Jenkins
2009-09-22 14:42   ` Sam Ravnborg
2009-09-22 14:45     ` Alan Jenkins
2009-09-22 15:45   ` Daniel Walker
2009-09-22 15:50     ` Alan Jenkins
2009-09-22 15:55       ` Daniel Walker
2009-09-22 13:38 ` [PATCH 2/4] kbuild: sort the list of symbols exported by the kernel (__ksymtab) Alan Jenkins
2009-09-22 14:48   ` Sam Ravnborg
2009-09-22 15:08     ` Alan Jenkins
2009-09-23 17:38       ` Sam Ravnborg [this message]
2009-09-22 13:38 ` [PATCH 3/4] module: unexport each_symbol() Alan Jenkins
2009-09-23 17:29   ` Tim Abbott
2009-09-23 18:36     ` Alan Jenkins
2009-09-23 22:00     ` Christoph Hellwig
2009-09-24  0:15       ` Rusty Russell
2009-09-26 12:13       ` Alan Jenkins
2009-09-22 13:38 ` [PATCH 4/4] module: speed up find_symbol() using binary search on the builtin symbol tables Alan Jenkins
2009-09-23 17:28   ` [PATCH 0/2] Use generic binary search function Tim Abbott
2009-09-23 18:08     ` Alan Jenkins
2009-09-23 17:28   ` [PATCH 1/2] lib: Add generic binary search function to the kernel Tim Abbott
2009-09-24  0:11     ` Rusty Russell
2009-09-27 17:05       ` Tim Abbott
2009-11-03 15:14         ` Thiago Farina
2009-11-03 15:34           ` Alan Jenkins
2009-09-23 17:28   ` [PATCH 2/2] module: use bsearch in find_symbol_in_kernel_section Tim Abbott

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=20090923173854.GA32419@merkur.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=alan-jenkins@tuffmail.co.uk \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.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

all inboxes | Powered by JetHome®