From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org,
Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 0/8] powerpc/64: use asm sections for head/exception layout
Date: Tue, 13 Sep 2016 13:08:38 +1000 [thread overview]
Message-ID: <20160913030846.29790-1-npiggin@gmail.com> (raw)
Hi,
This patch uses asm/ld sections and macro wrappers to hide the details
of placing exception vectors at the correct location.
Currently we lay out everything in head_64.S as it is to appear in
the output, starting from physical 0, and uses '.' location counter
directives to place vectors correctly.
After this series, sections are created for real and virtual
exceptions, and trampoline/helper spaces, and "common" handlers
are put into .text section. Exception handlers are specified with
macros that define type, name, and locations.
/* This is the entirity of the decrementer handlers */
VECTOR_HANDLER_REAL_MASKABLE(decrementer, 0x900, 0x980)
VECTOR_HANDLER_VIRT_MASKABLE(decrementer, 0x4900, 0x4980, 0x900)
TRAMP_KVM(PACA_EXGEN, 0x900)
COMMON_HANDLER_ASYNC(decrementer_common, 0x900, timer_interrupt)
/* Although not all handlers come out quite so neatly */
Benefits:
* All handler code for a given exception can be grouped together
in the file.
* Important head sections can be identified and handled by the
linker. This can be used to prevent branch stubs from being
placed inside fixed section code, for example.
* Most overflows can be caught at compile-time.
* Shuffling handlers around or making extra space for vectors
becomes much simpler.
However there are some negatives:
* Another layer of macros in exception-64s.S
* asm/linker sections are not trivial to use, taking addresses
can require a helper in some cases because the assembler can't
calculate deltas between sections itself.
Intermediate steps of this patch are quite painful due to lots of
shuffling. I have tried to verify before/after equivalence of
compiled binary using objdump diffs, although it's not always
easy to verify completely (due to offsets and labels and padding
changing).
Vectors do not have to specify exact implementation details,
only requirements, which makes changes easier. For example,
an "inline" handler can be made OOL easily, because the macro
can emit the trampoline code into the correct section:
-VECTOR_HANDLER_REAL_MASKABLE(decrementer, 0x900, 0x980)
+VECTOR_HANDLER_REAL_OOL_MASKABLE(decrementer, 0x900, 0x980)
If 0x3000-0x4000 is required for new hardware exceptions, then
it's a simple change:
OPEN_FIXED_SECTION(real_vectors, 0x0100, 0x1900)
-OPEN_FIXED_SECTION(real_trampolines, 0x1900, 0x4000)
+OPEN_FIXED_SECTION(real_trampolines, 0x1900, 0x3000)
-OPEN_FIXED_SECTION(virt_vectors, 0x4000, 0x6000)
+OPEN_FIXED_SECTION(virt_vectors, 0x3000, 0x6000)
OPEN_FIXED_SECTION(virt_trampolines, 0x6000, 0x7000)
(This does also require sufficient space in real_trampolines)
I posted this series a while ago, but didn't have much feedback.
This one is significantly trimmed down with fewer
unrelated/unnecessary changes.
Comments?
Thanks,
Nick
Nicholas Piggin (8):
powerpc/pseries: hypervisor facility unavailable use correct handler
powerpc/pseries: syscall remove trampoline
powerpc/pseries: exception vector macros
powerpc/pseries: consolidate exception handler alignment
powerpc/64: use gas sections for arranging exception vectors
powerpc/pseries: move related exception code together
powerpc/pseries: use single macro for both parts of OOL exception
powerpc/pseries: remove unused exception code, small cleanups
arch/powerpc/include/asm/exception-64s.h | 135 +-
arch/powerpc/include/asm/head-64.h | 348 +++++
arch/powerpc/kernel/exceptions-64s.S | 2135 ++++++++++++++----------------
arch/powerpc/kernel/head_64.S | 58 +-
arch/powerpc/kernel/vmlinux.lds.S | 45 +-
5 files changed, 1510 insertions(+), 1211 deletions(-)
create mode 100644 arch/powerpc/include/asm/head-64.h
--
2.9.3
next reply other threads:[~2016-09-13 3:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 3:08 Nicholas Piggin [this message]
2016-09-13 3:08 ` [PATCH 1/8] powerpc/pseries: hypervisor facility unavailable use correct handler Nicholas Piggin
2016-09-25 3:00 ` [1/8] " Michael Ellerman
2016-09-13 3:08 ` [PATCH 2/8] powerpc/pseries: syscall remove trampoline Nicholas Piggin
2016-09-25 3:00 ` [2/8] " Michael Ellerman
2016-09-13 3:08 ` [PATCH 3/8] powerpc/pseries: exception vector macros Nicholas Piggin
2016-09-13 6:56 ` kbuild test robot
2016-09-13 9:22 ` Nicholas Piggin
2016-09-13 3:08 ` [PATCH 4/8] powerpc/pseries: consolidate exception handler alignment Nicholas Piggin
2016-09-13 3:08 ` [PATCH 5/8] powerpc/64: use gas sections for arranging exception vectors Nicholas Piggin
2016-09-13 3:08 ` [PATCH 6/8] powerpc/pseries: move related exception code together Nicholas Piggin
2016-09-13 3:08 ` [PATCH 7/8] powerpc/pseries: use single macro for both parts of OOL exception Nicholas Piggin
2016-09-13 3:08 ` [PATCH 8/8] powerpc/pseries: remove unused exception code, small cleanups Nicholas Piggin
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=20160913030846.29790-1-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/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).