Re: [v4,2/4] tools: bpftool: add net detach command to detach XDP on interface

2019-08-11 Thread Y Song
On Fri, Aug 9, 2019 at 6:35 AM Daniel T. Lee wrote: > > By this commit, using `bpftool net detach`, the attached XDP prog can > be detached. Detaching the BPF prog will be done through libbpf > 'bpf_set_link_xdp_fd' with the progfd set to -1. > > Signed-off-by: Daniel T. Lee > --- > tools/bpf/bp

Re: [v4,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-11 Thread Y Song
On Fri, Aug 9, 2019 at 6:35 AM Daniel T. Lee wrote: > > By this commit, using `bpftool net attach`, user can attach XDP prog on > interface. New type of enum 'net_attach_type' has been made, as stated at > cover-letter, the meaning of 'attach' is, prog will be attached on interface. > > With 'over

Re: [PATCH bpf-next v5 0/6] xdp: Add devmap_hash map type

2019-08-08 Thread Y Song
On Thu, Aug 8, 2019 at 12:43 PM Toke Høiland-Jørgensen wrote: > > Alexei Starovoitov writes: > > > On Fri, Jul 26, 2019 at 9:06 AM Toke Høiland-Jørgensen > > wrote: > >> > >> This series adds a new map type, devmap_hash, that works like the existing > >> devmap type, but using a hash-based inde

Re: [v3,2/4] tools: bpftool: add net detach command to detach XDP on interface

2019-08-08 Thread Y Song
On Wed, Aug 7, 2019 at 1:40 PM Maciej Fijalkowski wrote: > > On Wed, 7 Aug 2019 13:12:17 -0700 > Y Song wrote: > > > On Wed, Aug 7, 2019 at 11:30 AM Maciej Fijalkowski > > wrote: > > > > > > On Wed, 7 Aug 2019 10:02:04 -0700 > > > Y Song

Re: [bpf-next v3 PATCH 2/3] samples/bpf: make xdp_fwd more practically usable via devmap lookup

2019-08-08 Thread Y Song
On Thu, Aug 8, 2019 at 9:17 AM Jesper Dangaard Brouer wrote: > > This address the TODO in samples/bpf/xdp_fwd_kern.c, which points out > that the chosen egress index should be checked for existence in the > devmap. This can now be done via taking advantage of Toke's work in > commit 0cdbb4b09a06 (

Re: [PATCH v5 bpf-next] BPF: helpers: New helper to obtain namespace data from current task

2019-08-08 Thread Y Song
On Thu, Aug 8, 2019 at 10:52 AM Carlos Antonio Neira Bustos wrote: > > Yonghong, > > I have modified the patch following your feedback. > Let me know if I'm missing something. Yes, I have some other requests about formating. https://lore.kernel.org/netdev/20190808174848.poybtaagg5ctle7t@dev00/T/#

Re: [v3,2/4] tools: bpftool: add net detach command to detach XDP on interface

2019-08-07 Thread Y Song
On Wed, Aug 7, 2019 at 11:30 AM Maciej Fijalkowski wrote: > > On Wed, 7 Aug 2019 10:02:04 -0700 > Y Song wrote: > > > On Tue, Aug 6, 2019 at 7:25 PM Daniel T. Lee wrote: > > > > > > By this commit, using `bpftool net detach`, the attached XDP prog can >

Re: [bpf-next PATCH 3/3] samples/bpf: xdp_fwd explain bpf_fib_lookup return codes

2019-08-07 Thread Y Song
On Wed, Aug 7, 2019 at 5:38 AM Jesper Dangaard Brouer wrote: > > Make it clear that this XDP program depend on the network > stack to do the ARP resolution. This is connected with the > BPF_FIB_LKUP_RET_NO_NEIGH return code from bpf_fib_lookup(). > > Another common mistake (seen via XDP-tutorial)

Re: [bpf-next PATCH 2/3] samples/bpf: make xdp_fwd more practically usable via devmap lookup

2019-08-07 Thread Y Song
On Wed, Aug 7, 2019 at 5:37 AM Jesper Dangaard Brouer wrote: > > This address the TODO in samples/bpf/xdp_fwd_kern.c, which points out > that the chosen egress index should be checked for existence in the > devmap. This can now be done via taking advantage of Toke's work in > commit 0cdbb4b09a06 (

Re: [bpf-next PATCH 1/3] samples/bpf: xdp_fwd rename devmap name to be xdp_tx_ports

2019-08-07 Thread Y Song
On Wed, Aug 7, 2019 at 5:37 AM Jesper Dangaard Brouer wrote: > > The devmap name 'tx_port' came from a copy-paste from xdp_redirect_map > which only have a single TX port. Change name to xdp_tx_ports > to make it more descriptive. > > Signed-off-by: Jesper Dangaard Brouer Acked-by: Yonghong Song

Re: [v3,2/4] tools: bpftool: add net detach command to detach XDP on interface

2019-08-07 Thread Y Song
On Tue, Aug 6, 2019 at 7:25 PM Daniel T. Lee wrote: > > By this commit, using `bpftool net detach`, the attached XDP prog can > be detached. Detaching the BPF prog will be done through libbpf > 'bpf_set_link_xdp_fd' with the progfd set to -1. > > Signed-off-by: Daniel T. Lee > --- > tools/bpf/bp

Re: [v3,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-07 Thread Y Song
On Tue, Aug 6, 2019 at 7:25 PM Daniel T. Lee wrote: > > By this commit, using `bpftool net attach`, user can attach XDP prog on > interface. New type of enum 'net_attach_type' has been made, as stated at > cover-letter, the meaning of 'attach' is, prog will be attached on interface. > > With 'over

Re: [PATCH bpf 0/2] tools: bpftool: fix pinning error messages

2019-08-06 Thread Y Song
On Tue, Aug 6, 2019 at 5:20 PM Jakub Kicinski wrote: > > Hi! > > First make sure we don't use "prog" in error messages because > the pinning operation could be performed on a map. Second add > back missing error message if pin syscall failed. > > Jakub Kicinski (2): > tools: bpftool: fix error m

Re: [PATCH 1/1] bpf: introduce new helper udp_flow_src_port

2019-08-04 Thread Y Song
ied for our custom use case. > > > > The Linux kernel provides a single abstraction for the src port for UDP > > tunneling > > via udp_flow_src_port. If it's improved eBPF filters would benefit if the > > call is the same. > > > > Exposing this fun

Re: [PATCH 1/1] bpf: introduce new helper udp_flow_src_port

2019-08-03 Thread Y Song
On Sat, Aug 3, 2019 at 8:29 PM Farid Zakaria wrote: > > Foo over UDP uses UDP encapsulation to add additional entropy > into the packets so that they get beter distribution across EMCP > routes. > > Expose udp_flow_src_port as a bpf helper so that tunnel filters > can benefit from the helper. > >

Re: [v2,0/2] tools: bpftool: add net attach/detach command to attach XDP prog

2019-08-01 Thread Y Song
On Thu, Aug 1, 2019 at 1:33 AM Daniel T. Lee wrote: > > Currently, bpftool net only supports dumping progs attached on the > interface. To attach XDP prog on interface, user must use other tool > (eg. iproute2). By this patch, with `bpftool net attach/detach`, user > can attach/detach XDP prog on

Re: [v2,2/2] tools: bpftool: add net detach command to detach XDP on interface

2019-08-01 Thread Y Song
On Thu, Aug 1, 2019 at 2:04 AM Daniel T. Lee wrote: > > By this commit, using `bpftool net detach`, the attached XDP prog can > be detached. Detaching the BPF prog will be done through libbpf > 'bpf_set_link_xdp_fd' with the progfd set to -1. > > Signed-off-by: Daniel T. Lee > --- > Changes in v2

Re: [v2,1/2] tools: bpftool: add net attach command to attach XDP on interface

2019-08-01 Thread Y Song
On Thu, Aug 1, 2019 at 2:04 AM Daniel T. Lee wrote: > > By this commit, using `bpftool net attach`, user can attach XDP prog on > interface. New type of enum 'net_attach_type' has been made, as stated at > cover-letter, the meaning of 'attach' is, prog will be attached on interface. > > BPF prog w

Re: [PATCH 1/2] libbpf: Fix endianness macro usage for some compilers

2019-07-19 Thread Y Song
On Fri, Jul 19, 2019 at 7:35 AM Arnaldo Carvalho de Melo wrote: > > From: Arnaldo Carvalho de Melo > > Using endian.h and its endianness macros makes this code build in a > wider range of compilers, as some don't have those macros > (__BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__),

Re: [PATCH bpf v2] bpf: fix narrower loads on s390

2019-07-18 Thread Y Song
On Thu, Jul 18, 2019 at 8:01 AM Ilya Leoshkevich wrote: > > The very first check in test_pkt_md_access is failing on s390, which > happens because loading a part of a struct __sk_buff field produces > an incorrect result. > > The preprocessed code of the check is: > > { > __u8 tmp = *((vol

Re: [PATCH bpf] bpf: fix narrower loads on s390

2019-07-17 Thread Y Song
On Wed, Jul 17, 2019 at 1:52 PM Ilya Leoshkevich wrote: > > > Am 17.07.2019 um 18:25 schrieb Y Song : > > > > On Wed, Jul 17, 2019 at 3:36 AM Ilya Leoshkevich wrote: > >> > >> > >> Here is a better one: len=0x11223344 and we would like to do >

Re: [PATCH bpf] bpf: fix narrower loads on s390

2019-07-17 Thread Y Song
On Wed, Jul 17, 2019 at 3:36 AM Ilya Leoshkevich wrote: > > > Am 17.07.2019 um 11:21 schrieb Ilya Leoshkevich : > > > >> Am 17.07.2019 um 07:11 schrieb Y Song : > >> > >> [sorry, resend again as previous one has come text messed out due to > >> n

Re: [PATCH bpf] bpf: fix narrower loads on s390

2019-07-16 Thread Y Song
[sorry, resend again as previous one has come text messed out due to networking issues] On Tue, Jul 16, 2019 at 10:08 PM Y Song wrote: > > On Tue, Jul 16, 2019 at 4:59 AM Ilya Leoshkevich wrote: > > > > test_pkt_md_access is failing on s390, since the associated eBP

Re: [PATCH bpf] bpf: fix narrower loads on s390

2019-07-16 Thread Y Song
On Tue, Jul 16, 2019 at 4:59 AM Ilya Leoshkevich wrote: > > test_pkt_md_access is failing on s390, since the associated eBPF prog > returns TC_ACT_SHOT, which in turn happens because loading a part of a > struct __sk_buff field produces an incorrect result. > > The problem is that when verifier em

Re: [PATCH bpf] selftests/bpf: fix test_send_signal_nmi on s390

2019-07-12 Thread Y Song
On Fri, Jul 12, 2019 at 11:24 AM Andrii Nakryiko wrote: > > On Fri, Jul 12, 2019 at 10:46 AM Ilya Leoshkevich wrote: > > > > Many s390 setups (most notably, KVM guests) do not have access to > > hardware performance events. > > > > Therefore, use the software event instead. > > > > Signed-off-by:

Re: [PATCH bpf-next v2 4/6] xdp: Add devmap_hash map type for looking up devices by hashed index

2019-07-08 Thread Y Song
On Mon, Jul 8, 2019 at 2:55 AM Toke Høiland-Jørgensen wrote: > > Y Song writes: > > > On Sat, Jul 6, 2019 at 1:48 AM Toke Høiland-Jørgensen > > wrote: > >> > >> From: Toke Høiland-Jørgensen > >> > >> A common pattern when using xd

Re: [PATCH bpf-next v2 4/6] xdp: Add devmap_hash map type for looking up devices by hashed index

2019-07-06 Thread Y Song
On Sat, Jul 6, 2019 at 1:48 AM Toke Høiland-Jørgensen wrote: > > From: Toke Høiland-Jørgensen > > A common pattern when using xdp_redirect_map() is to create a device map > where the lookup key is simply ifindex. Because device maps are arrays, > this leaves holes in the map, and the map has to b

Re: [PATCH bpf-next v2 2/6] xdp: Refactor devmap allocation code for reuse

2019-07-06 Thread Y Song
On Sat, Jul 6, 2019 at 1:47 AM Toke Høiland-Jørgensen wrote: > > From: Toke Høiland-Jørgensen > > The subsequent patch to add a new devmap sub-type can re-use much of the > initialisation and allocation code, so refactor it into separate functions. > > Signed-off-by: Toke Høiland-Jørgensen Acke

Re: [PATCH bpf-next v2 1/6] include/bpf.h: Remove map_insert_ctx() stubs

2019-07-06 Thread Y Song
On Sat, Jul 6, 2019 at 1:47 AM Toke Høiland-Jørgensen wrote: > > From: Toke Høiland-Jørgensen > > When we changed the device and CPU maps to use linked lists instead of > bitmaps, we also removed the need for the map_insert_ctx() helpers to keep > track of the bitmaps inside each map. However, it

Re: [PATCH bpf-next v2 0/6] xdp: Add devmap_hash map type

2019-07-06 Thread Y Song
On Sat, Jul 6, 2019 at 1:47 AM Toke Høiland-Jørgensen wrote: > > This series adds a new map type, devmap_hash, that works like the existing > devmap type, but using a hash-based indexing scheme. This is useful for the > use > case where a devmap is indexed by ifindex (for instance for use with th

Re: [PATCH bpf-next 3/3] xdp: Add devmap_hash map type for looking up devices by hashed index

2019-07-05 Thread Y Song
On Fri, Jul 5, 2019 at 11:14 AM Toke Høiland-Jørgensen wrote: > > From: Toke Høiland-Jørgensen > > A common pattern when using xdp_redirect_map() is to create a device map > where the lookup key is simply ifindex. Because device maps are arrays, > this leaves holes in the map, and the map has to

Re: [PATCH bpf-next v2] tools: bpftool: add "prog run" subcommand to test-run programs

2019-07-05 Thread Y Song
On Fri, Jul 5, 2019 at 10:54 AM Quentin Monnet wrote: > > Add a new "bpftool prog run" subcommand to run a loaded program on input > data (and possibly with input context) passed by the user. > > Print output data (and output context if relevant) into a file or into > the console. Print return val

Re: [PATCH bpf-next] tools: bpftool: add "prog run" subcommand to test-run programs

2019-07-05 Thread Y Song
On Fri, Jul 5, 2019 at 9:03 AM Quentin Monnet wrote: > > 2019-07-05 08:42 UTC-0700 ~ Y Song > > On Fri, Jul 5, 2019 at 1:21 AM Quentin Monnet > > wrote: > >> > >> 2019-07-04 22:49 UTC-0700 ~ Y Song > >>> On Thu, Jul 4, 2019 at 1:58 AM Quen

Re: [PATCH bpf-next] tools: bpftool: add "prog run" subcommand to test-run programs

2019-07-05 Thread Y Song
On Fri, Jul 5, 2019 at 1:21 AM Quentin Monnet wrote: > > 2019-07-04 22:49 UTC-0700 ~ Y Song > > On Thu, Jul 4, 2019 at 1:58 AM Quentin Monnet > > wrote: > >> > >> Add a new "bpftool prog run" subcommand to run a loaded program on input > >&g

Re: [PATCH bpf-next] tools: bpftool: add "prog run" subcommand to test-run programs

2019-07-04 Thread Y Song
On Thu, Jul 4, 2019 at 1:58 AM Quentin Monnet wrote: > > Add a new "bpftool prog run" subcommand to run a loaded program on input > data (and possibly with input context) passed by the user. > > Print output data (and output context if relevant) into a file or into > the console. Print return valu

Re: [PATCH v2 bpf-next] selftests/bpf: fix "alu with different scalars 1" on s390

2019-07-04 Thread Y Song
On Thu, Jul 4, 2019 at 1:52 AM Ilya Leoshkevich wrote: > > BPF_LDX_MEM is used to load the least significant byte of the retrieved > test_val.index, however, on big-endian machines it ends up retrieving > the most significant byte. > > Use the correct least significant byte offset on big-endian ma

Re: [PATCH bpf-next] selftests/bpf: make verifier loop tests arch independent

2019-07-03 Thread Y Song
On Wed, Jul 3, 2019 at 1:51 PM Stanislav Fomichev wrote: > > Take the first x bytes of pt_regs for scalability tests, there is > no real reason we need x86 specific rax. > > Signed-off-by: Stanislav Fomichev > --- > tools/testing/selftests/bpf/progs/loop1.c | 3 ++- > tools/testing/selftests/bpf

Re: [PATCH bpf-next] selftests/bpf: fix test_align liveliness expectations

2019-07-03 Thread Y Song
On Wed, Jul 3, 2019 at 2:31 PM Stanislav Fomichev wrote: > > Commit 2589726d12a1 ("bpf: introduce bounded loops") caused a change > in the way some registers liveliness is reported in the test_align. > Add missing "_w" to a couple of tests. Note, there are no offset > changes! > > Fixes: 2589726d1

Re: [PATCH bpf-next] selftests/bpf: fix "alu with different scalars 1" on s390

2019-07-03 Thread Y Song
On Wed, Jul 3, 2019 at 9:06 AM Ilya Leoshkevich wrote: > > BPF_LDX_MEM is used to load the least significant byte of the retrieved > test_val.index, however, on big-endian machines it ends up retrieving > the most significant byte. > > Use the correct least significant byte offset on big-endian ma

Re: [PATCH bpf-next] selftests/bpf: add test_tcp_rtt to .gitignore

2019-07-03 Thread Y Song
On Wed, Jul 3, 2019 at 1:10 PM Stanislav Fomichev wrote: > > Forgot to add it in the original patch. > > Fixes: b55873984dab ("selftests/bpf: test BPF_SOCK_OPS_RTT_CB") > Reported-by: Andrii Nakryiko > Signed-off-by: Stanislav Fomichev Acked-by: Yonghong Song > --- > tools/testing/selftests/

Re: [PATCH v2 bpf-next 1/4] libbpf: capture value in BTF type info for BTF-defined map defs

2019-07-02 Thread Y Song
On Fri, Jun 28, 2019 at 8:26 AM Andrii Nakryiko wrote: > > Change BTF-defined map definitions to capture compile-time integer > values as part of BTF type definition, to avoid split of key/value type > information and actual type/size/flags initialization for maps. > > Signed-off-by: Andrii Nakryi

Re: [PATCH bpf v2] selftests: bpf: fix inlines in test_lwt_seg6local

2019-07-02 Thread Y Song
On Tue, Jul 2, 2019 at 10:41 AM Jiri Benc wrote: > > Selftests are reporting this failure in test_lwt_seg6local.sh: > > + ip netns exec ns2 ip -6 route add fb00::6 encap bpf in obj > test_lwt_seg6local.o sec encap_srh dev veth2 > Error fetching program/map! > Failed to parse eBPF program: Operati

Re: [PATCH bpf-next v2 0/8] bpf: TCP RTT sock_ops bpf callback

2019-07-02 Thread Y Song
On Tue, Jul 2, 2019 at 9:14 AM Stanislav Fomichev wrote: > > Congestion control team would like to have a periodic callback to > track some TCP statistics. Let's add a sock_ops callback that can be > selectively enabled on a socket by socket basis and is executed for > every RTT. BPF program frequ

Re: [PATCH bpf-next] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-02 Thread Y Song
On Tue, Jul 2, 2019 at 8:40 AM Ilya Leoshkevich wrote: > > Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. > > Pass -D__TARGET_ARCH_$(ARCH) to selftests in order to choose a proper > PT_REGS_RC variant. > > Fix s930 -> s390 typo. > > On s390, provide the forward declaration

Re: [PATCH bpf-next] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-02 Thread Y Song
On Tue, Jul 2, 2019 at 9:58 AM Ilya Leoshkevich wrote: > > > Am 02.07.2019 um 18:42 schrieb Y Song : > > > > On Tue, Jul 2, 2019 at 8:40 AM Ilya Leoshkevich wrote: > >> > >> -#elif defined(__s390x__) > >> - #define bpf_target_s930x >

Re: [PATCH bpf-next] selftests/bpf: fix compiling loop{1,2,3}.c on s390

2019-07-02 Thread Y Song
On Tue, Jul 2, 2019 at 8:40 AM Ilya Leoshkevich wrote: > > Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390. > > Pass -D__TARGET_ARCH_$(ARCH) to selftests in order to choose a proper > PT_REGS_RC variant. > > Fix s930 -> s390 typo. > > On s390, provide the forward declaration

Re: [PATCH v2 bpf-next] libbpf: fix GCC8 warning for strncpy

2019-07-02 Thread Y Song
On Tue, Jul 2, 2019 at 8:17 AM Andrii Nakryiko wrote: > > GCC8 started emitting warning about using strncpy with number of bytes > exactly equal destination size, which is generally unsafe, as can lead > to non-zero terminated string being copied. Use IFNAMSIZ - 1 as number > of bytes to ensure na

Re: [PATCH bpf-next] libbpf: fix GCC8 warning for strncpy

2019-07-01 Thread Y Song
On Mon, Jul 1, 2019 at 10:47 PM Andrii Nakryiko wrote: > > GCC8 started emitting warning about using strncpy with number of bytes > exactly equal destination size, which is generally unsafe, as can lead > to non-zero terminated string being copied. Use IFNAMSIZ - 1 as number > of bytes to ensure n

Re: [PATCH bpf-next 7/8] samples/bpf: add sample program that periodically dumps TCP stats

2019-07-01 Thread Y Song
On Mon, Jul 1, 2019 at 5:31 PM Stanislav Fomichev wrote: > > On 07/01, Y Song wrote: > > On Mon, Jul 1, 2019 at 1:49 PM Stanislav Fomichev wrote: > > > > > > Uses new RTT callback to dump stats every second. > > > > > > $ mkdir -p /tmp/cgro

Re: [PATCH bpf-next 6/8] selftests/bpf: test BPF_SOCK_OPS_RTT_CB

2019-07-01 Thread Y Song
On Mon, Jul 1, 2019 at 5:07 PM Stanislav Fomichev wrote: > > On 07/01, Y Song wrote: > > On Mon, Jul 1, 2019 at 1:49 PM Stanislav Fomichev wrote: > > > > > > Make sure the callback is invoked for syn-ack and data packet. > > > > > > Cc: Eric Dumaz

Re: [PATCH bpf-next 7/8] samples/bpf: add sample program that periodically dumps TCP stats

2019-07-01 Thread Y Song
On Mon, Jul 1, 2019 at 1:49 PM Stanislav Fomichev wrote: > > Uses new RTT callback to dump stats every second. > > $ mkdir -p /tmp/cgroupv2 > $ mount -t cgroup2 none /tmp/cgroupv2 > $ mkdir -p /tmp/cgroupv2/foo > $ echo $$ >> /tmp/cgroupv2/foo/cgroup.procs > $ bpftool prog load ./tcp_dumpstats_ker

Re: [PATCH bpf-next 6/8] selftests/bpf: test BPF_SOCK_OPS_RTT_CB

2019-07-01 Thread Y Song
On Mon, Jul 1, 2019 at 1:49 PM Stanislav Fomichev wrote: > > Make sure the callback is invoked for syn-ack and data packet. > > Cc: Eric Dumazet > Cc: Priyaranjan Jha > Cc: Yuchung Cheng > Cc: Soheil Hassas Yeganeh > Signed-off-by: Stanislav Fomichev > --- > tools/testing/selftests/bpf/Makef

Re: [PATCH bpf] selftests: bpf: fix inlines in test_lwt_seg6local

2019-07-01 Thread Y Song
On Sat, Jun 29, 2019 at 11:05 AM Song Liu wrote: > > On Sat, Jun 29, 2019 at 11:04 AM Song Liu wrote: > > > > On Sat, Jun 29, 2019 at 7:43 AM Jiri Benc wrote: > > > > > > Selftests are reporting this failure in test_lwt_seg6local.sh: > > > > > > + ip netns exec ns2 ip -6 route add fb00::6 encap

Re: [PATCH] [PATCH bpf] style fix in while(!feof()) loop

2019-05-27 Thread Y Song
On Sun, May 26, 2019 at 3:35 AM Chang-Hsien Tsai wrote: > > use fgets() as the while loop condition. > > Signed-off-by: Chang-Hsien Tsai Looks like right now we did not really differentiate error in fgets from EOF, so the change is in this patch is equivalent to its previous behavior. Acked-by:

Re: [PATCH bpf-next] selftests/bpf: fail test_tunnel.sh if subtests fail

2019-05-25 Thread Y Song
On Fri, May 24, 2019 at 3:29 PM Stanislav Fomichev wrote: > > Right now test_tunnel.sh always exits with success even if some > of the subtests fail. Since the output is very verbose, it's > hard to spot the issues with subtests. Let's fail the script > if any subtest fails. > > Signed-off-by: Sta

Re: [PATCH v2] samples: bpf: fix style in bpf_load

2019-05-23 Thread Y Song
On Thu, May 23, 2019 at 12:26 AM Daniel T. Lee wrote: > > This commit fixes style problem in samples/bpf/bpf_load.c > > Styles that have been changed are: > - Magic string use of 'DEBUGFS' > - Useless zero initialization of a global variable > - Minor style fix with whitespace > > Signed-off-by

Re: [PATCH bpf] selftests: bpf: add zero extend checks for ALU32 and/or/xor

2019-05-22 Thread Y Song
On Wed, May 22, 2019 at 1:46 PM Björn Töpel wrote: > > On Wed, 22 May 2019 at 20:13, Y Song wrote: > > > > On Wed, May 22, 2019 at 2:25 AM Björn Töpel wrote: > > > > > > Add three tests to test_verifier/basic_instr that make sure that the > > >

Re: [PATCH bpf] selftests: bpf: add zero extend checks for ALU32 and/or/xor

2019-05-22 Thread Y Song
On Wed, May 22, 2019 at 2:25 AM Björn Töpel wrote: > > Add three tests to test_verifier/basic_instr that make sure that the > high 32-bits of the destination register is cleared after an ALU32 > and/or/xor. > > Signed-off-by: Björn Töpel I think the patch intends for bpf-next, right? The patch i

Re: [PATCH bpf] libbpf: add libbpf_util.h to header install.

2019-05-03 Thread Y Song
On Fri, May 3, 2019 at 12:54 PM William Tu wrote: > > On Thu, May 2, 2019 at 1:18 PM Y Song wrote: > > > > On Thu, May 2, 2019 at 11:34 AM William Tu wrote: > > > > > > The libbpf_util.h is used by xsk.h, so add it to > > > the install headers. >

Re: [PATCH bpf] libbpf: add libbpf_util.h to header install.

2019-05-02 Thread Y Song
On Thu, May 2, 2019 at 11:34 AM William Tu wrote: > > The libbpf_util.h is used by xsk.h, so add it to > the install headers. Can we try to change code a little bit to avoid exposing libbpf_util.h? Originally libbpf_util.h is considered as libbpf internal. I am not strongly against this patch. Bu

Re: [PATCH bpf-next 1/6] tools: bpftool: add --log-libbpf option to get debug info from libbpf

2019-04-30 Thread Y Song
On Tue, Apr 30, 2019 at 2:34 AM Quentin Monnet wrote: > > Hi Yonghong, > > 2019-04-29 16:32 UTC-0700 ~ Y Song > > On Mon, Apr 29, 2019 at 2:53 AM Quentin Monnet > > wrote: > >> > >> libbpf has three levels of priority for output: warn, info, debug. By

Re: [PATCH bpf-next 1/6] tools: bpftool: add --log-libbpf option to get debug info from libbpf

2019-04-29 Thread Y Song
On Mon, Apr 29, 2019 at 2:53 AM Quentin Monnet wrote: > > libbpf has three levels of priority for output: warn, info, debug. By > default, debug output is not printed to stderr. > > Add a new "--log-libbpf LOG_LEVEL" option to bpftool to provide more > flexibility on the log level for libbpf. LOG_

Re: [PATCH] libbpf: fix samples/bpf build failure due to undefined UINT32_MAX

2019-04-23 Thread Y Song
On Tue, Apr 23, 2019 at 6:02 PM Daniel T. Lee wrote: > > Oh, I've found what's the problem. > About the files you've mentioned, nothing seems to matter on my system. > But the problem is the order of the '-I' option matters. > > user@host:~/linux/samples/bpf $ make -n > > gcc -Wp,-MD,./sam

Re: [PATCH] libbpf: fix samples/bpf build failure due to undefined UINT32_MAX

2019-04-23 Thread Y Song
On Tue, Apr 23, 2019 at 1:26 PM Daniel T. Lee wrote: > > Currently, building bpf samples will cause the following error. > > ./tools/lib/bpf/bpf.h:132:27: error: 'UINT32_MAX' undeclared here (not in > a function) .. > #define BPF_LOG_BUF_SIZE (UINT32_MAX >> 8) /* verifier maximum in > k

Re: [PATCH bpf-next 2/2] selftests/bpf: expand test_tc_tunnel with SIT encap

2019-04-22 Thread Y Song
On Mon, Apr 22, 2019 at 4:47 PM Willem de Bruijn wrote: > > On Mon, Apr 22, 2019 at 7:40 PM Y Song wrote: > > > > On Mon, Apr 22, 2019 at 7:58 AM Willem de Bruijn > > wrote: > > > > > > From: Willem de Bruijn > > > > > > So far,

Re: [PATCH bpf-next 2/2] selftests/bpf: expand test_tc_tunnel with SIT encap

2019-04-22 Thread Y Song
On Mon, Apr 22, 2019 at 7:58 AM Willem de Bruijn wrote: > > From: Willem de Bruijn > > So far, all BPF tc tunnel testcases encapsulate in the same network > protocol. Add an encap testcase that requires updating skb->protocol. > > The 6in4 tunnel encapsulates an IPv6 packet inside an IPv4 tunnel.

Re: [PATCH bpf-next 1/2] bpf: update skb->protocol in bpf_skb_net_grow

2019-04-22 Thread Y Song
On Mon, Apr 22, 2019 at 7:58 AM Willem de Bruijn wrote: > > From: Willem de Bruijn > > Some tunnels, like sit, change the network protocol of packet. > If so, update skb->protocol to match the new type. > > Signed-off-by: Willem de Bruijn Acked-by: Yonghong Song > --- > net/core/filter.c | 8

Re: [PATCH 1/1] [bpf-next] libbpf: fix off-by-one error for BPF_LOG_BUF_SIZE

2019-04-19 Thread Y Song
On Fri, Apr 19, 2019 at 12:32 PM rjmccabe3701 wrote: > > From: "McCabe, Robert J" > > The BPF_PROG_LOAD condition for kernel version <= 5.1 is > >log->len_total > UINT_MAX >> 8 /* (16 * 1024 * 1024) - 1 */ > > Signed-off-by: McCabe, Robert J Acked-by: Yonghong Song > --- > tools/lib/bpf/

Re: [PATCH bpf-next] libbpf: remove compile time warning from libbpf_util.h

2019-04-18 Thread Y Song
On Thu, Apr 18, 2019 at 12:23 AM Magnus Karlsson wrote: > > Having a helpful compile time warning in libbpf_util.h is not a good > idea since all warnings are treated as errors. Change this into a > comment in the code instead. > > Fixes: b7e3a28019c9 ("libbpf: remove dependency on barrier.h in xs

Re: [PATCH bpf v2 2/2] libbpf: remove dependency on barrier.h in xsk.h

2019-04-10 Thread Y Song
On Wed, Apr 10, 2019 at 12:21 AM Magnus Karlsson wrote: > > The use of smp_rmb() and smp_wmb() creates a Linux header dependency > on barrier.h that is uneccessary in most parts. This patch implements > the two small defines that are needed from barrier.h. As a bonus, the > new implementations are

Re: [PATCH bpf v2 1/2] libbpf: remove likely/unlikely in xsk.h

2019-04-10 Thread Y Song
On Wed, Apr 10, 2019 at 12:21 AM Magnus Karlsson wrote: > > This patch removes the use of likely and unlikely in xsk.h since they > create a dependency on Linux headers as reported by several > users. There have also been reports that the use of these decreases > performance as the compiler puts t

Re: [PATCH bpf-next v2] libbpf: fix crash in XDP socket part with new larger BPF_LOG_BUF_SIZE

2019-04-10 Thread Y Song
On Tue, Apr 9, 2019 at 11:55 PM Magnus Karlsson wrote: > > In commit da11b417583e ("libbpf: teach libbpf about log_level bit 2"), > the BPF_LOG_BUF_SIZE was increased to 16M. The XDP socket part of > libbpf allocated the log_buf on the stack, but for the new 16M buffer > size this is not going to

Re: selftests: bpf: test_align Failed to find match 1: R1=ctx(id=0,off=0,imm=0) func#0 @0

2019-03-18 Thread Y Song
On Mon, Mar 18, 2019 at 6:03 AM Naresh Kamboju wrote: > > selftests: bpf: test_align failed on all devices ( arm64, armv7, > x86_64 and i386) running Linux -next kernel 5.1.0-rc1 tag: > next-20190318. > > Here is the log from arm64, > > selftests: bpf: test_align > Test 0: mov ... Failed to find

Re: [PATCH] bpf: Try harder when allocating memory for large maps

2019-03-11 Thread Y Song
On Mon, Mar 11, 2019 at 12:32 PM Martynas Pumputis wrote: > > It has been observed that sometimes a higher order memory allocation > for BPF maps fails when there is no obvious memory pressure in a system. > > E.g. the map (BPF_MAP_TYPE_LRU_HASH, key=38, value=56, max_elems=524288) > could not be

Re: [PATCH V2] bpf: fix warning about using plain integer as NULL

2019-03-07 Thread Y Song
On Thu, Mar 7, 2019 at 10:12 PM Bo YU wrote: > > Sparse warning below: > > sudo make C=2 CF=-D__CHECK_ENDIAN__ M=net/bpf/ > CHECK net/bpf//test_run.c > net/bpf//test_run.c:19:77: warning: Using plain integer as NULL pointer > ./include/linux/bpf-cgroup.h:295:77: warning: Using plain integer as N

Re: [PATCH bpf] bpf: only test gso type on gso packets

2019-03-06 Thread Y Song
On Wed, Mar 6, 2019 at 1:15 PM Willem de Bruijn wrote: > > From: Willem de Bruijn > > BPF can adjust gso only for tcp bytestreams. Fail on other gso types. > > But only on gso packets. It does not touch this field if !gso_size. Could you specify which field you are referring here? gso_type, gso_s

Re: [PATCH bpf 2/2] libbpf: force fixdep compilation at the start of the build

2019-03-06 Thread Y Song
On Wed, Mar 6, 2019 at 1:14 PM Stanislav Fomichev wrote: > > libbpf targets don't explicitly depend on fixdep target, so when > we do 'make -j$(nproc)', there is a high probability, that some > objects will be built before fixdep binary is available. > > Fix this by running sub-make; this makes su

Re: [PATCH bpf 1/2] selftests: bpf: fix compilation with out-of-tree $(OUTPUT)

2019-03-06 Thread Y Song
On Wed, Mar 6, 2019 at 1:14 PM Stanislav Fomichev wrote: > > A bunch of related changes lumped together: > * Create prog_tests and verifier output directories; these don't exist with > out-of-tree $(OUTPUT) > * Add missing -I (via separate TEST_{PROGS,VERIFIER}_CFLAGS) for the main tree > ($(P

Re: [PATCH bpf] selftests: bpf: test_progs: initialize duration in singal_pending test

2019-03-06 Thread Y Song
On Wed, Mar 6, 2019 at 3:25 PM Stanislav Fomichev wrote: > > CHECK macro implicitly uses duration. We call CHECK() a couple of times > before duration is initialized from bpf_prog_test_run(). > Explicitly set duration to 0 to avoid compiler warnings. > > Fixes: 740f8a657221 ("selftests/bpf: make s

Re: [PATCH bpf-next 2/4] libbpf: Support 32-bit static data loads

2019-02-27 Thread Y Song
FYI.The latest llvm trunk will not emit errors for static variables. The patch also gives detailed information how to relate a particular static variable to a particular relocation. https://reviews.llvm.org/rL354954 Thanks, Yonghong On Fri, Feb 15, 2019 at 12:18 PM Y Song wrote: > >

Re: [PATCH bpf-next 2/4] libbpf: Support 32-bit static data loads

2019-02-15 Thread Y Song
On Thu, Feb 14, 2019 at 11:16 PM Joe Stringer wrote: > > On Thu, 14 Feb 2019 at 21:39, Y Song wrote: > > > > On Mon, Feb 11, 2019 at 4:48 PM Joe Stringer wrote: > > > > > > Support loads of static 32-bit data when BPF writers make use of > > > conven

Re: [PATCH bpf-next 2/4] libbpf: Support 32-bit static data loads

2019-02-14 Thread Y Song
On Mon, Feb 11, 2019 at 4:48 PM Joe Stringer wrote: > > Support loads of static 32-bit data when BPF writers make use of > convenience macros for accessing static global data variables. A later > patch in this series will demonstrate its usage in a selftest. > > As of LLVM-7, this technique only w

Re: [PATCH bpf-next] tools: bpftool: doc, fix incorrect text

2019-02-05 Thread Y Song
On Tue, Feb 5, 2019 at 6:26 PM Prashant Bhole wrote: > > Documentation about cgroup, feature, prog uses wrong header > 'MAP COMMANDS' while listing commands. This patch corrects the header > in respective doc files. > > Signed-off-by: Prashant Bhole Acked-by: Yonghong Song > --- > tools/bpf/b

Re: [PATCH bpf-next] tools: bpftool: doc, add text about feature-subcommand

2019-02-05 Thread Y Song
On Tue, Feb 5, 2019 at 6:25 PM Prashant Bhole wrote: > > This patch adds missing information about feature-subcommand in > bpftool.rst > > Signed-off-by: Prashant Bhole Acked-by: Yonghong Song > --- > tools/bpf/bpftool/Documentation/bpftool.rst | 4 +++- > 1 file changed, 3 insertions(+), 1 d

Re: bpf: BPF_PROG_TEST_RUN leads to unkillable process

2019-02-04 Thread Y Song
On Mon, Feb 4, 2019 at 9:49 AM Stanislav Fomichev wrote: > > On 02/01, Dmitry Vyukov wrote: > > Hello, > > > > The following program leads to an unkillable process that eats CPU in > > an infinite loop in BPF_PROG_TEST_RUN syscall. But kernel does not > > self-detect cpu/rcu/task stalls either. Th

Re: [PATCH bpf-next] bpf: support SO_DEBUG in bpf_setsockopt()

2019-02-03 Thread Y Song
On Sun, Feb 3, 2019 at 12:18 AM Yafang Shao wrote: > > Then we can enable/disable socket debugging without modifying user code. > That is more convenient for debugging. > > Signed-off-by: Yafang Shao Acked-by: Yonghong Song > --- > include/net/sock.h | 8 > net/core/filter.c | 3 +++

Re: [PATCH bpf-next] selftests/bpf: remove generated verifier/tests.h on 'make clean'

2019-02-01 Thread Y Song
On Fri, Feb 1, 2019 at 3:49 PM Stanislav Fomichev wrote: > > 'make clean' is supposed to remove generated files. > > Signed-off-by: Stanislav Fomichev Acked-by: Yonghong Song > --- > tools/testing/selftests/bpf/Makefile | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) >

Re: [PATCH bpf-next v3 1/3] libbpf: move pr_*() functions to common header file

2019-01-31 Thread Y Song
On Tue, Jan 29, 2019 at 7:13 AM Magnus Karlsson wrote: > > Move the pr_*() functions in libbpf.c to a common header file called > libbpf_internal.h. This so that the later libbpf AF_XDP helper library > code in xsk.c can use these printing functions too. > > Signed-off-by: Magnus Karlsson > --- >

Re: [PATCH v2 bpf] bpf: selftests: handle sparse CPU allocations

2019-01-31 Thread Y Song
On Thu, Jan 31, 2019 at 1:18 AM Martynas Pumputis wrote: > > Previously, bpf_num_possible_cpus() had a bug when calculating a > number of possible CPUs in the case of sparse CPU allocations, as > it was considering only the first range or element of > /sys/devices/system/cpu/possible. > > E.g. in

Re: [PATCH bpf-next] bpf: add optional memory accounting for maps

2019-01-30 Thread Y Song
On Wed, Jan 30, 2019 at 6:05 AM Martynas Pumputis wrote: > > Previously, memory allocated for a map was not accounted. Therefore, > this memory could not be taken into consideration by the cgroups > memory controller. > > This patch introduces the "BPF_F_ACCOUNT_MEM" flag which enables > the memor

Re: [PATCH] bpf: selftests: handle sparse CPU allocations

2019-01-30 Thread Y Song
[ My reply somehow rejected by netdev, this is to send it again. ] On Wed, Jan 30, 2019 at 1:19 AM Martynas Pumputis wrote: > > Previously, bpf_num_possible_cpus() had a bug when calculating a > number of possible CPUs in the case of sparse CPU allocations, as > it was considering only the first

Re: [RFC bpf-next v3 3/9] tools: bpftool: add probes for kernel configuration options

2019-01-04 Thread Y Song
On Fri, Jan 4, 2019 at 6:27 AM Quentin Monnet wrote: > > 2019-01-03 22:35 UTC-0800 ~ Y Song > > On Thu, Jan 3, 2019 at 9:27 AM Quentin Monnet > > wrote: > >> > >> Add probes to dump a number of options set (or not set) for compiling > >> the kerne

Re: [PATCH bpf] selftests/bpf: fix incorrect users of create_and_get_cgroup

2019-01-03 Thread Y Song
On Thu, Jan 3, 2019 at 12:02 PM Stanislav Fomichev wrote: > > create_and_get_cgroup returns 0 on error, fix the users that assume > negative value in case of an error. > > Signed-off-by: Stanislav Fomichev Thanks for the fix! Acked-by: Yonghong Song > --- > tools/testing/selftests/bpf/get_cgr

Re: [RFC bpf-next v3 3/9] tools: bpftool: add probes for kernel configuration options

2019-01-03 Thread Y Song
On Thu, Jan 3, 2019 at 9:27 AM Quentin Monnet wrote: > > Add probes to dump a number of options set (or not set) for compiling > the kernel image. These parameters provide information about what BPF > components should be available on the system. A number of them are not > directly related to eBPF

Re: [RFC bpf-next v3 2/9] tools: bpftool: add probes for /proc/ eBPF parameters

2019-01-03 Thread Y Song
On Thu, Jan 3, 2019 at 9:26 AM Quentin Monnet wrote: > > Add a set of probes to dump the eBPF-related parameters available from > /proc/: availability of bpf() syscall for unprivileged users, > JIT compiler status and hardening status, kallsyms exports status. > > Sample output: > > # bpftool

Re: selftests/bpf :get_cgroup_id_user: File not found: /sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id

2018-11-21 Thread Y Song
On Wed, Nov 21, 2018 at 3:44 AM Naresh Kamboju wrote: > > Kselftest bpf get_cgroup_id_user is failed on all devices. > > selftests: bpf: get_cgroup_id_user > main:PASS:setup_cgroup_environment > main:PASS:create_and_get_cgroup > main:PASS:join_cgroup > main:PASS:bpf_prog_load > main:PASS:bpf_find_

Re: [PATCH bpf-next v2] libbpf: make sure bpf headers are c++ include-able

2018-11-20 Thread Y Song
On Tue, Nov 20, 2018 at 1:37 PM Stanislav Fomichev wrote: > > Wrap headers in extern "C", to turn off C++ mangling. > This simplifies including libbpf in c++ and linking against it. > > v2 changes: > * do the same for btf.h > > Signed-off-by: Stanislav Fomichev Acked-by: Yonghong Song > --- >

Re: [PATCH bpf-next] libbpf: make sure bpf headers are c++ include-able

2018-11-20 Thread Y Song
On Tue, Nov 20, 2018 at 10:19 AM Stanislav Fomichev wrote: > > Wrap headers in extern "C", to turn off C++ mangling. > This simplifies including libbpf in c++ and linking against it. > > Signed-off-by: Stanislav Fomichev > --- > tools/lib/bpf/bpf.h| 9 + > tools/lib/bpf/libbpf.h | 9

Re: [PATCH v2 0/4] Fix unsafe BPF_PROG_TEST_RUN interface

2018-11-20 Thread Y Song
On Tue, Nov 20, 2018 at 7:43 AM Lorenz Bauer wrote: > > Right now, there is no safe way to use BPF_PROG_TEST_RUN with data_out. > This is because bpf_test_finish copies the output buffer to user space > without checking its size. This can lead to the kernel overwriting > data in user space after t

Re: [PATCH 3/3] selftests: add a test for bpf_prog_test_run output size

2018-11-20 Thread Y Song
On Tue, Nov 20, 2018 at 3:35 AM Lorenz Bauer wrote: > > On Sun, 18 Nov 2018 at 05:59, Y Song wrote: > > > > On Fri, Nov 16, 2018 at 12:55 PM Lorenz Bauer wrote: > > > > > > Make sure that bpf_prog_test_run returns the correct length > > > in the s

  1   2   >