Skip to content
  • Michael Holzheu's avatar
    s390: Remove VLAIS in ptff() and clear_table() · 11a247e3
    Michael Holzheu authored
    
    
    The ptff() and clear_table() functions use the gcc extension "variable
    length arrays in structures" (VLAIS) to define in the inline assembler
    constraints the area of the clobbered memory. This extension will most
    likely never be supported by LLVM/Clang.
    
    Since currently BPF programs are compiled with LLVM, this leads to the
    following compile errors:
    
     $ cd samples/bpf
     $ make
    
     In file included from /root/linux-master/samples/bpf/tracex1_kern.c:8:
     In file included from ./include/linux/netdevice.h:44:
     ...
     In file included from ./arch/s390/include/asm/mmu_context.h:10:
      ./arch/s390/include/asm/pgalloc.h:30:24: error: fields must have a
      constant size: 'variable length array in structure' extension will never
      be supported
             typedef struct { char _[n]; } addrtype;
    
     In file included from /root/linux-master/samples/bpf/tracex1_kern.c:7:
     In file included from ./include/linux/skbuff.h:18:
     ...
     In file included from ./include/linux/jiffies.h:8:
     In file included from ./include/linux/timex.h:65:
      ./arch/s390/include/asm/timex.h:105:24: error: fields must have a
      constant size: 'variable length array in structure' extension will never
      be supported
            typedef struct { char _[len]; } addrtype;
    
    To fix this do the following:
    
     - Convert ptff() into a macro that then uses a fixed size array
       when expanded.
     - Convert the clear_table() function and use an inline assembly
       with fixed size array in a loop.
       The runtime performance of the new version is even better than
       the old version (tested with EC12/z13 and gcc 4.8.5/6.2.1 with
       "-march=z196 -O2").
    
    Reported-by: default avatarZvonko Kosic <zvonko.kosic@de.ibm.com>
    Signed-off-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
    Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    11a247e3