diff options
author | Michael Holzheu <holzheu@linux.vnet.ibm.com> | 2015-04-29 12:45:03 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-04-30 07:50:36 -0400 |
commit | b9b4b1cef156e6b403b26ea4cb6d0caf4850e05c (patch) | |
tree | 9bb2bf0f11606fced09af930588c9e2301f9ecf1 /arch/s390 | |
parent | 8cc2af7c530e320db442e6efec8c84c125c07c81 (diff) |
s390/bpf: Fix gcov stack space problem
When compiling the kernel for GCOV (CONFIG_GCOV_KERNEL,-fprofile-arcs),
gcc allocates a lot of stack space because of the large switch statement
in bpf_jit_insn().
This leads to the following compile warning:
arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_prog':
arch/s390/net/bpf_jit_comp.c:1144:1: warning: frame size of
function 'bpf_jit_prog' is 12592 bytes which is more than
half the stack size. The dynamic check would not be reliable.
No check emitted for this function.
arch/s390/net/bpf_jit_comp.c:1144:1: warning: the frame size of 12504
bytes is larger than 1024 bytes [-Wframe-larger-than=]
And indead gcc allocates 12592 bytes of stack space:
# objdump -d arch/s390/net/bpf_jit_comp.o
...
0000000000000c60 <bpf_jit_prog>:
c60: eb 6f f0 48 00 24 stmg %r6,%r15,72(%r15)
c66: b9 04 00 ef lgr %r14,%r15
c6a: e3 f0 fe d0 fc 71 lay %r15,-12592(%r15)
As a workaround of that problem we now define bpf_jit_insn() as
noinline which then reduces the stack space.
# objdump -d arch/s390/net/bpf_jit_comp.o
...
0000000000000070 <bpf_jit_insn>:
70: eb 6f f0 48 00 24 stmg %r6,%r15,72(%r15)
76: c0 d0 00 00 00 00 larl %r13,76 <bpf_jit_insn+0x6>
7c: a7 f1 3f 80 tmll %r15,16256
80: b9 04 00 ef lgr %r14,%r15
84: e3 f0 ff a0 ff 71 lay %r15,-96(%r15)
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/net/bpf_jit_comp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 065aca02bc65..20c146d1251a 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c | |||
@@ -443,8 +443,11 @@ static void bpf_jit_epilogue(struct bpf_jit *jit) | |||
443 | 443 | ||
444 | /* | 444 | /* |
445 | * Compile one eBPF instruction into s390x code | 445 | * Compile one eBPF instruction into s390x code |
446 | * | ||
447 | * NOTE: Use noinline because for gcov (-fprofile-arcs) gcc allocates a lot of | ||
448 | * stack space for the large switch statement. | ||
446 | */ | 449 | */ |
447 | static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | 450 | static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) |
448 | { | 451 | { |
449 | struct bpf_insn *insn = &fp->insnsi[i]; | 452 | struct bpf_insn *insn = &fp->insnsi[i]; |
450 | int jmp_off, last, insn_count = 1; | 453 | int jmp_off, last, insn_count = 1; |