linux/arch
Michael Holzheu 6651ee070b s390/bpf: implement bpf_tail_call() helper
bpf_tail_call() arguments:

 - ctx......: Context pointer
 - jmp_table: One of BPF_MAP_TYPE_PROG_ARRAY maps used as the jump table
 - index....: Index in the jump table

In this implementation s390x JIT does stack unwinding and jumps into the
callee program prologue. Caller and callee use the same stack.

With this patch a tail call generates the following code on s390x:

 if (index >= array->map.max_entries)
         goto out
 000003ff8001c7e4: e31030100016   llgf    %r1,16(%r3)
 000003ff8001c7ea: ec41001fa065   clgrj   %r4,%r1,10,3ff8001c828

 if (tail_call_cnt++ > MAX_TAIL_CALL_CNT)
         goto out;
 000003ff8001c7f0: a7080001       lhi     %r0,1
 000003ff8001c7f4: eb10f25000fa   laal    %r1,%r0,592(%r15)
 000003ff8001c7fa: ec120017207f   clij    %r1,32,2,3ff8001c828

 prog = array->prog[index];
 if (prog == NULL)
         goto out;
 000003ff8001c800: eb140003000d   sllg    %r1,%r4,3
 000003ff8001c806: e31310800004   lg      %r1,128(%r3,%r1)
 000003ff8001c80c: ec18000e007d   clgij   %r1,0,8,3ff8001c828

 Restore registers before calling function
 000003ff8001c812: eb68f2980004   lmg     %r6,%r8,664(%r15)
 000003ff8001c818: ebbff2c00004   lmg     %r11,%r15,704(%r15)

 goto *(prog->bpf_func + tail_call_start);
 000003ff8001c81e: e31100200004   lg      %r1,32(%r1,%r0)
 000003ff8001c824: 47f01006       bc      15,6(%r1)

Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-09 11:47:10 -07:00
..
alpha alpha: kernel: osf_sys: Set 'kts.tv_nsec' only when 'tv' has effect 2015-05-26 10:01:51 -07:00
arc ARC: inline cache flush toggle helpers 2015-05-11 11:21:41 +05:30
arm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-06-08 20:06:56 -07:00
arm64 - dts: mt8173: fix compatible string 2015-06-01 17:06:51 +02:00
avr32
blackfin
c6x
cris
frv
hexagon
ia64 ia64: make cpu_callin_map non-volatile. 2015-06-02 10:07:03 -07:00
m32r m32r: make flush_cpumask non-volatile. 2015-05-09 11:09:29 -07:00
m68k
metag
microblaze
mips MIPS: KVM: Do not sign extend on unsigned MMIO load 2015-06-06 10:21:10 +02:00
mn10300
nios2
openrisc
parisc parisc,metag: Fix crashes due to stack randomization on stack-grows-upwards architectures 2015-05-12 22:03:44 +02:00
powerpc This pull request includes a fix for two oopses, one on PPC 2015-05-21 20:15:16 -07:00
s390 s390/bpf: implement bpf_tail_call() helper 2015-06-09 11:47:10 -07:00
score
sh
sparc sparc: Resolve conflict between sparc v9 and M7 on usage of bit 9 of TTE 2015-05-31 22:15:01 -07:00
tile
um
unicore32
x86 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-06-08 20:06:56 -07:00
xtensa xtensa: Provide dummy dma_alloc_attrs() and dma_free_attrs() 2015-05-25 23:03:16 +00:00
.gitignore
Kconfig