[RFC PATCH 09/16] bpf: cfg: reduce k*alloc/free call by using memory pool for allocating nodes

2018-06-01 Thread John Fastabend
do an initial allocation of estimated size (aligned to 2K). The pool will grow later if space are not enough. - There is no support on returning memory back to the pool. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --- kernel/bpf/cfg.c |

[RFC PATCH 06/16] bpf: cfg: move find_subprog/add_subprog to cfg.c

2018-06-01 Thread John Fastabend
From: Jiong Wang This patch centre find_subprog and add_subprog to cfg.c. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --- kernel/bpf/cfg.c | 41 + kernel/bpf/cfg.h |2 ++ kernel/bpf/verifier.c | 42

[RFC PATCH 10/16] bpf: cfg: reduce memory usage by using singly list + compat pointer

2018-06-01 Thread John Fastabend
readability. >From benchmarks like test_xdp_noinline, this patch reduce peek memory usage of new cfg infrastructure by more than 50%. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --- include/linux/bpf_verifier.h |7 - kernel/bpf/cf

[RFC PATCH 08/16] bpf: cfg: remove push_insn and check_cfg

2018-06-01 Thread John Fastabend
From: Jiong Wang As we have detected loop and unreachable insns based on domination information and call graph, there is no need of check_cfg. This patch removes check_cfg and it's associated push_insn. state prune heuristic marking as moved to check_subprog. Signed-off-by: Jiong Wang --- ke

[RFC PATCH 05/16] bpf: cfg: detect unreachable basic blocks

2018-06-01 Thread John Fastabend
From: Jiong Wang Do unreachable basic blocks detection as a side-product of the dfs walk when building domination information. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --- kernel/bpf/cfg.c | 19 ++- kernel/bpf/cfg.h |3 ++- kernel/bpf/verifier.c

[RFC PATCH 04/16] bpf: cfg: detect loop use domination information

2018-06-01 Thread John Fastabend
From: Jiong Wang If one bb is dominating its predecessor, then there is loop. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --- kernel/bpf/cfg.c | 22 ++ kernel/bpf/cfg.h |1 + kernel/bpf/verifier.c |8 3 files changed, 31 insertions

[RFC PATCH 02/16] bpf: cfg: add edges between basic blocks to form CFG

2018-06-01 Thread John Fastabend
From: Jiong Wang This patch add edges between basic blocks. Both edges for predecessors and successors are added. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --- kernel/bpf/cfg.c | 129 - kernel/bpf/cfg.h |1 kernel

[RFC PATCH 03/16] bpf: cfg: build domination tree using Tarjan algorithm

2018-06-01 Thread John Fastabend
-domination information is built but not tested. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --- include/linux/bpf_verifier.h |3 kernel/bpf/cfg.c | 386 ++ kernel/bpf/cfg.h |3 kernel/bpf/verifier.c|5

[RFC PATCH 00/16] bpf, bounded loop support work in progress

2018-06-01 Thread John Fastabend
ll graph and detect unreachable/recursive call bpf: cfg: remove push_insn and check_cfg bpf: cfg: reduce k*alloc/free call by using memory pool for allocating nodes bpf: cfg: reduce memory usage by using singly list + compat pointer bpf: cfg: detect irreducible loop using Eric S

[RFC PATCH 01/16] bpf: cfg: partition basic blocks for each subprog

2018-06-01 Thread John Fastabend
. - Insn immediately follows branch insn start a BB. Insn immediately follows exit and within subprog start a BB. BBs for each subprog are organized as a list in ascending head. Two special BBs, entry and exit are added as well. Signed-off-by: Jiong Wang Signed-off-by: John Fastabend --

[bpf PATCH] bpf: sockmap, fix crash when ipv6 sock is added

2018-06-01 Thread John Fastabend
support") Reported-by: syzbot+5c063698bdbfac19f...@syzkaller.appspotmail.com Signed-off-by: John Fastabend Signed-off-by: Wei Wang --- kernel/bpf/sockmap.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 95a

Re: [PATCH bpf-next] bpf: prevent non-IPv4 socket to be added into sock hash

2018-06-01 Thread John Fastabend
On 05/31/2018 06:00 PM, Eric Dumazet wrote: > On Thu, May 31, 2018 at 7:32 PM John Fastabend > wrote: >> >> >> Hi Wei, >> >> Thanks for the report and fix. It would be better to fix the >> root cause so that IPv6 works as intended. >> >

Re: [PATCH bpf-next] bpf: prevent non-IPv4 socket to be added into sock hash

2018-05-31 Thread John Fastabend
00401950 R14: R15: > > Fixes: 81110384441a ("bpf: sockmap, add hash map support") > Reported-by: syzbot+5c063698bdbfac19f...@syzkaller.appspotmail.com > Signed-off-by: Wei Wang > Acked-by: Eric Dumazet > Acked-by: Willem de Bruijn > --- Hi Wei, T

Re: [PATCH bpf v3 3/5] selftests/bpf: test_sockmap, fix test timeout

2018-05-30 Thread John Fastabend
On 05/30/2018 12:29 PM, Alexei Starovoitov wrote: > On Wed, May 30, 2018 at 02:56:09PM +0900, Prashant Bhole wrote: >> In order to reduce runtime of tests, recently timout for select() call >> was reduced from 1sec to 10usec. This was causing many tests failures. >> It was caught with failure handl

Re: [PATCH bpf v3 0/5] fix test_sockmap

2018-05-30 Thread John Fastabend
On 05/29/2018 10:56 PM, Prashant Bhole wrote: > This series fixes error handling, timeout and data verification in > test_sockmap. Previously it was not able to detect failure/timeout in > RX/TX thread because error was not notified to the main thread. > > Also slightly improved test output by pri

Re: [PATCH bpf v3 3/5] selftests/bpf: test_sockmap, fix test timeout

2018-05-30 Thread John Fastabend
unning test_sockmap script that I run as part of Cilium[1] project where I put longer running stress tests. Acked-by: John Fastabend [1] cilium.io

Re: [PATCH bpf v3 1/5] selftests/bpf: test_sockmap, check test failure

2018-05-30 Thread John Fastabend
> 1 file changed, 19 insertions(+), 6 deletions(-) > Looks good. Thanks. Acked-by: John Fastabend

Re: [PATCH bpf v2 0/5] fix test_sockmap

2018-05-29 Thread John Fastabend
On 05/29/2018 05:44 PM, Prashant Bhole wrote: > > > On 5/30/2018 12:48 AM, John Fastabend wrote: >> On 05/27/2018 09:37 PM, Prashant Bhole wrote: >>> This series fixes error handling, timeout and data verification in >>> test_sockmap. Previously it was not

Re: [PATCH bpf v2 0/5] fix test_sockmap

2018-05-29 Thread John Fastabend
On 05/27/2018 09:37 PM, Prashant Bhole wrote: > This series fixes error handling, timeout and data verification in > test_sockmap. Previously it was not able to detect failure/timeout in > RX/TX thread because error was not notified to the main thread. > > Also slightly improved test output by pri

Re: [PATCH bpf v2 1/5] selftests/bpf: test_sockmap, check test failure

2018-05-29 Thread John Fastabend
he exit code of RX/TX threads > > Fixes: 16962b2404ac ("bpf: sockmap, add selftests") > Signed-off-by: Prashant Bhole > --- Acked-by: John Fastabend > tools/testing/selftests/bpf/test_sockmap.c | 25 -- > 1 file changed, 19 insertions(+), 6 d

Re: [bpf-next PATCH] bpf: sockhash fix race with bpf_tcp_close and map delete

2018-05-28 Thread John Fastabend
On 05/27/2018 03:36 PM, Daniel Borkmann wrote: > On 05/25/2018 07:37 PM, John Fastabend wrote: >> syzbot reported two related splats, a use after free and null >> pointer dereference, when a TCP socket is closed while the map is >> also being removed. >> >> The p

Re: [bpf-next PATCH] bpf: sockhash fix race with bpf_tcp_close and map delete

2018-05-26 Thread John Fastabend
On 05/26/2018 01:30 AM, Daniel Borkmann wrote: > Hi John, > > On 05/25/2018 07:37 PM, John Fastabend wrote: >> syzbot reported two related splats, a use after free and null >> pointer dereference, when a TCP socket is closed while the map is >> also being remov

Re: [PATCH net] net: sched: check netif_xmit_frozen_or_stopped() in sch_direct_xmit()

2018-05-26 Thread John Fastabend
rozen_or_stopped(txq)) >> return false; >> >> and further simplifies the code as: >> >> return !netif_xmit_frozen_or_stopped(txq); >> >> Fixes: 29b86cdac00a ("net: sched: remove remaining uses for qdisc_qlen in >> xmit path") >> C

[bpf-next PATCH] bpf: sockhash fix race with bpf_tcp_close and map delete

2018-05-25 Thread John Fastabend
being free'd. Reported-by: syzbot+a761b81c211794fa1...@syzkaller.appspotmail.com Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c | 33 + 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c

Re: [PATCH bpf-next 0/5] fix test_sockmap

2018-05-25 Thread John Fastabend
On 05/25/2018 01:28 AM, Prashant Bhole wrote: > > > On 5/24/2018 1:58 PM, John Fastabend wrote: >> On 05/23/2018 09:47 PM, Prashant Bhole wrote: >>> >>> >>> On 5/23/2018 6:44 PM, Prashant Bhole wrote: >>>> >>>> >>>

Re: [PATCH bpf-next 0/5] fix test_sockmap

2018-05-23 Thread John Fastabend
On 05/23/2018 09:47 PM, Prashant Bhole wrote: > > > On 5/23/2018 6:44 PM, Prashant Bhole wrote: >> >> >> On 5/22/2018 2:08 AM, John Fastabend wrote: >>> On 05/20/2018 10:13 PM, Prashant Bhole wrote: >>>> >>>> >>>> On 5/19/20

Re: [net-next 1/6] net/dcb: Add dcbnl buffer attribute

2018-05-23 Thread John Fastabend
On 05/23/2018 08:37 AM, Huy Nguyen wrote: > > > On 5/23/2018 8:52 AM, John Fastabend wrote: >> It would be nice though if the API gave us some hint on max/min/stride >> of allowed values. Could the get API return these along with current >> value? Presumably the al

Re: [bpf-next V4 PATCH 6/8] xdp: change ndo_xdp_xmit API to support bulking

2018-05-23 Thread John Fastabend
On 05/18/2018 06:35 AM, Jesper Dangaard Brouer wrote: > This patch change the API for ndo_xdp_xmit to support bulking > xdp_frames. > > When kernel is compiled with CONFIG_RETPOLINE, XDP sees a huge slowdown. > Most of the slowdown is caused by DMA API indirect function calls, but > also the net_d

Re: [bpf-next V4 PATCH 3/8] xdp: add tracepoint for devmap like cpumap have

2018-05-23 Thread John Fastabend
On 05/18/2018 06:34 AM, Jesper Dangaard Brouer wrote: > Notice how this allow us get XDP statistic without affecting the XDP > performance, as tracepoint is no-longer activated on a per packet basis. > > Signed-off-by: Jesper Dangaard Brouer > --- [...] > #include > diff --git a/kernel/bpf/d

Re: [net-next 1/6] net/dcb: Add dcbnl buffer attribute

2018-05-23 Thread John Fastabend
On 05/23/2018 02:43 AM, Jiri Pirko wrote: > Tue, May 22, 2018 at 07:20:26AM CEST, jakub.kicin...@netronome.com wrote: >> On Mon, 21 May 2018 14:04:57 -0700, Saeed Mahameed wrote: >>> From: Huy Nguyen >>> >>> In this patch, we add dcbnl buffer attribute to allow user >>> change the NIC's buffer con

Re: [PATCH bpf-next 3/5] selftests/bpf: test_sockmap, fix test timeout

2018-05-21 Thread John Fastabend
On 05/20/2018 10:15 PM, Prashant Bhole wrote: > > > On 5/19/2018 1:47 AM, John Fastabend wrote: >> On 05/18/2018 12:17 AM, Prashant Bhole wrote: >>> In order to reduce runtime of tests, recently timout for select() call >>> was reduced from 1sec to 10usec. Thi

Re: [PATCH bpf-next 2/5] selftests/bpf: test_sockmap, join cgroup in selftest mode

2018-05-21 Thread John Fastabend
On 05/20/2018 10:15 PM, Prashant Bhole wrote: > > > On 5/19/2018 1:45 AM, John Fastabend wrote: >> On 05/18/2018 12:17 AM, Prashant Bhole wrote: >>> In case of selftest mode, temporary cgroup environment is created but >>> cgroup is not joined. It causes te

Re: [PATCH bpf-next 0/5] fix test_sockmap

2018-05-21 Thread John Fastabend
On 05/20/2018 10:13 PM, Prashant Bhole wrote: > > > On 5/19/2018 1:42 AM, John Fastabend wrote: >> On 05/18/2018 12:17 AM, Prashant Bhole wrote: >>> This series fixes bugs in test_sockmap code. They weren't caught >>> previously because failure in RX/TX t

Re: [PATCH bpf-next 4/5] selftests/bpf: test_sockmap, fix data verification

2018-05-18 Thread John Fastabend
reached > - Fixed the value printed in case of verification failure > > Fixes: 16962b2404ac ("bpf: sockmap, add selftests") > Signed-off-by: Prashant Bhole > --- Thanks! Acked-by: John Fastabend

Re: [PATCH bpf-next 5/5] selftests/bpf: test_sockmap, print additional test options

2018-05-18 Thread John Fastabend
On 05/18/2018 12:17 AM, Prashant Bhole wrote: > Print values of test options like apply, cork, start, end so that > individual failed tests can be identified for manual run > > Signed-off-by: Prashant Bhole > --- Nice improvement. Acked-by: John Fastabend

Re: [PATCH bpf-next 3/5] selftests/bpf: test_sockmap, fix test timeout

2018-05-18 Thread John Fastabend
On 05/18/2018 12:17 AM, Prashant Bhole wrote: > In order to reduce runtime of tests, recently timout for select() call > was reduced from 1sec to 10usec. This was causing many tests failures. > It was caught with failure handling commits in this series. > > Restoring the timeout from 10usec to 1se

Re: [PATCH bpf-next 2/5] selftests/bpf: test_sockmap, join cgroup in selftest mode

2018-05-18 Thread John Fastabend
igned-off-by: Prashant Bhole > -- Thanks, LGTM. Should this be the first patch in the series though? I wonder if after patch 1 if you would get failures without this patch. Acked-by: John Fastabend

Re: [PATCH bpf-next 0/5] fix test_sockmap

2018-05-18 Thread John Fastabend
On 05/18/2018 12:17 AM, Prashant Bhole wrote: > This series fixes bugs in test_sockmap code. They weren't caught > previously because failure in RX/TX thread was not notified to the > main thread. > > Also fixed data verification logic and slightly improved test output > such that parameters value

[bpf-next PATCH v2 2/2] bpf: add sk_msg prog sk access tests to test_verifier

2018-05-17 Thread John Fastabend
Add tests for BPF_PROG_TYPE_SK_MSG to test_verifier for read access to new sk fields. Signed-off-by: John Fastabend Acked-by: Martin KaFai Lau --- tools/include/uapi/linux/bpf.h |8 ++ tools/testing/selftests/bpf/test_verifier.c | 115 +++ 2 files

[bpf-next PATCH v2 1/2] bpf: allow sk_msg programs to read sock fields

2018-05-17 Thread John Fastabend
Currently sk_msg programs only have access to the raw data. However, it is often useful when building policies to have the policies specific to the socket endpoint. This allows using the socket tuple as input into filters, etc. This patch adds ctx access to the sock fields. Signed-off-by: John

[bpf-next PATCH v2 0/2] SK_MSG programs: read sock fields

2018-05-17 Thread John Fastabend
er to read IMO. We can probably revisit the idea later if we get more duplication. v2: add errstr field to negative test_verifier test cases to ensure we get the expected err string back from the verifier. --- John Fastabend (2): bpf: allow sk_msg programs to read sock fields bpf

[bpf PATCH v2 1/2] bpf: sockmap update rollback on error can incorrectly dec prog refcnt

2018-05-17 Thread John Fastabend
ned-off-by: John Fastabend Acked-by: Martin KaFai Lau --- kernel/bpf/sockmap.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 098eca5..f03aaa8 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -1717,1

[bpf PATCH v2 2/2] bpf: parse and verdict prog attach may race with bpf map update

2018-05-17 Thread John Fastabend
857d04601a ("bpf: sockmap, remove STRPARSER map_flags and add multi-map support") Reported-by: Daniel Borkmann Signed-off-by: John Fastabend Acked-by: Martin KaFai Lau --- kernel/bpf/sockmap.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/soc

Re: [bpf PATCH 2/2] bpf: parse and verdict prog attach may race with bpf map update

2018-05-17 Thread John Fastabend
On 05/17/2018 01:31 PM, Daniel Borkmann wrote: > On 05/16/2018 11:46 PM, John Fastabend wrote: >> In the sockmap design BPF programs (SK_SKB_STREAM_PARSER and >> SK_SKB_STREAM_VERDICT) are attached to the sockmap map type and when >> a sock is added to the map the programs a

Re: [bpf-next PATCH 1/2] bpf: allow sk_msg programs to read sock fields

2018-05-17 Thread John Fastabend
On 05/17/2018 11:17 AM, Martin KaFai Lau wrote: > On Thu, May 17, 2018 at 08:54:04AM -0700, John Fastabend wrote: >> Currently sk_msg programs only have access to the raw data. However, >> it is often useful when building policies to have the policies specific >> to the

Re: [bpf-next PATCH 2/2] bpf: add sk_msg prog sk access tests to test_verifier

2018-05-17 Thread John Fastabend
On 05/17/2018 11:57 AM, Martin KaFai Lau wrote: > On Thu, May 17, 2018 at 08:54:10AM -0700, John Fastabend wrote: >> Add tests for BPF_PROG_TYPE_SK_MSG to test_verifier for read access >> to new sk fields. >> >> Signed-off-by: John Fastabend >> --- [...] >&g

Re: [PATCH 1/2] bpf: sockmap, fix uninitialized variable

2018-05-17 Thread John Fastabend
path to hit this case is to add a sock to a map (without a BPF program) where the sock already has been added to another map. I don't have any tests for the case with socks in multiple maps so I'll add some to the selftests so I remember this case. The alternative fix would be to always &

Re: [PATCH 2/2] bpf: sockmap, fix double-free

2018-05-17 Thread John Fastabend
pen when a user tries to add a kTLS socket to a sockmap. We need to add some tests for kTLS + sockmap cases. Acked-by: John Fastabend

[bpf-next PATCH 2/2] bpf: add sk_msg prog sk access tests to test_verifier

2018-05-17 Thread John Fastabend
Add tests for BPF_PROG_TYPE_SK_MSG to test_verifier for read access to new sk fields. Signed-off-by: John Fastabend --- tools/include/uapi/linux/bpf.h |8 ++ tools/testing/selftests/bpf/test_verifier.c | 115 +++ 2 files changed, 123 insertions(+) diff

[bpf-next PATCH 0/2] SK_MSG programs: read sock fields

2018-05-17 Thread John Fastabend
er to read IMO. We can probably revisit the idea later if we get more duplication. --- John Fastabend (2): bpf: allow sk_msg programs to read sock fields bpf: add sk_msg prog sk access tests to test_verifier include/linux/filter.h |1 include/uapi/linux/

[bpf-next PATCH 1/2] bpf: allow sk_msg programs to read sock fields

2018-05-17 Thread John Fastabend
Currently sk_msg programs only have access to the raw data. However, it is often useful when building policies to have the policies specific to the socket endpoint. This allows using the socket tuple as input into filters, etc. This patch adds ctx access to the sock fields. Signed-off-by: John

[bpf-next PATCH] bpf: sockmap, on update propagate errors back to userspace

2018-05-16 Thread John Fastabend
When an error happens in the update sockmap element logic also pass the err up to the user. Fixes: e5cd3abcb31a ("bpf: sockmap, refactor sockmap routines to work with hashmap") Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c |2 +- 1 file changed, 1 insertion(+), 1 deletio

[bpf PATCH 1/2] bpf: sockmap update rollback on error can incorrectly dec prog refcnt

2018-05-16 Thread John Fastabend
ned-off-by: John Fastabend --- kernel/bpf/sockmap.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 098eca5..f03aaa8 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -1717,10 +1717,10 @@

[bpf PATCH 2/2] bpf: parse and verdict prog attach may race with bpf map update

2018-05-16 Thread John Fastabend
ockmap, remove STRPARSER map_flags and add multi-map support") Reported-by: Daniel Borkmann Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index f03aaa8..583c

Re: [PATCH bpf-next v6 1/4] bpf: sockmap, refactor sockmap routines to work with hashmap

2018-05-16 Thread John Fastabend
On 05/15/2018 12:19 PM, Daniel Borkmann wrote: > On 05/14/2018 07:00 PM, John Fastabend wrote: > [...] [...] > > As you say in the comment above the function wrt locking notes that the > __sock_map_ctx_update_elem() can be called concurrently. > > All operations oper

Re: [PATCH bpf-next] bpf: fix sock hashmap kmalloc warning

2018-05-16 Thread John Fastabend
stack, so they cannot be > + * larger than max stack size > + */ > + return ERR_PTR(-E2BIG); > + > err = bpf_tcp_ulp_register(); > if (err && err != -EEXIST) > return ERR_PTR(err); > Thanks! Acked-by: John Fastabend

[PATCH bpf-next v6 4/4] bpf: bpftool, support for sockhash

2018-05-14 Thread John Fastabend
This adds the SOCKHASH map type to bpftools so that we get correct pretty printing. Signed-off-by: John Fastabend Acked-by: David S. Miller --- tools/bpf/bpftool/map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c index af6766e..097b1a5

[PATCH bpf-next v6 3/4] bpf: selftest additions for SOCKHASH

2018-05-14 Thread John Fastabend
This runs existing SOCKMAP tests with SOCKHASH map type. To do this we push programs into include file and build two BPF programs. One for SOCKHASH and one for SOCKMAP. We then run the entire test suite with each type. Signed-off-by: John Fastabend Acked-by: David S. Miller --- tools/include

[PATCH bpf-next v6 0/4] Hash support for sock

2018-05-14 Thread John Fastabend
-M option no longer tracks the rename of the test_sockmap_kern files for some reason. I guess the diff has exceeded some threshold. Just a note I pushed Dave's Acks through v4 into v5 due to small size of changes. John Fastabend (4): bpf: sockmap, refactor sockmap routines to work wit

[PATCH bpf-next v6 1/4] bpf: sockmap, refactor sockmap routines to work with hashmap

2018-05-14 Thread John Fastabend
. This avoids storing the key in the metadata which will be useful when keys can be longer than 4 bytes. We rename the sk pointers to sk_redir at this point as well to avoid any confusion between the current sk pointer and the redirect pointer sk_redir. Signed-off-by: John Fastabend

[PATCH bpf-next v6 2/4] bpf: sockmap, add hash map support

2018-05-14 Thread John Fastabend
may want to use the 5-tuple of the socket as the lookup key. To support this add hash support. Signed-off-by: John Fastabend Acked-by: David S. Miller --- include/linux/bpf.h | 8 + include/linux/bpf_types.h | 1 + include/uapi/linux/bpf.h | 52 - kernel/bpf/core.c | 1

Re: [RFC bpf-next 04/10] bpf: cfg: detect loop use domination information

2018-05-10 Thread John Fastabend
On 05/07/2018 03:22 AM, Jiong Wang wrote: > If one bb is dominating its predecessor, then there is loop. > > Signed-off-by: Jiong Wang > --- > kernel/bpf/cfg.c | 22 ++ > kernel/bpf/cfg.h | 1 + > kernel/bpf/verifier.c | 8 > 3 files changed, 31 insertion

[PATCH bpf-next v5 1/4] bpf: sockmap, refactor sockmap routines to work with hashmap

2018-05-05 Thread John Fastabend
. This avoids storing the key in the metadata which will be useful when keys can be longer than 4 bytes. We rename the sk pointers to sk_redir at this point as well to avoid any confusion between the current sk pointer and the redirect pointer sk_redir. Signed-off-by: John Fastabend

[PATCH bpf-next v5 3/4] bpf: selftest additions for SOCKHASH

2018-05-05 Thread John Fastabend
This runs existing SOCKMAP tests with SOCKHASH map type. To do this we push programs into include file and build two BPF programs. One for SOCKHASH and one for SOCKMAP. We then run the entire test suite with each type. Signed-off-by: John Fastabend Acked-by: David S. Miller --- tools/include

[PATCH bpf-next v5 2/4] bpf: sockmap, add hash map support

2018-05-05 Thread John Fastabend
may want to use the 5-tuple of the socket as the lookup key. To support this add hash support. Signed-off-by: John Fastabend Acked-by: David S. Miller --- include/linux/bpf.h | 8 + include/linux/bpf_types.h | 1 + include/uapi/linux/bpf.h | 52 - kernel/bpf/core.c | 1

[PATCH bpf-next v5 4/4] bpf: bpftool, support for sockhash

2018-05-05 Thread John Fastabend
This adds the SOCKHASH map type to bpftools so that we get correct pretty printing. Signed-off-by: John Fastabend Acked-by: David S. Miller --- tools/bpf/bpftool/map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c index af6766e..097b1a5

[PATCH bpf-next v5 0/4] Hash support for sock

2018-05-05 Thread John Fastabend
provide only diffs +/- on that. v4: Add documentation to UAPI bpf.h v5: Add documentation to tools UAPI bpf.h Just a note I pushed Dave's Acks through v4 into v5 due to small size of change. John Fastabend (4): bpf: sockmap, refactor sockmap routines to work with hashmap bpf: sockmap, add has

[PATCH bpf-next v4 4/4] bpf: bpftool, support for sockhash

2018-05-03 Thread John Fastabend
This adds the SOCKHASH map type to bpftools so that we get correct pretty printing. Signed-off-by: John Fastabend --- tools/bpf/bpftool/map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c index a6cdb64..4420b1a 100644 --- a/tools/bpf

[PATCH bpf-next v4 3/4] bpf: selftest additions for SOCKHASH

2018-05-03 Thread John Fastabend
This runs existing SOCKMAP tests with SOCKHASH map type. To do this we push programs into include file and build two BPF programs. One for SOCKHASH and one for SOCKMAP. We then run the entire test suite with each type. Signed-off-by: John Fastabend --- tools/include/uapi/linux/bpf.h

[PATCH bpf-next v4 2/4] bpf: sockmap, add hash map support

2018-05-03 Thread John Fastabend
may want to use the 5-tuple of the socket as the lookup key. To support this add hash support. Signed-off-by: John Fastabend --- include/linux/bpf.h | 8 + include/linux/bpf_types.h | 1 + include/uapi/linux/bpf.h | 53 - kernel/bpf/core.c | 1 + kernel/bpf/sockmap.c

[PATCH bpf-next v4 0/4] Hash support for sock

2018-05-03 Thread John Fastabend
provide only diffs +/- on that. v4: Add documentation to UAPI bpf.h John Fastabend (4): bpf: sockmap, refactor sockmap routines to work with hashmap bpf: sockmap, add hash map support bpf: bpftool, support for sockhash bpf: selftest additions for SOCKHASH include/linux/bpf.h

[PATCH bpf-next v4 1/4] bpf: sockmap, refactor sockmap routines to work with hashmap

2018-05-03 Thread John Fastabend
. This avoids storing the key in the metadata which will be useful when keys can be longer than 4 bytes. We rename the sk pointers to sk_redir at this point as well to avoid any confusion between the current sk pointer and the redirect pointer sk_redir. Signed-off-by: John Fastabend

[bpf PATCH v2 3/3] bpf: sockmap, fix error handling in redirect failures

2018-05-02 Thread John Fastabend
memory. The fix for this is simply to update the start index. To avoid fixing this error in two locations we do a small refactor and remove one case where it is open-coded. Then fix it in the single function. Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c | 28

[bpf PATCH v2 2/3] bpf: sockmap, zero sg_size on error when buffer is released

2018-05-02 Thread John Fastabend
. This is in the error path as well so in my opinion lets have robust code over optimized error paths. Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index

[bpf PATCH v2 0/3] sockmap error path fixes

2018-05-02 Thread John Fastabend
these seem to be in working correctly. v2: fix compiler warning, drop iterator variable 'i' that is no longer used in patch 3. --- John Fastabend (3): bpf: sockmap, fix scatterlist update on error path in send with apply bpf: sockmap, zero sg_size on error when buffer i

[bpf PATCH v2 1/3] bpf: sockmap, fix scatterlist update on error path in send with apply

2018-05-02 Thread John Fastabend
absolute scatterlist values rather than trying to accumulate the totals and subtract at the end. Reported-by: Alexei Starovoitov Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf

[bpf PATCH 3/3] bpf: sockmap, fix error handling in redirect failures

2018-05-02 Thread John Fastabend
memory. The fix for this is simply to update the start index. To avoid fixing this error in two locations we do a small refactor and remove one case where it is open-coded. Then fix it in the single function. Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c | 26

[bpf PATCH 2/3] bpf: sockmap, zero sg_size on error when buffer is released

2018-05-02 Thread John Fastabend
. This is in the error path as well so in my opinion lets have robust code over optimized error paths. Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index

[bpf PATCH 0/3] sockmap error path fixes

2018-05-02 Thread John Fastabend
these seem to be in working correctly. --- John Fastabend (3): bpf: sockmap, fix scatterlist update on error path in send with apply bpf: sockmap, zero sg_size on error when buffer is released bpf: sockmap, fix error handling in redirect failures kernel/bpf/sockmap.c | 46

[bpf PATCH 1/3] bpf: sockmap, fix scatterlist update on error path in send with apply

2018-05-02 Thread John Fastabend
absolute scatterlist values rather than trying to accumulate the totals and subtract at the end. Reported-by: Alexei Starovoitov Signed-off-by: John Fastabend --- kernel/bpf/sockmap.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/sockmap.c b/kernel/bpf

Re: [PATCH bpf-next 0/3] bpf: cleanups on managing subprog information

2018-05-02 Thread John Fastabend
On 05/02/2018 09:59 AM, Jiong Wang wrote: > On 01/05/2018 23:22, Alexei Starovoitov wrote: > ... >> [   27.784931]  ? bpf_int_jit_compile+0x7ac/0xab0 >> [   27.785475]  bpf_int_jit_compile+0x2b6/0xab0 >> [   27.786001]  ? do_jit+0x6020/0x6020 >> [   27.786428]  ? kasan_kmalloc+0xa0/0xd0 >> [   27.7

Re: [PATCH bpf-next v3 2/4] bpf: sockmap, add hash map support

2018-04-29 Thread John Fastabend
On 04/29/2018 09:16 AM, Alexei Starovoitov wrote: > On Sat, Apr 28, 2018 at 08:41:28PM -0700, John Fastabend wrote: >> Sockmap is currently backed by an array and enforces keys to be >> four bytes. This works well for many use cases and was originally >> modeled after devmap

Re: [bpf-next PATCH v2 3/3] bpf: selftest additions for SOCKHASH

2018-04-28 Thread John Fastabend
On 04/27/2018 05:10 PM, Alexei Starovoitov wrote: > On Fri, Apr 27, 2018 at 04:24:43PM -0700, John Fastabend wrote: >> This runs existing SOCKMAP tests with SOCKHASH map type. To do this >> we push programs into include file and build two BPF programs. One >> for SOCKHAS

[PATCH bpf-next v3 3/4] bpf: selftest additions for SOCKHASH

2018-04-28 Thread John Fastabend
This runs existing SOCKMAP tests with SOCKHASH map type. To do this we push programs into include file and build two BPF programs. One for SOCKHASH and one for SOCKMAP. We then run the entire test suite with each type. Signed-off-by: John Fastabend --- tools/include/uapi/linux/bpf.h

[PATCH bpf-next v3 4/4] bpf: bpftool, support for sockhash

2018-04-28 Thread John Fastabend
This adds the SOCKHASH map type to bpftools so that we get correct pretty printing. Signed-off-by: John Fastabend --- tools/bpf/bpftool/map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c index a6cdb64..4420b1a 100644 --- a/tools/bpf

[PATCH bpf-next v3 2/4] bpf: sockmap, add hash map support

2018-04-28 Thread John Fastabend
may want to use the 5-tuple of the socket as the lookup key. To support this add hash support. Signed-off-by: John Fastabend --- include/linux/bpf.h | 8 + include/linux/bpf_types.h | 1 + include/uapi/linux/bpf.h | 6 +- kernel/bpf/core.c | 1 + kernel/bpf/sockmap.c

[PATCH bpf-next v3 0/4] Hash support for sock

2018-04-28 Thread John Fastabend
provide only diffs +/- on that. John Fastabend (4): bpf: sockmap, refactor sockmap routines to work with hashmap bpf: sockmap, add hash map support bpf: bpftool, support for sockhash bpf: selftest additions for SOCKHASH include/linux/bpf.h| 8 + include/linux

[PATCH bpf-next v3 1/4] bpf: sockmap, refactor sockmap routines to work with hashmap

2018-04-28 Thread John Fastabend
. This avoids storing the key in the metadata which will be useful when keys can be longer than 4 bytes. We rename the sk pointers to sk_redir at this point as well to avoid any confusion between the current sk pointer and the redirect pointer sk_redir. Signed-off-by: John Fastabend

[bpf-next PATCH v2 2/3] bpf: sockmap, add hash map support

2018-04-27 Thread John Fastabend
may want to use the 5-tuple of the socket as the lookup key. To support this add hash support. Signed-off-by: John Fastabend --- include/linux/bpf.h|8 + include/linux/bpf_types.h |1 include/uapi/linux/bpf.h |6 kernel/bpf/core.c |1 kernel

[bpf-next PATCH v2 1/3] bpf: sockmap, refactor sockmap routines to work with hashmap

2018-04-27 Thread John Fastabend
. This avoids storing the key in the metadata which will be useful when keys can be longer than 4 bytes. We rename the sk pointers to sk_redir at this point as well to avoid any confusion between the current sk pointer and the redirect pointer sk_redir. Signed-off-by: John Fastabend

[bpf-next PATCH v2 3/3] bpf: selftest additions for SOCKHASH

2018-04-27 Thread John Fastabend
This runs existing SOCKMAP tests with SOCKHASH map type. To do this we push programs into include file and build two BPF programs. One for SOCKHASH and one for SOCKMAP. We then run the entire test suite with each type. Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/Makefile

[bpf-next PATCH v2 0/3] Hash support for sock

2018-04-27 Thread John Fastabend
something else tricky. To test this we duplicate all the sockmap testing except swap out the sockmap with a sockhash. v2: fix file stats and add v2 tag --- John Fastabend (3): bpf: sockmap, refactor sockmap routines to work with hashmap bpf: sockmap, add hash map support bpf: selftest

[bpf-next PATCH 0/3] Hash support for sock

2018-04-27 Thread John Fastabend
type which reuses almost all the sockmap code except it needed a few special add/remove handlers. To test this we duplicate all the sockmap testing except swap out the sockmap with a sockhash. --- John Fastabend (3): bpf: sockmap, refactor sockmap routines to work with hashmap bpf

Re: [bpf-next PATCH 0/3] Hash support for sock

2018-04-27 Thread John Fastabend
On 04/27/2018 03:54 PM, Alexei Starovoitov wrote: > On Fri, Apr 27, 2018 at 10:51 PM, John Fastabend > wrote: >> In the original sockmap implementation we got away with using an >> array similar to devmap. However, unlike devmap where an ifindex >> has a nice 1:1 funct

[bpf-next PATCH 0/3] Hash support for sock

2018-04-27 Thread John Fastabend
type which reuses almost all the sockmap code except it needed a few special add/remove handlers. To test this we duplicate all the sockmap testing except swap out the sockmap with a sockhash. --- John Fastabend (3): bpf: sockmap, refactor sockmap routines to work with hashmap bpf

[bpf-next PATCH 3/3] bpf: selftest additions for SOCKHASH

2018-04-27 Thread John Fastabend
This runs existing SOCKMAP tests with SOCKHASH map type. To do this we push programs into include file and build two BPF programs. One for SOCKHASH and one for SOCKMAP. We then run the entire test suite with each type. Signed-off-by: John Fastabend --- tools/testing/selftests/bpf/Makefile

[bpf-next PATCH 2/3] bpf: sockmap, add hash map support

2018-04-27 Thread John Fastabend
may want to use the 5-tuple of the socket as the lookup key. To support this add hash support. Signed-off-by: John Fastabend --- tools/bpf/bpftool/map.c|1 + tools/include/uapi/linux/bpf.h |6 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/bpf.h

[bpf-next PATCH 1/3] bpf: sockmap, refactor sockmap routines to work with hashmap

2018-04-27 Thread John Fastabend
. This avoids storing the key in the metadata which will be useful when keys can be longer than 4 bytes. We rename the sk pointers to sk_redir at this point as well to avoid any confusion between the current sk pointer and the redirect pointer sk_redir. Signed-off-by: John Fastabend

[bpf PATCH] bpf: fix uninitialized variable in bpf tools

2018-04-25 Thread John Fastabend
ed] } else if (matches(subcmd, "pcap") == 0) { Fixes: fd981e3c321a "filter: bpf_dbg: add minimal bpf debugger" Signed-off-by: John Fastabend --- tools/bpf/bpf_dbg.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/bpf/bpf_dbg.c b/tools/bpf/bpf_

[bpf PATCH v2] bpf: fix for lex/yacc build error with gcc-5

2018-04-25 Thread John Fastabend
le to make target `bpf_exp.yacc.o', needed by `bpf_asm'. Stop. Fixes: 5a8997f20715 ("tools: bpf: respect output directory during build") Signed-off-by: John Fastabend --- tools/bpf/Makefile |2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/bpf/Makefile b/tools/bpf/M

<    4   5   6   7   8   9   10   11   12   13   >