1. 02 Oct, 2015 1 commit
    • Ralf Baechle's avatar
      MIPS: BPF: Fix load delay slots. · 0c5d1878
      Ralf Baechle authored
      
      
      The entire bpf_jit_asm.S is written in noreorder mode because "we know
      better" according to a comment.  This also prevented the assembler from
      throwing in the required NOPs for MIPS I processors which have no
      load-use interlock, thus the load's consumer might end up using the
      old value of the register from prior to the load.
      
      Fixed by putting the assembler in reorder mode for just the affected
      load instructions.  This is not enough for gas to actually try to be
      clever by looking at the next instruction and inserting a nop only
      when needed but as the comment said "we know better", so getting gas
      to unconditionally emit a NOP is just right in this case and prevents
      adding further ifdefery.
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      0c5d1878
  2. 01 Oct, 2015 1 commit
  3. 22 Sep, 2015 2 commits
    • Aurelien Jarno's avatar
      MIPS: BPF: Fix build on pre-R2 little endian CPUs · b259e51f
      Aurelien Jarno authored
      
      
      The rotr, seh and wsbh instructions have been introduced with the R2
      ISA. Thus the current BPF code fails to build on pre-R2 little endian
      CPUs:
      
          CC      arch/mips/net/bpf_jit.o
          AS      arch/mips/net/bpf_jit_asm.o
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S: Assembler messages:
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S:67: Error: opcode not supported on this processor: mips32 (mips32) `wsbh $8,$19'
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S:68: Error: opcode not supported on this processor: mips32 (mips32) `rotr $19,$8,16'
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S:83: Error: opcode not supported on this processor: mips32 (mips32) `wsbh $8,$19'
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S:84: Error: opcode not supported on this processor: mips32 (mips32) `seh $19,$8'
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S:151: Error: opcode not supported on this processor: mips32 (mips32) `wsbh $8,$12'
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S:153: Error: opcode not supported on this processor: mips32 (mips32) `rotr $19,$8,16'
        /home/aurel32/linux-4.2/arch/mips/net/bpf_jit_asm.S:164: Error: opcode not supported on this processor: mips32 (mips32) `wsbh $19,$12'
        /home/aurel32/linux-4.2/scripts/Makefile.build:294: recipe for target 'arch/mips/net/bpf_jit_asm.o' failed
      
      Fix that by providing equivalent code for these CPUs.
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Reviewed-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: stable@vger.kernel.org # v4.2+
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11098/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      b259e51f
    • Aurelien Jarno's avatar
      MIPS: BPF: Avoid unreachable code on little endian · faa9724a
      Aurelien Jarno authored
      
      
      On little endian, avoid generating the big endian version of the code
      by using #else in addition to #ifdef #endif. Also fix one alignment
      issue wrt delay slot.
      Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
      Reviewed-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: stable@vger.kernel.org # v4.2+
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11097/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      faa9724a
  4. 21 Jun, 2015 1 commit
    • Markos Chandras's avatar
      MIPS: BPF: Introduce BPF ASM helpers · 266a88e2
      Markos Chandras authored
      
      
      This commit introduces BPF ASM helpers for MIPS and MIPS64 kernels.
      The purpose of this patch is to twofold:
      
      1) We are now able to handle negative offsets instead of either
      falling back to the interpreter or to simply not do anything and
      bail out.
      
      2) Optimize reads from the packet header instead of calling the C
      helpers
      
      Because of this patch, we are now able to get rid of quite a bit of
      code in the JIT generation process by using MIPS optimized assembly
      code. The new assembly code makes the test_bpf testsuite happy with
      all 60 test passing successfully compared to the previous
      implementation where 2 tests were failing.
      Doing some basic analysis in the results between the old
      implementation and the new one we can obtain the following
      summary running current mainline on an ER8 board (+/- 30us delta is
      ignored to prevent noise from kernel scheduling or IRQ latencies):
      
      Summary: 22 tests are faster, 7 are slower and 47 saw no improvement
      
      with the most notable improvement being the tcpdump tests. The 7 tests
      that seem to be a bit slower is because they all follow the slow path
      (bpf_internal_load_pointer_neg_helper) which is meant to be slow so
      that's not a problem.
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: netdev@vger.kernel.org
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Daniel Borkmann <dborkman@redhat.com>
      Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: netdev@vger.kernel.org
      Patchwork: http://patchwork.linux-mips.org/patch/10530/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      266a88e2