[GIT PULL] x86/asm changes for v4.14

From: Ingo Molnar
Date: Mon Sep 04 2017 - 03:53:27 EST


Linus,

Please pull the latest x86-asm-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-asm-for-linus

# HEAD: dd88a0a0c8615417fe6b4285769b5b772de87279 objtool: Handle GCC stack pointer adjustment bug

The main highlights for this cycle are:

- Introduce the ORC unwinder, which can be enabled via CONFIG_ORC_UNWINDER=y.

The ORC unwinder is a lightweight, Linux kernel specific debuginfo
implementation, which aims to be DWARF done right for unwinding. Objtool is
used to generate the ORC unwinder tables during build, so the data format is
flexible and kernel internal: there's no dependency on debuginfo created by an
external toolchain.

The ORC unwinder is almost two orders of magnitude faster than the (out of
tree) DWARF unwinder - which is important for perf call graph profiling. It is
also significantly simpler and is coded defensively: there has not been a
single ORC related kernel crash so far, even with early versions. (knock on
wood!)

But the main advantage is that enabling the ORC unwinder allows
CONFIG_FRAME_POINTERS to be turned off - which speeds up the kernel measurably:

With frame pointers disabled, GCC does not have to add frame pointer
instrumentation code to every function in the kernel. The kernel's .text
size decreases by about 3.2%, resulting in better cache utilization and fewer
instructions executed, resulting in a broad kernel-wide speedup. Average
speedup of system calls should be roughly in the 1-3% range - measurements by
Mel Gorman [1] have shown a speedup of 5-10% for some function execution
intense workloads.

The main cost of the unwinder is that the unwinder data has to be stored in
RAM: the memory cost is 2-4MB of RAM, depending on kernel config - which is a
modest cost on modern x86 systems.

Given how young the ORC unwinder code is it's not enabled by default - but
given the performance advantages the plan is to eventually make it the default
unwinder on x86.

See Documentation/x86/orc-unwinder.txt for more details.

- Remove lguest support: its intended role was that of a temporary proof of
concept for virtualization, plus its removal will enable the reduction
(removal) of the paravirt API as well, so Rusty agreed to its removal.
(Juergen Gross)

- Clean up and fix FSGS related functionality (Andy Lutomirski)

- Clean up IO access APIs (Andy Shevchenko)

- Enhance the symbol namespace (Jiri Slaby)

Thanks,

Ingo

------------------>
Andy Lutomirski (13):
x86/entry/64: Refactor IRQ stacks and make them NMI-safe
x86/entry/64: Initialize the top of the IRQ stack before switching stacks
x86/ldt/64: Refresh DS and ES when modify_ldt changes an entry
x86/asm/32: Make pt_regs's segment registers be 16 bits
x86/traps: Don't clear segment high bits in early_idt_handler_common()
x86/asm/32: Remove a bunch of '& 0xffff' from pt_regs segment reads
x86/xen/64: Rearrange the SYSCALL entries
x86/asm/32: Fix regs_get_register() on segment registers
x86/fsgsbase/64: Fully initialize FS and GS state in start_thread_common
x86/fsgsbase/64: Report FSBASE and GSBASE correctly in core dumps
selftests/x86/fsgsbase: Test selectors 1, 2, and 3
x86/switch_to/64: Rewrite FS/GS switching yet again to fix AMD CPUs
x86/xen/64: Fix the reported SS and CS in SYSCALL

Andy Shevchenko (5):
x86/io: Define IO accessors by preprocessor
x86/io: Include asm-generic/io.h to architectural code
x86/io: Remove mem*io() duplications
x86/io: Remove xlate_dev_kmem_ptr() duplication
x86/io: Make readq() / writeq() API consistent

Jiri Slaby (4):
x86/boot/32: Extract efi_pe_entry() from startup_32()
x86/boot/64: Extract efi_pe_entry() from startup_64()
x86/fpu/math-emu: Add ENDPROC to functions
x86/entry/64: Use ENTRY() instead of ALIGN+GLOBAL for stub32_clone()

Josh Poimboeuf (20):
x86/dumpstack: Fix occasionally missing registers
x86/dumpstack: Fix interrupt and exception stack boundary checks
objtool: Add ORC unwind table generation
objtool, x86: Add facility for asm code to provide unwind hints
x86/entry/64: Add unwind hint annotations
x86/asm: Add unwind hint annotations to sync_core()
objtool: Fix gcov check for older versions of GCC
x86/asm: Make objtool unreachable macros independent from GCC version
x86/unwind: Add the ORC unwinder
x86/kconfig: Make it easier to switch to the new ORC unwinder
x86/kconfig: Consolidate unwinders into multiple choice selection
objtool: Assume unannotated UD2 instructions are dead ends
objtool: Skip unreachable warnings for 'alt' instructions
objtool: Fix '-mtune=atom' decoding support in objtool 2.0
objtool: Disable GCC '-Wpacked' warnings
x86/asm: Fix UNWIND_HINT_REGS macro for older binutils
objtool: Fix validate_branch() return codes
objtool: Track DRAP separately from callee-saved registers
objtool: Fix objtool fallthrough detection with function padding
objtool: Handle GCC stack pointer adjustment bug

Juergen Gross (2):
x86/paravirt/xen: Remove xen_patch()
x86/lguest: Remove lguest support

Kees Cook (2):
x86/asm: Add suffix macro for GEN_*_RMWcc()
x86/asm: Add ASM_UNREACHABLE

Peter Zijlstra (1):
x86: Clarify/fix no-op barriers for text_poke_bp()


Documentation/x86/orc-unwinder.txt | 179 ++
MAINTAINERS | 11 -
arch/um/include/asm/unwind.h | 8 +
arch/x86/Kbuild | 3 -
arch/x86/Kconfig | 6 +-
arch/x86/Kconfig.debug | 59 +-
arch/x86/boot/compressed/head_32.S | 129 +-
arch/x86/boot/compressed/head_64.S | 112 +-
arch/x86/configs/tiny.config | 2 +
arch/x86/entry/Makefile | 1 -
arch/x86/entry/calling.h | 5 +
arch/x86/entry/entry_64.S | 179 +-
arch/x86/entry/entry_64_compat.S | 11 +-
arch/x86/ia32/ia32_signal.c | 2 +-
arch/x86/include/asm/elf.h | 15 +-
arch/x86/include/asm/io.h | 98 +-
arch/x86/include/asm/lguest.h | 91 -
arch/x86/include/asm/lguest_hcall.h | 74 -
arch/x86/include/asm/module.h | 9 +
arch/x86/include/asm/orc_lookup.h | 46 +
arch/x86/include/asm/orc_types.h | 107 +
arch/x86/include/asm/processor.h | 5 +-
arch/x86/include/asm/ptrace.h | 43 +-
arch/x86/include/asm/rmwcc.h | 37 +-
arch/x86/include/asm/unwind.h | 76 +-
arch/x86/include/asm/unwind_hints.h | 105 +
arch/x86/include/uapi/asm/bootparam.h | 2 +-
arch/x86/kernel/Makefile | 8 +-
arch/x86/kernel/alternative.c | 22 +-
arch/x86/kernel/asm-offsets_32.c | 20 -
arch/x86/kernel/dumpstack.c | 14 +-
arch/x86/kernel/dumpstack_32.c | 4 +-
arch/x86/kernel/dumpstack_64.c | 4 +-
arch/x86/kernel/head_32.S | 22 +-
arch/x86/kernel/ldt.c | 21 +
arch/x86/kernel/module.c | 11 +-
arch/x86/kernel/platform-quirks.c | 1 -
arch/x86/kernel/process_32.c | 2 +-
arch/x86/kernel/process_64.c | 242 +-
arch/x86/kernel/setup.c | 3 +
arch/x86/kernel/signal.c | 2 +-
arch/x86/kernel/step.c | 2 +-
arch/x86/kernel/unwind_frame.c | 39 +-
arch/x86/kernel/unwind_guess.c | 5 +
arch/x86/kernel/unwind_orc.c | 582 ++++
arch/x86/kernel/vmlinux.lds.S | 3 +
arch/x86/kvm/Kconfig | 1 -
arch/x86/lguest/Kconfig | 14 -
arch/x86/lguest/Makefile | 2 -
arch/x86/lguest/boot.c | 1558 ----------
arch/x86/lguest/head_32.S | 192 --
arch/x86/math-emu/div_Xsig.S | 1 +
arch/x86/math-emu/div_small.S | 2 +-
arch/x86/math-emu/mul_Xsig.S | 4 +-
arch/x86/math-emu/polynom_Xsig.S | 1 +
arch/x86/math-emu/reg_norm.S | 2 +
arch/x86/math-emu/reg_round.S | 2 +
arch/x86/math-emu/reg_u_add.S | 1 +
arch/x86/math-emu/reg_u_div.S | 2 +
arch/x86/math-emu/reg_u_mul.S | 1 +
arch/x86/math-emu/reg_u_sub.S | 1 +
arch/x86/math-emu/round_Xsig.S | 4 +-
arch/x86/math-emu/shr_Xsig.S | 1 +
arch/x86/math-emu/wm_shrx.S | 2 +
arch/x86/math-emu/wm_sqrt.S | 1 +
arch/x86/mm/extable.c | 2 +-
arch/x86/xen/enlighten_pv.c | 59 +-
arch/x86/xen/xen-asm.S | 26 +-
arch/x86/xen/xen-asm.h | 12 -
arch/x86/xen/xen-asm_32.S | 27 +-
arch/x86/xen/xen-asm_64.S | 61 +-
arch/x86/xen/xen-ops.h | 15 +-
drivers/Makefile | 1 -
drivers/block/Kconfig | 2 +-
drivers/char/Kconfig | 2 +-
drivers/char/virtio_console.c | 2 +-
drivers/lguest/Kconfig | 13 -
drivers/lguest/Makefile | 26 -
drivers/lguest/README | 47 -
drivers/lguest/core.c | 398 ---
drivers/lguest/hypercalls.c | 304 --
drivers/lguest/interrupts_and_traps.c | 706 -----
drivers/lguest/lg.h | 258 --
drivers/lguest/lguest_user.c | 446 ---
drivers/lguest/page_tables.c | 1239 --------
drivers/lguest/segments.c | 228 --
drivers/lguest/x86/core.c | 724 -----
drivers/lguest/x86/switcher_32.S | 388 ---
drivers/net/Kconfig | 2 +-
drivers/tty/hvc/Kconfig | 2 +-
drivers/virtio/Kconfig | 4 +-
include/asm-generic/io.h | 27 +
include/asm-generic/vmlinux.lds.h | 27 +-
include/linux/compiler-gcc.h | 11 -
include/linux/compiler.h | 28 +-
include/linux/lguest.h | 73 -
include/linux/lguest_launcher.h | 44 -
include/uapi/linux/virtio_ring.h | 4 +-
lib/Kconfig.debug | 9 +-
scripts/Makefile.build | 17 +-
tools/Makefile | 11 +-
tools/lguest/.gitignore | 2 -
tools/lguest/Makefile | 14 -
tools/lguest/extract | 58 -
tools/lguest/lguest.c | 3420 ----------------------
tools/lguest/lguest.txt | 125 -
tools/objtool/Build | 3 +
tools/objtool/Documentation/stack-validation.txt | 56 +-
tools/objtool/Makefile | 6 +-
tools/objtool/arch.h | 5 +-
tools/objtool/arch/x86/decode.c | 91 +-
tools/objtool/builtin-check.c | 7 +-
tools/objtool/builtin-orc.c | 70 +
tools/objtool/builtin.h | 1 +
tools/objtool/cfi.h | 2 +-
tools/objtool/check.c | 498 +++-
tools/objtool/check.h | 22 +-
tools/objtool/elf.c | 212 +-
tools/objtool/elf.h | 15 +-
tools/objtool/objtool.c | 3 +-
tools/objtool/orc.h | 30 +
tools/objtool/orc_dump.c | 212 ++
tools/objtool/orc_gen.c | 214 ++
tools/objtool/orc_types.h | 107 +
tools/testing/selftests/x86/fsgsbase.c | 41 +-
125 files changed, 3327 insertions(+), 11346 deletions(-)
create mode 100644 Documentation/x86/orc-unwinder.txt
create mode 100644 arch/um/include/asm/unwind.h
delete mode 100644 arch/x86/include/asm/lguest.h
delete mode 100644 arch/x86/include/asm/lguest_hcall.h
create mode 100644 arch/x86/include/asm/orc_lookup.h
create mode 100644 arch/x86/include/asm/orc_types.h
create mode 100644 arch/x86/include/asm/unwind_hints.h
create mode 100644 arch/x86/kernel/unwind_orc.c
delete mode 100644 arch/x86/lguest/Kconfig
delete mode 100644 arch/x86/lguest/Makefile
delete mode 100644 arch/x86/lguest/boot.c
delete mode 100644 arch/x86/lguest/head_32.S
delete mode 100644 arch/x86/xen/xen-asm.h
delete mode 100644 drivers/lguest/Kconfig
delete mode 100644 drivers/lguest/Makefile
delete mode 100644 drivers/lguest/README
delete mode 100644 drivers/lguest/core.c
delete mode 100644 drivers/lguest/hypercalls.c
delete mode 100644 drivers/lguest/interrupts_and_traps.c
delete mode 100644 drivers/lguest/lg.h
delete mode 100644 drivers/lguest/lguest_user.c
delete mode 100644 drivers/lguest/page_tables.c
delete mode 100644 drivers/lguest/segments.c
delete mode 100644 drivers/lguest/x86/core.c
delete mode 100644 drivers/lguest/x86/switcher_32.S
delete mode 100644 include/linux/lguest.h
delete mode 100644 include/linux/lguest_launcher.h
delete mode 100644 tools/lguest/.gitignore
delete mode 100644 tools/lguest/Makefile
delete mode 100644 tools/lguest/extract
delete mode 100644 tools/lguest/lguest.c
delete mode 100644 tools/lguest/lguest.txt
create mode 100644 tools/objtool/builtin-orc.c
create mode 100644 tools/objtool/orc.h
create mode 100644 tools/objtool/orc_dump.c
create mode 100644 tools/objtool/orc_gen.c
create mode 100644 tools/objtool/orc_types.h