linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] add support for relative references in special sections
@ 2017-08-14 10:52 Ard Biesheuvel
  2017-08-14 10:52 ` Ard Biesheuvel
                   ` (6 more replies)
  0 siblings, 7 replies; 34+ messages in thread
From: Ard Biesheuvel @ 2017-08-14 10:52 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: Ard Biesheuvel, H. Peter Anvin, Arnd Bergmann, Heiko Carstens,
	Kees Cook, Will Deacon, Michael Ellerman, Thomas Garnier,
	Thomas Gleixner, Serge E. Hallyn, Bjorn Helgaas,
	Benjamin Herrenschmidt, Paul Mackerras, Catalin Marinas,
	Petr Mladek, Ingo Molnar, James Morris, Andrew Morton,
	Nicolas Pitre, Steven Rostedt

This adds support for emitting special sections such as initcall arrays,
PCI fixups and tracepoints as relative references rather than absolute
references. This reduces the size by 50% on 64-bit architectures, but
more importantly, it removes the need for carrying relocation metadata
for these sections in relocatables kernels (e.g., for KASLR) that need
to fix up these absolute references at boot time. On arm64, this reduces
the vmlinux footprint of such a reference by 8x (8 byte absolute reference
+ 24 byte RELA entry vs 4 byte relative reference)

Patch #2 was sent out before as a single patch. This series supersedes
the previous submission. This version makes relative ksymtab entries
dependent on the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS rather
than trying to infer from kbuild test robot replies for which architectures
it should be blacklisted.

Patch #1 introduces the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS,
and sets it for the main architectures that are expected to benefit most
from this feature, i.e., 64-bit architectures, and ones that use runtime
relocation.

Patches #3 - #5 implement relative references for initcallls, PCI fixups
and tracepoints, respectively, all of which produce sections with order
~1000 entries on an arm64 defconfig kernel with tracing enabled. This
means we save about 28 KB of vmlinux space for each of these patches.

For the arm64 kernel, all patches combined reduce the size of vmlinux
by about 300 KB.

Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jessica Yu <jeyu@kernel.org>

Ard Biesheuvel (5):
  arch: enable relative relocations for arm64, power, x86, s390 and x86
  module: use relative references for __ksymtab entries
  init: allow initcall tables to be emitted using relative references
  drivers: pci: add support for relative addressing in quirk tables
  kernel: tracepoints: add support for relative references

 arch/Kconfig                    | 10 +++++
 arch/arm64/Kconfig              |  1 +
 arch/arm64/kernel/vmlinux.lds.S |  2 +-
 arch/powerpc/Kconfig            |  1 +
 arch/s390/Kconfig               |  1 +
 arch/x86/Kconfig                |  1 +
 arch/x86/include/asm/Kbuild     |  1 +
 arch/x86/include/asm/export.h   |  4 --
 drivers/pci/quirks.c            | 13 ++++--
 include/asm-generic/export.h    | 12 ++++-
 include/linux/compiler.h        | 11 +++++
 include/linux/export.h          | 47 +++++++++++++++-----
 include/linux/init.h            | 44 +++++++++++++-----
 include/linux/pci.h             | 20 +++++++++
 include/linux/tracepoint.h      | 19 ++++++--
 init/main.c                     | 32 ++++++-------
 kernel/module.c                 | 33 +++++++++++---
 kernel/printk/printk.c          |  4 +-
 kernel/tracepoint.c             | 19 +++++---
 security/security.c             |  4 +-
 20 files changed, 212 insertions(+), 67 deletions(-)
 delete mode 100644 arch/x86/include/asm/export.h

-- 
2.11.0

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

end of thread, other threads:[~2017-08-18 18:17 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-14 10:52 [PATCH 0/5] add support for relative references in special sections Ard Biesheuvel
2017-08-14 10:52 ` Ard Biesheuvel
2017-08-14 10:52 ` [PATCH 1/5] arch: enable relative relocations for arm64, power, x86, s390 and x86 Ard Biesheuvel
2017-08-14 10:52   ` Ard Biesheuvel
2017-08-14 10:52 ` [PATCH 2/5] module: use relative references for __ksymtab entries Ard Biesheuvel
2017-08-14 10:52   ` Ard Biesheuvel
2017-08-14 10:52 ` [PATCH 3/5] init: allow initcall tables to be emitted using relative references Ard Biesheuvel
2017-08-14 10:52   ` Ard Biesheuvel
2017-08-14 10:52 ` [PATCH 4/5] drivers: pci: add support for relative addressing in quirk tables Ard Biesheuvel
2017-08-14 10:52   ` Ard Biesheuvel
2017-08-14 10:52 ` [PATCH 5/5] kernel: tracepoints: add support for relative references Ard Biesheuvel
2017-08-14 10:52   ` Ard Biesheuvel
2017-08-14 15:23   ` Steven Rostedt
2017-08-14 15:23     ` Steven Rostedt
2017-08-14 15:29     ` Ard Biesheuvel
2017-08-14 15:29       ` Ard Biesheuvel
2017-08-18  8:26   ` Ingo Molnar
2017-08-18  8:26     ` Ingo Molnar
2017-08-18  8:36     ` Ard Biesheuvel
2017-08-18  8:36       ` Ard Biesheuvel
2017-08-18  9:24       ` Ard Biesheuvel
2017-08-18  9:24         ` Ard Biesheuvel
2017-08-18 17:58         ` Ingo Molnar
2017-08-18 17:58           ` Ingo Molnar
2017-08-18 18:17           ` Ard Biesheuvel
2017-08-18 18:17             ` Ard Biesheuvel
2017-08-18  5:56 ` [PATCH 0/5] add support for relative references in special sections Sergey Senozhatsky
2017-08-18  5:56   ` Sergey Senozhatsky
2017-08-18  6:12   ` Ard Biesheuvel
2017-08-18  6:12     ` Ard Biesheuvel
2017-08-18  6:29     ` Sergey Senozhatsky
2017-08-18  6:29       ` Sergey Senozhatsky
2017-08-18  6:33       ` Ard Biesheuvel
2017-08-18  6:33         ` Ard Biesheuvel

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).