Commit 42b01a55 authored by Vasily Gorbik's avatar Vasily Gorbik

s390: always use the packed stack layout

-mpacked-stack option has been supported by both minimum
gcc and clang versions for a while. With commit e2bc3e91
("scripts/min-tool-version.sh: Raise minimum clang version to 13.0.0
for s390") minimum clang version now also supports a combination
of flags -mpacked-stack -mbackchain -pg -mfentry and fulfills
all requirements to always enable the packed stack layout.
Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 9a4f03ad
...@@ -155,7 +155,7 @@ config S390 ...@@ -155,7 +155,7 @@ config S390
select HAVE_DYNAMIC_FTRACE_WITH_ARGS select HAVE_DYNAMIC_FTRACE_WITH_ARGS
select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS select HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
select HAVE_DYNAMIC_FTRACE_WITH_REGS select HAVE_DYNAMIC_FTRACE_WITH_REGS
select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES select HAVE_EBPF_JIT if HAVE_MARCH_Z196_FEATURES
select HAVE_EFFICIENT_UNALIGNED_ACCESS select HAVE_EFFICIENT_UNALIGNED_ACCESS
select HAVE_FAST_GUP select HAVE_FAST_GUP
select HAVE_FENTRY select HAVE_FENTRY
...@@ -656,20 +656,6 @@ config MAX_PHYSMEM_BITS ...@@ -656,20 +656,6 @@ config MAX_PHYSMEM_BITS
Increasing the number of bits also increases the kernel image size. Increasing the number of bits also increases the kernel image size.
By default 46 bits (64TB) are supported. By default 46 bits (64TB) are supported.
config PACK_STACK
def_bool y
prompt "Pack kernel stack"
help
This option enables the compiler option -mkernel-backchain if it
is available. If the option is available the compiler supports
the new stack layout which dramatically reduces the minimum stack
frame size. With an old compiler a non-leaf function needs a
minimum of 96 bytes on 31 bit and 160 bytes on 64 bit. With
-mkernel-backchain the minimum size drops to 16 byte on 31 bit
and 24 byte on 64 bit.
Say Y if you are unsure.
config CHECK_STACK config CHECK_STACK
def_bool y def_bool y
depends on !VMAP_STACK depends on !VMAP_STACK
......
...@@ -21,7 +21,7 @@ endif ...@@ -21,7 +21,7 @@ endif
aflags_dwarf := -Wa,-gdwarf-2 aflags_dwarf := -Wa,-gdwarf-2
KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables
...@@ -68,11 +68,6 @@ cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include ...@@ -68,11 +68,6 @@ cflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
# #
cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
ifneq ($(call cc-option,-mpacked-stack -mbackchain -msoft-float),)
cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
endif
KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y) KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y) KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
...@@ -111,7 +106,7 @@ endif ...@@ -111,7 +106,7 @@ endif
# Test CFI features of binutils # Test CFI features of binutils
cfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1) cfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1)
KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y) KBUILD_CFLAGS += -mpacked-stack -mbackchain -msoft-float $(cflags-y)
KBUILD_CFLAGS += -pipe -Wno-sign-compare KBUILD_CFLAGS += -pipe -Wno-sign-compare
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi) KBUILD_CFLAGS += -fno-asynchronous-unwind-tables $(cfi)
KBUILD_AFLAGS += $(aflags-y) $(cfi) KBUILD_AFLAGS += $(aflags-y) $(cfi)
......
...@@ -36,22 +36,14 @@ static inline bool on_stack(struct stack_info *info, ...@@ -36,22 +36,14 @@ static inline bool on_stack(struct stack_info *info,
/* /*
* Stack layout of a C stack frame. * Stack layout of a C stack frame.
* Kernel uses the packed stack layout (-mpacked-stack).
*/ */
#ifndef __PACK_STACK
struct stack_frame {
unsigned long back_chain;
unsigned long empty1[5];
unsigned long gprs[10];
unsigned int empty2[8];
};
#else
struct stack_frame { struct stack_frame {
unsigned long empty1[5]; unsigned long empty1[5];
unsigned int empty2[8]; unsigned int empty2[8];
unsigned long gprs[10]; unsigned long gprs[10];
unsigned long back_chain; unsigned long back_chain;
}; };
#endif
/* /*
* Unlike current_stack_pointer() which simply returns current value of %r15 * Unlike current_stack_pointer() which simply returns current value of %r15
......
...@@ -26,12 +26,8 @@ ENDPROC(ftrace_stub) ...@@ -26,12 +26,8 @@ ENDPROC(ftrace_stub)
#define STACK_PTREGS_PSW (STACK_PTREGS + __PT_PSW) #define STACK_PTREGS_PSW (STACK_PTREGS + __PT_PSW)
#define STACK_PTREGS_ORIG_GPR2 (STACK_PTREGS + __PT_ORIG_GPR2) #define STACK_PTREGS_ORIG_GPR2 (STACK_PTREGS + __PT_ORIG_GPR2)
#define STACK_PTREGS_FLAGS (STACK_PTREGS + __PT_FLAGS) #define STACK_PTREGS_FLAGS (STACK_PTREGS + __PT_FLAGS)
#ifdef __PACK_STACK /* packed stack: allocate just enough for r14, r15 and backchain */
/* allocate just enough for r14, r15 and backchain */
#define TRACED_FUNC_FRAME_SIZE 24 #define TRACED_FUNC_FRAME_SIZE 24
#else
#define TRACED_FUNC_FRAME_SIZE STACK_FRAME_OVERHEAD
#endif
.macro ftrace_regs_entry, allregs=0 .macro ftrace_regs_entry, allregs=0
stg %r14,(__SF_GPRS+8*8)(%r15) # save traced function caller stg %r14,(__SF_GPRS+8*8)(%r15) # save traced function caller
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* - HAVE_MARCH_Z196_FEATURES: laal, laalg * - HAVE_MARCH_Z196_FEATURES: laal, laalg
* - HAVE_MARCH_Z10_FEATURES: msfi, cgrj, clgrj * - HAVE_MARCH_Z10_FEATURES: msfi, cgrj, clgrj
* - HAVE_MARCH_Z9_109_FEATURES: alfi, llilf, clfi, oilf, nilf * - HAVE_MARCH_Z9_109_FEATURES: alfi, llilf, clfi, oilf, nilf
* - PACK_STACK
* - 64BIT * - 64BIT
* *
* Copyright IBM Corp. 2012,2015 * Copyright IBM Corp. 2012,2015
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment