From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 3382B3B2A3 for ; Fri, 17 Mar 2017 08:10:38 -0400 (EDT) Received: from [194.230.159.185] (helo=localhost.localdomain) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1coqiH-0005ma-HX; Fri, 17 Mar 2017 13:10:33 +0100 Message-ID: <58CBD238.7030508@iogearbox.net> Date: Fri, 17 Mar 2017 13:10:32 +0100 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Jesper Dangaard Brouer , Eric Dumazet CC: Markos Chandras , bloat References: <27209.1489679549@obiwan.sandelman.ca> <1489681664.28631.221.camel@edumazet-glaptop3.roam.corp.google.com> <20170317100214.600bc15f@redhat.com> In-Reply-To: <20170317100214.600bc15f@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.2/23211/Fri Mar 17 05:16:44 2017) Subject: Re: [Bloat] high speed packet and protocol processing in userspace? X-BeenThere: bloat@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: General list for discussing Bufferbloat List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Mar 2017 12:10:38 -0000 On 03/17/2017 10:02 AM, Jesper Dangaard Brouer wrote: > On Thu, 16 Mar 2017 09:27:44 -0700 Eric Dumazet wrote: >> On Thu, 2017-03-16 at 11:52 -0400, Michael Richardson wrote: >>> Dave Taht wrote: >>> > Is it faster to execute 17 bpf vm instructions on (nearly) every >>> > packet, or to use all that old stuff? >>> >>> My understanding is that there is a JIT for ebpf. >> >> ebpf is pretty fast. > > To Dave what kind of arch are you running on? > AFAIK you were running on MIPS right? > Just checked the kernel tree and I was surprised to see a bpf JIT for mips: > > $ ls -1 arch/mips/net/bpf_jit* > arch/mips/net/bpf_jit_asm.S > arch/mips/net/bpf_jit.c > arch/mips/net/bpf_jit.h > > But I don't know what state it is in (Markos?) The JIT is for cBPF right now, but Cavium guys mentioned on netdev recently that they're going to implement an eBPF JIT for mips 64. You can see current cBPF and eBPF JITs that are supported by the kernel via: $ git grep BPF_JIT | grep select arch/arm/Kconfig: select HAVE_CBPF_JIT arch/arm64/Kconfig: select HAVE_EBPF_JIT arch/mips/Kconfig: select HAVE_CBPF_JIT if !CPU_MICROMIPS arch/powerpc/Kconfig: select HAVE_CBPF_JIT if !PPC64 arch/powerpc/Kconfig: select HAVE_EBPF_JIT if PPC64 arch/s390/Kconfig: select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES arch/sparc/Kconfig: select HAVE_CBPF_JIT arch/x86/Kconfig: select HAVE_EBPF_JIT if X86_64 [...] > The main point for getting performance out of eBPF is to avoid writing > a generic framework that need to handle everything. The point is only > to emit the instructions you need for your specific use-case. > > You should think about eBPF as a programmable policy (that we don't > need/want to add to the kernel code and maintain forever) See this talk: > https://github.com/iovisor/bpf-docs/blob/master/XDP_Inside_and_Out.pdf > >> Note that you can use C to write your parser, then use LLVM to >> generate native eBPF code. > > Yes, that is how I use eBPF, writing restricted-C that LLVM compiles > into eBPF code. You can look at examples in the kernel git tree under > samples/bpf/ Another, perhaps more complex project for eBPF in combination with tc + sched_clsact + cls_bpf in da (direct-action) mode can be found under: https://github.com/cilium/cilium (see bpf/ folder for the C code that LLVM compiles down to eBPF if you're curious). Cheers, Daniel