Re: [bpf PATCH] samples/bpf: all XDP samples should unload xdp/bpf prog on SIGTERM

2018-08-15 Thread Song Liu
On Wed, Aug 15, 2018 at 8:47 AM, Y Song wrote: > On Wed, Aug 15, 2018 at 7:57 AM, Jesper Dangaard Brouer > wrote: >> It is common XDP practice to unload/deattach the XDP bpf program, >> when the XDP sample program is Ctrl-C interrupted (SIGINT) or >> killed (SIGTERM

Re: [bpf PATCH] samples/bpf: all XDP samples should unload xdp/bpf prog on SIGTERM

2018-08-15 Thread Y Song
ple program > xdp_redirect_cpu") > Fixes: 0fca931a6f21 ("samples/bpf: program demonstrating access to > xdp_rxq_info") > Reported-by: Jean-Tsung Hsiao > Signed-off-by: Jesper Dangaard Brouer Acked-by: Yonghong Song > --- > samples/bpf/xdp_redirect_cpu_u

[PATCH bpf] bpf: fix a rcu usage warning in bpf_prog_array_copy_core()

2018-08-14 Thread Yonghong Song
e72317008eef84a2...@syzkaller.appspotmail.com Fixes: 394e40a29788 ("bpf: extend bpf_prog_array to store pointers to the cgroup storage") Cc: Roman Gushchin Signed-off-by: Yonghong Song --- kernel/bpf/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/core.c

Re: [PATCH bpf-next 4/4] selftests/bpf: Selftest for bpf_skb_ancestor_cgroup_id

2018-08-12 Thread Yonghong Song
On 8/10/18 10:35 PM, Andrey Ignatov wrote: Add selftests for bpf_skb_ancestor_cgroup_id helper. test_skb_cgroup_id.sh prepares testing interface and adds tc qdisc and filter for it using BPF object compiled from test_skb_cgroup_id_kern.c program. BPF program in test_skb_cgroup_id_kern.c

Re: [PATCH bpf-next] bpf: decouple btf from seq bpf fs dump and enable more maps

2018-08-12 Thread Y Song
s and lpm. > > Signed-off-by: Daniel Borkmann > Acked-by: Alexei Starovoitov Thanks for the fix. Looks good to me. For bpftool, BTF pretty print support is missing for per-cpu maps. bpffs print for per-cpu hash/array maps need to be added as well. Will add them later. Acked-by: Yonghong Song

Re: [PATCH bpf-next] bpf: enable btf for use in all maps

2018-08-09 Thread Yonghong Song
"flags": 0, "vip_num": 0 } } ] Signed-off-by: Daniel Borkmann Cc: Yonghong Song LGTM. Thanks! Acked-by: Yonghong Song

Re: [PATCH bpf] bpf: fix bpffs non-array map seq_show issue

2018-08-09 Thread Yonghong Song
On 8/9/18 10:02 AM, Daniel Borkmann wrote: On 08/09/2018 06:55 PM, Yonghong Song wrote: On 8/9/18 8:59 AM, Daniel Borkmann wrote: On 08/09/2018 05:15 PM, Yonghong Song wrote: On 8/9/18 7:24 AM, Daniel Borkmann wrote: On 08/09/2018 05:55 AM, Yonghong Song wrote: On 8/8/18 7:25 PM, Alexei

Re: [PATCH bpf] bpf: fix bpffs non-array map seq_show issue

2018-08-09 Thread Yonghong Song
On 8/9/18 8:59 AM, Daniel Borkmann wrote: On 08/09/2018 05:15 PM, Yonghong Song wrote: On 8/9/18 7:24 AM, Daniel Borkmann wrote: On 08/09/2018 05:55 AM, Yonghong Song wrote: On 8/8/18 7:25 PM, Alexei Starovoitov wrote: On Wed, Aug 08, 2018 at 06:25:19PM -0700, Yonghong Song wrote

[PATCH bpf-next 1/3] bpf: fix bpffs non-array map seq_show issue

2018-08-09 Thread Yonghong Song
6ca7c982cb5 ("bpf: btf: Add pretty print support to the basic arraymap") Acked-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- kernel/bpf/inode.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index 76efe9a1

[PATCH bpf-next 2/3] bpf: btf: add pretty print for hash/lru_hash maps

2018-08-09 Thread Yonghong Song
int count_a; int count_b; }; cat /sys/fs/bpf/pinned_hash_map: 87907: {87907,87908} 57354: {37354,57355} 76625: {76625,76626} ... Signed-off-by: Yonghong Song --- kernel/bpf/hashtab.c | 44 1 file changed, 44

[PATCH bpf-next 0/3] bpf: add bpffs pretty print for hash/lru_hash maps

2018-08-09 Thread Yonghong Song
l elements in the hash table will be traversed. Patch #2 implemented map_seq_show_elem() and map_check_btf() callback functions for hash and lru hash maps. Patch #3 enhanced tools/testing/selftests/bpf/test_btf.c to test bpffs hash and lru hash map pretty print. Yonghong Song (3): bpf: fix bpffs non

[PATCH bpf-next 3/3] tools/bpf: add bpffs pretty print btf test for hash/lru_hash maps

2018-08-09 Thread Yonghong Song
..OK PASS:3 SKIP:0 FAIL:0 Signed-off-by: Yonghong Song --- tools/testing/selftests/bpf/test_btf.c | 87 -- 1 file changed, 72 insertions(+), 15 deletions(-) diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c index

Re: [PATCH bpf] bpf: fix bpffs non-array map seq_show issue

2018-08-09 Thread Yonghong Song
On 8/9/18 7:24 AM, Daniel Borkmann wrote: On 08/09/2018 05:55 AM, Yonghong Song wrote: On 8/8/18 7:25 PM, Alexei Starovoitov wrote: On Wed, Aug 08, 2018 at 06:25:19PM -0700, Yonghong Song wrote: In function map_seq_next() of kernel/bpf/inode.c, the first key will be the "0"

Re: [PATCH bpf] bpf: fix bpffs non-array map seq_show issue

2018-08-08 Thread Yonghong Song
On 8/8/18 7:25 PM, Alexei Starovoitov wrote: On Wed, Aug 08, 2018 at 06:25:19PM -0700, Yonghong Song wrote: In function map_seq_next() of kernel/bpf/inode.c, the first key will be the "0" regardless of the map type. This works for array. But for hash type, if it happens key "0

[PATCH bpf] bpf: fix bpffs non-array map seq_show issue

2018-08-08 Thread Yonghong Song
6ca7c982cb5 ("bpf: btf: Add pretty print support to the basic arraymap") Signed-off-by: Yonghong Song --- kernel/bpf/inode.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index 76efe9a183f5..794d06186e93 100644

Re: [PATCH bpf] selftests/bpf: update test_lwt_seg6local.sh according to iproute2

2018-08-01 Thread Y Song
. This patch updates test_lwt_seg6local.sh to the definitive > iproute2 syntax > > Signed-off-by: Mathieu Xhonneux Acked-by: Yonghong Song

Re: [PATCH v2 bpf-next 4/4] selftests/bpf: Test for get_socket_cookie

2018-07-30 Thread Yonghong Song
since it's the same socket, and updated. Finally the test verifies the value in the map. Signed-off-by: Andrey Ignatov Acked-by: Yonghong Song

Re: [PATCH bpf-next 4/4] selftests/bpf: Test for get_socket_cookie

2018-07-30 Thread Yonghong Song
On 7/30/18 9:04 AM, Andrey Ignatov wrote: Add test to use get_socket_cookie() from BPF programs of types BPF_PROG_TYPE_SOCK_OPS and BPF_PROG_TYPE_CGROUP_SOCK_ADDR. The test attaches two programs to cgroup, runs TCP server and client in the cgroup and checks that two operations are done

Re: [PATCH bpf-next 3/4] selftests/bpf: Add bpf_get_socket_cookie to bpf_helpers.h

2018-07-30 Thread Yonghong Song
On 7/30/18 9:04 AM, Andrey Ignatov wrote: Add missing helper to bpf_helpers.h that is used in tests and samples. Signed-off-by: Andrey Ignatov Acked-by: Yonghong Song

Re: [PATCH bpf-next 2/4] bpf: Sync bpf.h to tools/

2018-07-30 Thread Yonghong Song
On 7/30/18 9:04 AM, Andrey Ignatov wrote: Sync bpf_get_socket_cookie() related bpf UAPI changes to tools/. Signed-off-by: Andrey Ignatov Acked-by: Yonghong Song

Re: [PATCH bpf-next 1/4] bpf: Support bpf_get_socket_cookie in more prog types

2018-07-30 Thread Yonghong Song
-by: Yonghong Song

Re: [PATCH bpf-next] lwt_bpf: remove unnecessary rcu_read_lock in run_lwt_bpf

2018-07-30 Thread Y Song
t rcu_read_lock in the run_lwt_bpf is unnecessary. > > Signed-off-by: Taehee Yoo Acked-by: Yonghong Song

[PATCH bpf v3] tools/bpftool: fix a percpu_array map dump problem

2018-07-30 Thread Yonghong Song
and stepping through percpu map value array properly in bpftool. Fixes: 71bb428fe2c19 ("tools: bpf: add bpftool") Signed-off-by: Yonghong Song --- tools/bpf/bpftool/map.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) Changelogs: v2 -> v3: . apply on top of

[PATCH bpf v2] tools/bpftool: fix a percpu_array map dump problem

2018-07-29 Thread Yonghong Song
and stepping through percpu map value array properly in bpftool. Fixes: 71bb428fe2c19 ("tools: bpf: add bpftool") Signed-off-by: Yonghong Song --- tools/bpf/bpftool/map.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) Changelogs: v1 -> v2: . Added missin

Re: [PATCH bpf] tools/bpftool: fix a percpu_array map dump problem

2018-07-29 Thread Yonghong Song
On 7/28/18 12:14 PM, Daniel Borkmann wrote: On 07/28/2018 01:11 AM, Yonghong Song wrote: I hit the following problem when I tried to use bpftool to dump a percpu array. $ sudo ./bpftool map show 61: percpu_array name stub flags 0x0 key 4B value 4B max_entries 1 memlock

[PATCH bpf] tools/bpftool: fix a percpu_array map dump problem

2018-07-27 Thread Yonghong Song
and stepping through percpu map value array properly in bpftool. Fixes: 71bb428fe2c19 ("tools: bpf: add bpftool") Signed-off-by: Yonghong Song --- tools/bpf/bpftool/map.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftoo

Re: [PATCH bpf-next 0/4] samples: bpf: convert two more samples to libbpf

2018-07-26 Thread Y Song
gt; Jakub Kicinski (4): > tools: libbpf: handle NULL program gracefully in bpf_program__nth_fd() > tools: libbpf: add bpf_object__find_program_by_title() > samples: bpf: convert xdp_fwd_user.c to libbpf > samples: bpf: convert xdpsock_user.c to libbpf LGTM. Ack for the whol

Re: [PATCH] bpf: verifier: BPF_MOV don't mark dst reg if src == dst

2018-07-26 Thread Y Song
On Thu, Jul 26, 2018 at 9:52 AM, Arthur Fabre wrote: > Oops, gmail seems to have mangled everything. Will resend using git > send-email. > > I've added the test cases for mov64, but I'm not sure of the expected mov32 > behavior. The interpreter has below: ALU_MOV_X: DST

Re: [PATCH] samples/bpf: Add BTF build flags to Makefile

2018-07-26 Thread Taeung Song
On 07/26/2018 10:16 AM, Jakub Kicinski wrote: On Thu, 26 Jul 2018 01:30:39 +0900, Taeung Song wrote: To smoothly test BTF supported binary on samples/bpf, let samples/bpf/Makefile probe llc, pahole and llvm-objcopy for BPF support and use them like tools/testing/selftests/bpf/Makefile

Re: pahole + BTF was: Re: [Question] bpf: about a new 'tools/bpf/bpf_dwarf2btf'

2018-07-25 Thread Taeung Song
On 07/26/2018 03:27 AM, Taeung Song wrote: Hi Arnaldo, On 07/26/2018 02:52 AM, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 26, 2018 at 02:23:32AM +0900, Taeung Song escreveu: Hi, Building bpf programs with .BTF section, I thought it'd be better to convert dwarf info to .BTF by a new tool

Re: pahole + BTF was: Re: [Question] bpf: about a new 'tools/bpf/bpf_dwarf2btf'

2018-07-25 Thread Taeung Song
Hi Arnaldo, On 07/26/2018 02:52 AM, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 26, 2018 at 02:23:32AM +0900, Taeung Song escreveu: Hi, Building bpf programs with .BTF section, I thought it'd be better to convert dwarf info to .BTF by a new tool such as 'tools/bpf/bpf_dwarf2btf' instead

[Question] bpf: about a new 'tools/bpf/bpf_dwarf2btf'

2018-07-25 Thread Taeung Song
Hi, Building bpf programs with .BTF section, I thought it'd be better to convert dwarf info to .BTF by a new tool such as 'tools/bpf/bpf_dwarf2btf' instead of pahole in the future. Currently for bpf binary that have .BTF section, we need to use pahole from

[PATCH] samples/bpf: Add BTF build flags to Makefile

2018-07-25 Thread Taeung Song
by: Taeung Song --- samples/bpf/Makefile | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 1303af10e54d..e079266360a3 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -191,6 +191,8 @@ HOSTLOADLIB

[PATCH v2 bpf-next] tools/bpftool: ignore build products

2018-07-25 Thread Taeung Song
For untracked things of tools/bpf, add this. Reviewed-by: Jakub Kicinski Signed-off-by: Taeung Song --- tools/bpf/.gitignore | 5 + tools/bpf/bpftool/.gitignore | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 tools/bpf/.gitignore diff --git a/tools/bpf/.gitignore b

[PATCH bpf-next] tools/bpftool: ignore build products

2018-07-25 Thread Taeung Song
For untracked things of tools/bpf, add this. Reviewed-by: Quentin Monnet Signed-off-by: Taeung Song --- tools/bpf/.gitignore | 5 + tools/bpf/bpftool/.gitignore | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 tools/bpf/.gitignore diff --git a/tools/bpf/.gitignore b

Re: selftests/bpf test_sockmap failure

2018-07-24 Thread Yonghong Song
On 7/24/18 5:49 PM, Prashant Bhole wrote: On 7/25/2018 8:02 AM, Yonghong Song wrote: On 7/24/18 3:40 PM, John Fastabend wrote: On 07/24/2018 08:45 AM, Yonghong Song wrote: In one of our production machines, tools/testing/selftests/bpf test_sockmap failed randomly like below: ... [TEST

Re: [PATCH bpf] bpf: Use option "help" in the llvm-objcopy test

2018-07-24 Thread Yonghong Song
On 7/20/18 1:37 AM, Daniel Borkmann wrote: On 07/20/2018 07:34 AM, Martin KaFai Lau wrote: I noticed the "--version" option of the llvm-objcopy command has recently disappeared from the master llvm branch. It is currently used as a BTF support test in tools/testing/selftests/bpf/Makefile.

Re: selftests/bpf test_sockmap failure

2018-07-24 Thread Yonghong Song
On 7/24/18 3:40 PM, John Fastabend wrote: On 07/24/2018 08:45 AM, Yonghong Song wrote: In one of our production machines, tools/testing/selftests/bpf test_sockmap failed randomly like below: ... [TEST 78]: (512, 1, 1, sendmsg, pass,apply 1,): rx thread exited with err 1. FAILED

Re: [PATCH v3 bpf 3/3] bpf: Introduce BPF_ANNOTATE_KV_PAIR

2018-07-24 Thread Yonghong Song
to find out the map's btf_key_type_id and btf_value_type_id from a map's name. Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") Suggested-by: Daniel Borkmann Signed-off-by: Martin KaFai Lau Acked-by: Yonghong Song

Re: [PATCH v3 bpf 2/3] bpf: Replace [u]int32_t and [u]int64_t in libbpf

2018-07-24 Thread Yonghong Song
: Yonghong Song

selftests/bpf test_sockmap failure

2018-07-24 Thread Yonghong Song
In one of our production machines, tools/testing/selftests/bpf test_sockmap failed randomly like below: ... [TEST 78]: (512, 1, 1, sendmsg, pass,apply 1,): rx thread exited with err 1. FAILED ... ... [TEST 80]: (2, 1024, 256, sendmsg, pass,apply 1,): rx thread exited with err 1. FAILED ...

Re: [PATCH bpf] bpf: btf: Ensure the member->offset is in the right order

2018-07-23 Thread Yonghong Song
ensure future encoder will not violate this. Fixes: 69b693f0aefa ("bpf: btf: Introduce BPF Type Format (BTF)") Signed-off-by: Martin KaFai Lau Acked-by: Yonghong Song

Re: [PATCH v2 bpf 3/3] bpf: Introduce BPF_ANNOTATE_KV_PAIR

2018-07-23 Thread Yonghong Song
On 7/21/18 11:20 AM, Martin KaFai Lau wrote: This patch introduces BPF_ANNOTATE_KV_PAIR to signal the bpf loader about the btf key_type and value_type of a bpf map. Please refer to the changes in test_btf_haskv.c for its usage. Both iproute2 and libbpf loader will then have the same

Re: [PATCH v2 bpf 2/3] bpf: Replace [u]int32_t and [u]int64_t in libbpf

2018-07-23 Thread Yonghong Song
On 7/21/18 11:20 AM, Martin KaFai Lau wrote: This patch replaces [u]int32_t and [u]int64_t usage with __[su]32 and __[su]64. The same change goes for [u]int16_t and [u]int8_t. Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") Signed-off-by: Martin KaFai Lau ---

Re: [PATCH v2 bpf 1/3] bpf: btf: Sync uapi btf.h to tools

2018-07-23 Thread Yonghong Song
On 7/21/18 11:20 AM, Martin KaFai Lau wrote: This patch sync the uapi btf.h to tools/ Fixes: 36fc3c8c282c bpf: btf: Clean up BTF_INT_BITS() in uapi btf.h Signed-off-by: Martin KaFai Lau Acked-by: Yonghong Song --- tools/include/uapi/linux/btf.h | 2 +- 1 file changed, 1 insertion

[PATCH v2 2/4] samples/bpf: Check the result of system()

2018-07-04 Thread Taeung Song
-off-by: Taeung Song --- samples/bpf/trace_event_user.c | 27 --- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c index 1fa1becfa641..d08046ab81f0 100644 --- a/samples/bpf/trace_event_user.c

[PATCH v2 4/4] samples/bpf: add .gitignore file

2018-07-04 Thread Taeung Song
For untracked executables of samples/bpf, add this. Untracked files: (use "git add ..." to include in what will be committed) samples/bpf/cpustat samples/bpf/fds_example samples/bpf/lathist samples/bpf/load_sock_ops ... Signed-off-by: T

Re: [PATCH] test_bpf: flag tests that cannot be jited on s390

2018-06-28 Thread Song Liu
e tests pass in that case. > > Signed-off-by: Kleber Sacilotto de Souza Acked-by: Song Liu > --- > lib/test_bpf.c | 20 > 1 file changed, 20 insertions(+) > > diff --git a/lib/test_bpf.c b/lib/test_bpf.c > index 60aedc879361..08d3d59dca17 100644 > ---

Re: [PATCH bpf 1/4] xsk: fix potential lost completion message in SKB path

2018-06-28 Thread Song Liu
d under some circumstances lead to a WARN_ON_ONCE > being triggered and the completion message to user space being lost. > > Fixes: 35fcde7f8deb ("xsk: support for Tx") > Signed-off-by: Magnus Karlsson > Reported-by: Pavel Odintsov Acked-by: Song Liu > --- > net/xdp/xsk

Re: [PATCH bpf 3/4] samples/bpf: deal with EBUSY return code from sendmsg in xdpsock sample

2018-06-27 Thread Song Liu
: sample application and documentation for > AF_XDP sockets") > Signed-off-by: Magnus Karlsson > Reported-by: Pavel Odintsov Acked-by: Song Liu > --- > samples/bpf/xdpsock_user.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/samples/bpf/xd

Re: [PATCH bpf 2/4] xsk: frame could be completed more than once in SKB path

2018-06-27 Thread Song Liu
> > Fixes: 35fcde7f8deb ("xsk: support for Tx") > Signed-off-by: Magnus Karlsson > Reported-by: Pavel Odintsov Acked-by: Song Liu > --- > net/xdp/xsk.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/xdp/xsk.c b/net/xdp/xs

Re: [bpf-next PATCH 1/2] samples/bpf: extend xdp_rxq_info to read packet payload

2018-06-27 Thread Song Liu
On Wed, Jun 27, 2018 at 4:23 AM, Jesper Dangaard Brouer wrote: > On Tue, 26 Jun 2018 16:53:15 -0700 > Song Liu wrote: > >> > +static char* options2str(enum cfg_options_flags flag) >> > +{ >> > + if (flag == NO_TOUCH) >> > + return

Re: [bpf-next PATCH 2/2] samples/bpf: xdp_rxq_info action XDP_TX must adjust MAC-addrs

2018-06-27 Thread Song Liu
On Wed, Jun 27, 2018 at 4:20 AM, Jesper Dangaard Brouer wrote: > On Tue, 26 Jun 2018 17:09:01 -0700 > Song Liu wrote: > >> On Mon, Jun 25, 2018 at 7:27 AM, Jesper Dangaard Brouer >> wrote: >> > XDP_TX requires also changing the MAC-addrs, else some hardware >

Re: [bpf-next PATCH 2/2] samples/bpf: xdp_rxq_info action XDP_TX must adjust MAC-addrs

2018-06-26 Thread Song Liu
t; @@ -119,6 +121,8 @@ static char* options2str(enum cfg_options_flags flag) > { > if (flag == NO_TOUCH) > return "no_touch"; > + if (flag & SWAP_MAC) > + return "swapmac"; > if (flag & READ_MEM

Re: [bpf-next PATCH 1/2] samples/bpf: extend xdp_rxq_info to read packet payload

2018-06-26 Thread Song Liu
M = 0x1U, > }; > #define XDP_ACTION_MAX (XDP_TX + 1) > #define XDP_ACTION_MAX_STRLEN 11 > @@ -109,6 +115,16 @@ static void list_xdp_actions(void) > printf("\n"); > } > > +static char* options2str(enum cfg_options_flags flag) > +{ > + i

Re: [PATCH RESEND bpf-next v6 2/2] samples/bpf: Add xdp_sample_pkts example

2018-06-26 Thread Song Liu
i > Signed-off-by: Toke Høiland-Jørgensen Acked-by: Song Liu > --- > samples/bpf/Makefile |4 + > samples/bpf/xdp_sample_pkts_kern.c | 66 ++ > samples/bpf/xdp_sample_pkts_user.c | 169 > > 3 files chang

Re: [PATCH RESEND bpf-next v6 1/2] trace_helpers.c: Add helpers to poll multiple perf FDs for events

2018-06-26 Thread Song Liu
; > Reviewed-by: Jakub Kicinski > Signed-off-by: Toke Høiland-Jørgensen Acked-by: Song Liu > --- > tools/testing/selftests/bpf/trace_helpers.c | 48 > ++- > tools/testing/selftests/bpf/trace_helpers.h |4 ++ > 2 files changed, 50 insertions(

Re: [PATCH bpf-next 6/7] nfp: bpf: support u32 divide using reciprocal_div.h

2018-06-26 Thread Song Liu
level by failing compilation. However LLVM assembler hasn't enforced this, > so it is possible for negative constant to leak in as a BPF_K operand > through assembly code, we reject such cases as well. > > Signed-off-by: Jiong Wang > Reviewed-by: Jakub Kicinski Acked-by: Song Liu &g

Re: [PATCH bpf-next 5/7] nfp: bpf: support u16 and u32 multiplications

2018-06-26 Thread Song Liu
e is no difference on the low halve > of result for signed/unsigned mul, so we will get correct result. > > Signed-off-by: Jiong Wang > Reviewed-by: Jakub Kicinski Acked-by: Song Liu > --- > drivers/net/ethernet/netronome/nfp/bpf/jit.c | 137 ++ > driver

Re: [PATCH bpf-next 1/7] nfp: bpf: allow source ptr type be map ptr in memcpy optimization

2018-06-26 Thread Song Liu
On Tue, Jun 26, 2018 at 12:08 AM, Jakub Kicinski wrote: > On Mon, Jun 25, 2018 at 10:50 PM, Song Liu wrote: >> On Sun, Jun 24, 2018 at 8:54 PM, Jakub Kicinski >> wrote: >>> From: Jiong Wang >>> >>> Map read has been supported on NFP, this patch en

Re: [PATCH bpf-next 4/7] nfp: bpf: copy range info for all operands of all ALU operations

2018-06-26 Thread Song Liu
example, to decide whether > multiplication and divide are supported on the given range. > > This patch simply let NFP verifier hook to copy range info for all operands > of all ALU operands. > > Signed-off-by: Jiong Wang > Reviewed-by: Jakub Kicinski Acked-by: Song Liu >

Re: [PATCH bpf-next 2/7] lib: reciprocal_div: implement the improved algorithm on the paper mentioned

2018-06-26 Thread Song Liu
2 d) > return R; > } > EXPORT_SYMBOL(reciprocal_value); > + > +struct reciprocal_value_adv reciprocal_value_adv(u32 d, u8 prec) > +{ > + struct reciprocal_value_adv R; > + u32 l, post_shift; > + u64 mhigh, mlow; > + > + l = fls(d

Re: [PATCH bpf-next 3/7] nfp: bpf: rename umin/umax to umin_src/umax_src

2018-06-26 Thread Song Liu
On Sun, Jun 24, 2018 at 8:54 PM, Jakub Kicinski wrote: > From: Jiong Wang > > The two fields are a copy of umin and umax info of bpf_insn->src_reg > generated by verifier. > > Rename to make their meaning clear. > > Signed-off-by: Jiong Wang > Reviewed-by: Jakub

Re: [PATCH bpf-next 1/7] nfp: bpf: allow source ptr type be map ptr in memcpy optimization

2018-06-25 Thread Song Liu
;insn.src_reg * 2, off, > _base, > ); Did this break other cases before this patch? I am sorry if this is a dumb question. I don't think I fully understand addr40_offset(). Song > > /* Setup PREV_ALU fields to override memory read length. */

Re: [PATCH bpf] nfp: bpf: don't stop offload if replace failed

2018-06-24 Thread Song Liu
nd v4.14.x do need to > stop offload if it was transparent/opportunistic, i.e. if > XDP_FLAGS_HW_MODE was not set on running program. > > Fixes: cafa92ac2553 ("nfp: bpf: add support for XDP_FLAGS_HW_MODE") > Signed-off-by: Jakub Kicinski > Reviewed-by: Quentin Mon

[PATCH bpf] tools/bpf: fix test_sockmap failure

2018-06-21 Thread Yonghong Song
max rlimit to RLIM_INFINITY. Let us just use it. Signed-off-by: Yonghong Song --- tools/testing/selftests/bpf/test_sockmap.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c index 05c8cb7..9e78df2 100644 -

Re: [PATCH bpf 2/2] tools: bpftool: remember to close the libbpf object after prog load

2018-06-20 Thread Song Liu
load closes the libbpf object (which unloads and frees > it). > > Fixes: 49a086c201a9 ("bpftool: implement prog load command") > Signed-off-by: Jakub Kicinski > Reviewed-by: Quentin Monnet Acked-by: Song Liu > --- > tools/bpf/bpftool/prog.c | 8 +++- > 1 file ch

Re: [PATCH bpf 1/2] tools: bpftool: remove duplicated error message on prog load

2018-06-20 Thread Song Liu
_kern.o /sys/fs/bpf/a > { > "error": "can't pin the object (/sys/fs/bpf/a): File exists" > },{ > "error": "failed to pin program" > } > > Fixes: 49a086c201a9 ("bpftool: implement prog load command") > Signed-off-by

Re: [PATCH bpf-next v5 00/10] BTF: BPF Type Format

2018-06-15 Thread Yonghong Song
On 6/15/18 7:24 AM, Arnaldo Carvalho de Melo wrote: Em Thu, Jun 14, 2018 at 09:56:43PM -0700, Yonghong Song escreveu: I really want to get rid of this option as well. To make pahole work with the default default format, I need to add bpf support to libdwfl in elfutils repo. I will work

Re: [PATCH bpf-next v5 00/10] BTF: BPF Type Format

2018-06-14 Thread Yonghong Song
On 6/14/18 11:00 AM, Arnaldo Carvalho de Melo wrote: Em Thu, Jun 14, 2018 at 02:47:59PM -0300, Arnaldo Carvalho de Melo escreveu: Em Thu, Jun 14, 2018 at 10:21:30AM -0700, Alexei Starovoitov escreveu: On 6/14/18 10:18 AM, Arnaldo Carvalho de Melo wrote: Just out of curiosity, is there any

Re: [PATCH bpf v2] xdp: Fix handling of devmap in generic XDP

2018-06-13 Thread Y Song
On Wed, Jun 13, 2018 at 8:40 PM, Toshiaki Makita wrote: > On 2018/06/14 11:56, Y Song wrote: > ... >>> @@ -586,6 +589,15 @@ int dev_map_enqueue(struct bpf_dtab_netdev *dst, >>> struct xdp_buff *xdp, >>> return 0; >>> } >>>

Re: [PATCH bpf v2] xdp: Fix handling of devmap in generic XDP

2018-06-13 Thread Y Song
On Wed, Jun 13, 2018 at 7:07 PM, Toshiaki Makita wrote: > Commit 67f29e07e131 ("bpf: devmap introduce dev_map_enqueue") changed > the return value type of __devmap_lookup_elem() from struct net_device * > to struct bpf_dtab_netdev * but forgot to modify generic XDP code > accordingly. > Thus

Re: [PATCH 1/1] selftest: check tunnel type more accurately

2018-06-13 Thread Y Song
On Wed, Jun 13, 2018 at 5:03 AM, Wang Jian wrote: > Grep tunnel type directly to make sure 'ip' command supports it. > > Signed-off-by: Jian Wang Acked-by: Yonghong Song

[PATCH bpf v3] tools/bpftool: fix a bug in bpftool perf

2018-06-11 Thread Yonghong Song
c302 ("tools/bpftool: add perf subcommand") Reported-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- tools/bpf/bpftool/perf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Changelogs: v2 -> v3: . fix a stupid error (flippingg the condition) I introduced

Re: [PATCH bpf v2] tools/bpftool: fix a bug in bpftool perf

2018-06-11 Thread Yonghong Song
On 6/11/18 7:42 PM, Jakub Kicinski wrote: On Mon, 11 Jun 2018 19:01:08 -0700, Yonghong Song wrote: Commit b04df400c302 ("tools/bpftool: add perf subcommand") introduced bpftool subcommand perf to query bpf program kuprobe and tracepoint attachments. The perf subcommand will

[PATCH bpf v2] tools/bpftool: fix a bug in bpftool perf

2018-06-11 Thread Yonghong Song
c302 ("tools/bpftool: add perf subcommand") Reported-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- tools/bpf/bpftool/perf.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) Changelogs: v1 -> v2: . remove '\n' in the p_err format string in order to ha

Re: [PATCH bpf] tools/bpftool: fix a bug in bpftool perf

2018-06-11 Thread Yonghong Song
On 6/11/18 6:49 PM, Jakub Kicinski wrote: On Mon, 11 Jun 2018 18:15:16 -0700, Yonghong Song wrote: Commit b04df400c302 ("tools/bpftool: add perf subcommand") introduced bpftool subcommand perf to query bpf program kuprobe and tracepoint attachments. The perf subcommand will

[PATCH bpf] tools/bpftool: fix a bug in bpftool perf

2018-06-11 Thread Yonghong Song
c302 ("tools/bpftool: add perf subcommand") Reported-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- tools/bpf/bpftool/perf.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/bpf/bpftool/perf.c b/tools/bpf/bpftool/perf.c index ac6b1a12c9b7..f1e4c

Re: [bpf PATCH] bpf: selftest fix for sockmap

2018-06-11 Thread Y Song
On Mon, Jun 11, 2018 at 11:47 AM, John Fastabend wrote: > In selftest test_maps the sockmap test case attempts to add a socket > in listening state to the sockmap. This is no longer a valid operation > so it fails as expected. However, the test wrongly reports this as an > error now. Fix the test

Re: [PATCH bpf] xsk: silence warning on memory allocation failure

2018-06-11 Thread Y Song
free to deny its allocation. In > this patch, the failed allocation attempt is silenced with > __GFP_NOWARN. > > Fixes: c0c77d8fb787 ("xsk: add user memory registration support sockopt") > Reported-by: syzbot+4abadc5d69117b346...@syzkaller.appspotmail.com > Signed-off-by: Björn Töpel Acked-by: Yonghong Song

Re: [PATCH bpf] bpf: reject passing modified ctx to helper functions

2018-06-07 Thread Y Song
zkaller.appspotmail.com > Signed-off-by: Daniel Borkmann > Acked-by: Alexei Starovoitov Tested with bcc for the above ctx + unknown_offset usage for bpf_probe_read. No breakage. Acked-by: Yonghong Song > --- > kernel/bpf/verifier.c | 48 +++

[PATCH bpf] tools/bpf: fix selftest get_cgroup_id_user

2018-06-06 Thread Yonghong Song
as passed-in pid. This ensures that the recorded cgroup_id is for the cgroup within which the test program resides. Fixes: f269099a7e7a ("tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper") Signed-off-by: Yonghong Song --- tools/testing/selftests/bpf/get_c

[PATCH bpf-next] bpf: guard bpf_get_current_cgroup_id() with CONFIG_CGROUPS

2018-06-04 Thread Yonghong Song
rrent_cgroup_id() helper") Suggested-by: Daniel Borkmann Signed-off-by: Yonghong Song --- kernel/trace/bpf_trace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index e2ab5b7..0ae6829 100644 --- a/kernel/trace/bpf_trace.c +++ b/kern

Re: [PATCH net-next v2 1/3] bpf: implement bpf_get_current_cgroup_id() helper

2018-06-04 Thread Yonghong Song
On 6/4/18 7:58 AM, Alexei Starovoitov wrote: On Mon, Jun 04, 2018 at 11:08:35AM +0200, Daniel Borkmann wrote: On 06/04/2018 12:59 AM, Yonghong Song wrote: bpf has been used extensively for tracing. For example, bcc contains an almost full set of bpf-based tools to trace kernel and user

Re: [PATCH net-next 0/3] bpf: implement bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
On 6/3/18 1:00 PM, Alexei Starovoitov wrote: On Sun, Jun 03, 2018 at 12:36:51AM -0700, Yonghong Song wrote: bpf has been used extensively for tracing. For example, bcc contains an almost full set of bpf-based tools to trace kernel and user functions/events. Most tracing tools are currently

[PATCH net-next v2 3/3] tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
Syscall name_to_handle_at() can be used to get cgroup id for a particular cgroup path in user space. The selftest got cgroup id from both user and kernel, and compare to ensure they are equal to each other. Acked-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- tools/testing/selftests

[PATCH net-next v2 0/3] bpf: implement bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
or policy could be configgured in the bpf program based on current task cgroup. Changelog: v1 -> v2: . rebase to resolve merge conflict with latest bpf-next. Yonghong Song (3): bpf: implement bpf_get_current_cgroup_id() helper tools/bpf: sync uapi bpf.h for bpf_get_current_cgroup

[PATCH net-next v2 1/3] bpf: implement bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
is currently implemented for tracing. It can be added to other program types as well when needed. Acked-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- include/linux/bpf.h | 1 + include/uapi/linux/bpf.h | 8 +++- kernel/bpf/core.c| 1 + kernel/bpf/helpers.c | 15

[PATCH net-next v2 2/3] tools/bpf: sync uapi bpf.h for bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
Sync kernel uapi/linux/bpf.h with tools uapi/linux/bpf.h. Also add the necessary helper define in bpf_helpers.h. Acked-by: Alexei Starovoitov Signed-off-by: Yonghong Song --- tools/include/uapi/linux/bpf.h| 8 +++- tools/testing/selftests/bpf/bpf_helpers.h | 2 ++ 2 files

[PATCH net-next 2/3] tools/bpf: sync uapi bpf.h for bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
Sync kernel uapi/linux/bpf.h with tools uapi/linux/bpf.h. Also add the necessary helper define in bpf_helpers.h. Signed-off-by: Yonghong Song --- tools/include/uapi/linux/bpf.h| 9 - tools/testing/selftests/bpf/bpf_helpers.h | 2 ++ 2 files changed, 10 insertions(+), 1

[PATCH net-next 0/3] bpf: implement bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
or policy could be configgured in the bpf program based on current task cgroup. Yonghong Song (3): bpf: implement bpf_get_current_cgroup_id() helper tools/bpf: sync uapi bpf.h for bpf_get_current_cgroup_id() helper tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper include/linux

[PATCH net-next 3/3] tools/bpf: add a selftest for bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
Syscall name_to_handle_at() can be used to get cgroup id for a particular cgroup path in user space. The selftest got cgroup id from both user and kernel, and compare to ensure they are equal to each other. Signed-off-by: Yonghong Song --- tools/testing/selftests/bpf/.gitignore | 1

[PATCH net-next 1/3] bpf: implement bpf_get_current_cgroup_id() helper

2018-06-03 Thread Yonghong Song
is currently implemented for tracing. It can be added to other program types as well when needed. Signed-off-by: Yonghong Song --- include/linux/bpf.h | 1 + include/uapi/linux/bpf.h | 9 - kernel/bpf/core.c| 1 + kernel/bpf/helpers.c | 15 +++ kernel/trace

Re: [bpf-next V2 PATCH 7/8] bpf/xdp: non-map redirect can avoid calling ndo_xdp_flush

2018-05-31 Thread Song Liu
it to flush via XDP_XMIT_FLUSH flag. > > Signed-off-by: Jesper Dangaard Brouer Acked-by: Song Liu > --- > net/core/filter.c |3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/net/core/filter.c b/net/core/filter.c > index 6a21dbcad350..6981b460

Re: [bpf-next V2 PATCH 6/8] xdp: done implementing ndo_xdp_xmit flush flag for all drivers

2018-05-31 Thread Song Liu
Brouer Acked-by: Song Liu > --- > include/net/xdp.h |1 - > 1 file changed, 1 deletion(-) > > diff --git a/include/net/xdp.h b/include/net/xdp.h > index 0c45f0f943ed..a3b71a4dd71d 100644 > --- a/include/net/xdp.h > +++ b/include/net/xdp.h > @@ -41,7 +41,6 @@ e

Re: [bpf-next V2 PATCH 5/8] virtio_net: implement flush flag for ndo_xdp_xmit

2018-05-31 Thread Song Liu
On Thu, May 31, 2018 at 2:00 AM, Jesper Dangaard Brouer wrote: > When passed the XDP_XMIT_FLUSH flag virtnet_xdp_xmit now performs the > same virtqueue_kick as virtnet_xdp_flush. > > Signed-off-by: Jesper Dangaard Brouer Acked-by: Song Liu > --- > drivers/net/virtio_net.c

Re: [bpf-next V2 PATCH 4/8] tun: implement flush flag for ndo_xdp_xmit

2018-05-31 Thread Song Liu
-off-by: Jesper Dangaard Brouer Acked-by: Song Liu > --- > drivers/net/tun.c | 19 +-- > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/tun.c b/drivers/net/tun.c > index b182b8cdd219..d82a05fb0594 100644 > --- a/drivers

Re: [bpf-next V2 PATCH 3/8] ixgbe: implement flush flag for ndo_xdp_xmit

2018-05-31 Thread Song Liu
> Signed-off-by: Jesper Dangaard Brouer Acked-by: Song Liu > --- > drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 ++-- > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c > b/drivers/net/

Re: [bpf-next V2 PATCH 8/8] bpf/xdp: devmap can avoid calling ndo_xdp_flush

2018-05-31 Thread Song Liu
e ndo_xdp_flush > completely, as this is the last user of ndo_xdp_flush. This is left > for later patches, to keep driver changes separate. > > Signed-off-by: Jesper Dangaard Brouer Acked-by: Song Liu > --- > kernel/bpf/devmap.c | 19 ++- > 1 file changed, 6 ins

Re: [PATCH] samples/bpf: Add xdp_sample_pkts example

2018-05-30 Thread Song Liu
ssary to change it after starting the example userspace program. Why does this only works when everything runs on CPU0? Is this something we can improve? Thanks, Song > > Signed-off-by: Toke Høiland-Jørgensen > --- > samples/bpf/Makefile | 4 + > samples/bpf/xdp_

<    1   2   3   4   5   6   7   8   9   10   >