All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Speed booting by sorting exception tables at build time.
@ 2012-04-19 21:59 David Daney
  2012-04-19 21:59 ` [PATCH v1 1/5] scripts: Add sortextable to sort the kernel's exception table David Daney
                   ` (4 more replies)
  0 siblings, 5 replies; 41+ messages in thread
From: David Daney @ 2012-04-19 21:59 UTC (permalink / raw)
  To: Ralf Baechle, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Linus Torvalds, Michal Marek
  Cc: linux-kernel, linux-mips, Andrew Morton, David Daney

From: David Daney <david.daney@cavium.com>

v2: Cosmetic changes only.  Cleanup makefile indentation.  Rebase MIPS
    and x86 Kconfig changes against 3.4-rc2.

    Michal Marek had suggested using $(call cmd,sortextable), but I
    wasn't able to figure out a good way to do that *and* have it print
    'SORTEX vmlinux', so I left it as I originally had it.

v1:

I noticed when booting MIPS64 kernels that sorting of the main
__ex_table was taking a long time (2,692,220 cycles or 3.3 mS at
800MHz to be exact).  That is not too bad for real silicon
implementations, but when running on a slow simulator, it can be
significant.

I can get this down to about 1,000,000 cycles by supplying a custom
swap function for the sort, but even better is to eliminate it
entirely by doing the sort at build time. That is the idea behind
this patch set.

Here is more or less what I did:

o A flag word is added to the kernel to indicate that the __ex_table
  is already sorted.  sort_main_extable() checks this and if it is
  clear, returns without doing the sort.

o I shamelessly stole code from recordmcount and created a new build
  time helper program 'sortextable'.  This is run on the final vmlinux
  image, it sorts the table, and then clears the flag word.

Potential areas for improvement:

o Sort module exception tables too.

o Get rid of the flag word, and assume that if an architecture supports
  build time sorting, that it must have been done.

o Add support for architectures other than MIPS and x86

David Daney (5):
  scripts: Add sortextable to sort the kernel's exception table.
  extable: Skip sorting if sorted at build time.
  kbuild/extable: Hook up sortextable into the build system.
  MIPS: Select BUILDTIME_EXTABLE_SORT
  x86: Select BUILDTIME_EXTABLE_SORT

 Makefile              |   10 ++
 arch/mips/Kconfig     |    1 +
 arch/x86/Kconfig      |    1 +
 init/Kconfig          |    3 +
 kernel/extable.c      |    8 ++-
 scripts/.gitignore    |    1 +
 scripts/Makefile      |    1 +
 scripts/sortextable.c |  273 +++++++++++++++++++++++++++++++++++++++++++++++++
 scripts/sortextable.h |  168 ++++++++++++++++++++++++++++++
 9 files changed, 465 insertions(+), 1 deletions(-)
 create mode 100644 scripts/sortextable.c
 create mode 100644 scripts/sortextable.h

-- 
1.7.2.3


^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2012-04-21  1:17 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 21:59 [PATCH v2 0/5] Speed booting by sorting exception tables at build time David Daney
2012-04-19 21:59 ` [PATCH v1 1/5] scripts: Add sortextable to sort the kernel's exception table David Daney
2012-04-20  0:20   ` [tip:x86/extable] scripts: Add sortextable to sort the kernel' s " tip-bot for David Daney
2012-04-20  1:44   ` [PATCH v1 1/5] scripts: Add sortextable to sort the kernel's " H. Peter Anvin
2012-04-20  3:17     ` David Daney
2012-04-20  3:31       ` Linus Torvalds
2012-04-20  3:42         ` H. Peter Anvin
2012-04-20  4:49           ` H. Peter Anvin
2012-04-20  4:54             ` H. Peter Anvin
2012-04-20 21:55         ` [tip:x86/extable] x86, extable: Use .pushsection ... . popsection for _ASM_EXTABLE() tip-bot for H. Peter Anvin
2012-04-20 21:56         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/ia32/ia32entry.S tip-bot for H. Peter Anvin
2012-04-20 21:57         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/kernel/entry_32.S tip-bot for H. Peter Anvin
2012-04-20 21:58         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/kernel/entry_64.S tip-bot for H. Peter Anvin
2012-04-20 21:58         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/kernel/test_rodata.c tip-bot for H. Peter Anvin
2012-04-20 21:59         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/lib/checksum_32.S tip-bot for H. Peter Anvin
2012-04-20 22:00         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/lib/copy_user_64.S tip-bot for H. Peter Anvin
2012-04-20 22:01         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/lib/ copy_user_nocache_64.S tip-bot for H. Peter Anvin
2012-04-20 22:02         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/lib/csum-copy_64.S tip-bot for H. Peter Anvin
2012-04-20 22:03         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/lib/getuser.S tip-bot for H. Peter Anvin
2012-04-20 22:03         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/lib/putuser.S tip-bot for H. Peter Anvin
2012-04-20 22:04         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/lib/usercopy_32.c tip-bot for H. Peter Anvin
2012-04-20 22:05         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/um/checksum_32.S tip-bot for H. Peter Anvin
2012-04-20 22:06         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/xen/xen-asm_32.S tip-bot for H. Peter Anvin
2012-04-20 22:07         ` [tip:x86/extable] x86, extable: Remove the now-unused __ASM_EX_SEC macros tip-bot for H. Peter Anvin
2012-04-20 22:08         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/include/asm/kvm_host .h tip-bot for H. Peter Anvin
2012-04-20 22:08         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/include/asm/xsave.h tip-bot for H. Peter Anvin
2012-04-21  0:16         ` [tip:x86/extable] x86, extable: Remove open-coded exception table entries in arch/x86/ia32/ia32entry.S tip-bot for H. Peter Anvin
2012-04-21  0:17         ` [tip:x86/extable] x86, extable: Add _ASM_EXTABLE_EX() macro tip-bot for H. Peter Anvin
2012-04-21  1:16         ` [tip:x86/extable] x86, extable: Disable presorted exception table for now tip-bot for H. Peter Anvin
2012-04-21  1:17         ` [tip:x86/extable] x86, extable: Switch to relative exception table entries tip-bot for H. Peter Anvin
2012-04-20 14:59   ` [PATCH v1 1/5] scripts: Add sortextable to sort the kernel's exception table Sam Ravnborg
2012-04-20 16:49     ` David Daney
2012-04-19 21:59 ` [PATCH v2 2/5] extable: Skip sorting if sorted at build time David Daney
2012-04-20  0:21   ` [tip:x86/extable] " tip-bot for David Daney
2012-04-19 21:59 ` [PATCH v2 3/5] kbuild/extable: Hook up sortextable into the build system David Daney
2012-04-20  0:22   ` [tip:x86/extable] " tip-bot for David Daney
2012-04-20 15:02   ` [PATCH v2 3/5] " Sam Ravnborg
2012-04-19 21:59 ` [PATCH v2 4/5] MIPS: Select BUILDTIME_EXTABLE_SORT David Daney
2012-04-20  0:23   ` [tip:x86/extable] " tip-bot for David Daney
2012-04-19 21:59 ` [PATCH v2 5/5] x86: " David Daney
2012-04-20  0:23   ` [tip:x86/extable] " tip-bot for David Daney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.