Re: [PATCH bpf-next] libbpf: Expose libbpf ringbufer epoll_fd

2020-12-11 Thread Andrii Nakryiko
On Fri, Dec 11, 2020 at 10:58 AM Brendan Jackman wrote: > > This allows the user to do their own manual polling in more > complicated setups. > > Signed-off-by: Brendan Jackman > --- perf_buffer has it, so it's good for consistency. In practice, though, I'd expect anyone who needs more complicat

Re: [PATCH bpf-next v3 12/14] bpf: Pull tools/build/feature biz into selftests Makefile

2020-12-07 Thread Andrii Nakryiko
On Mon, Dec 7, 2020 at 3:00 AM Brendan Jackman wrote: > > On Fri, Dec 04, 2020 at 11:00:24AM -0800, Andrii Nakryiko wrote: > > On Fri, Dec 4, 2020 at 1:41 AM Brendan Jackman wrote: > > > > > > On Thu, Dec 03, 2020 at 01:01:27PM -0800, Andrii Nakryiko wrote: > >

Re: [PATCH bpf-next v9 00/34] bpf: switch to memcg-based memory accounting

2020-12-07 Thread Andrii Nakryiko
On Fri, Dec 4, 2020 at 4:37 PM Daniel Borkmann wrote: > > On 12/3/20 4:26 AM, Roman Gushchin wrote: > > On Wed, Dec 02, 2020 at 06:54:46PM -0800, Alexei Starovoitov wrote: > >> On Tue, Dec 1, 2020 at 1:59 PM Roman Gushchin wrote: > >>> > >>> 5) Cryptic -EPERM is returned on exceeding the limit. L

Re: [PATCH v2 bpf-next 0/3] bpf: support module BTF in BTF display helpers

2020-12-07 Thread Andrii Nakryiko
On Sat, Dec 5, 2020 at 4:44 PM Alan Maguire wrote: > > > On Sat, 5 Dec 2020, Yonghong Song wrote: > > > > > > > __builtin_btf_type_id() is really only supported in llvm12 > > and 64bit return value support is pushed to llvm12 trunk > > a while back. The builtin is introduced in llvm11 but has a >

Re: [PATCH bpf-next v3 12/14] bpf: Pull tools/build/feature biz into selftests Makefile

2020-12-08 Thread Andrii Nakryiko
On Tue, Dec 8, 2020 at 9:04 AM Brendan Jackman wrote: > > On Mon, Dec 07, 2020 at 06:19:12PM -0800, Andrii Nakryiko wrote: > > On Mon, Dec 7, 2020 at 3:00 AM Brendan Jackman wrote: > > > > > > On Fri, Dec 04, 2020 at 11:00:24AM -0800, Andrii Nakryiko wrote: > >

Re: [PATCH bpf-next] bpf: Fix a verifier message for alloc size helper arg

2021-01-12 Thread Andrii Nakryiko
On Tue, Jan 12, 2021 at 4:39 AM Brendan Jackman wrote: > > The error message here is misleading, the argument will be rejected > unless it is a known constant. > > Signed-off-by: Brendan Jackman > --- LGTM. Acked-by: Andrii Nakryiko > kernel/bpf/verifier.c | 2 +-

Re: [PATCH bpf 1/2] bpf: support PTR_TO_MEM{,_OR_NULL} register spilling

2021-01-12 Thread Andrii Nakryiko
On Tue, Jan 12, 2021 at 1:14 AM Gilad Reti wrote: > > Add support for pointer to mem register spilling, to allow the verifier > to track pointer to valid memory addresses. Such pointers are returned > for example by a successful call of the bpf_ringbuf_reserve helper. > > This patch was suggested

Re: [PATCH bpf-next 2/2] selftests: bpf: Add a new test for bare tracepoints

2021-01-12 Thread Andrii Nakryiko
On Tue, Jan 12, 2021 at 11:27 AM Qais Yousef wrote: > > On 01/11/21 23:26, Andrii Nakryiko wrote: > > On Mon, Jan 11, 2021 at 10:20 AM Qais Yousef wrote: > > > > > > Reuse module_attach infrastructure to add a new bare tracepoint to check > > >

Re: [PATCH] bpf: Hoise pahole version checks into Kconfig

2021-01-13 Thread Andrii Nakryiko
On Mon, Jan 11, 2021 at 1:24 PM Andrii Nakryiko wrote: > > On Mon, Jan 11, 2021 at 12:00 PM Nathan Chancellor > wrote: > > > > On Tue, Jan 12, 2021 at 04:50:50AM +0900, Masahiro Yamada wrote: > > > On Tue, Jan 12, 2021 at 4:34 AM Nathan Chancellor > > >

Re: Linux 5.11-rc2

2021-01-08 Thread Andrii Nakryiko
On Fri, Jan 8, 2021 at 3:12 AM Christopher William Snowhill wrote: > > There appears to be a regression with the filesystem NLS modules. I cannot > load any of them. They all produce: > > modprobe: ERROR: could not insert 'nls_cp437': Invalid argument > > The system journal reports: > > Jan 08 02

Re: [PATCH] tools/bpf: Remove unnecessary parameter in bpf_object__probe_loading

2021-01-08 Thread Andrii Nakryiko
On Thu, Jan 7, 2021 at 6:08 PM 彭浩(Richard) wrote: > > struct bpf_object *obj is not used in bpf_object__probe_loading, so we > can remove it. > > Signed-off-by: Peng Hao > --- It causes no harm, no performance cost, and no maintenance issues. I consider eventually allowing to have a per-bpf_obje

Re: [RFC PATCH bpf-next 1/2] bpf: share BTF "show" implementation between kernel and libbpf

2021-01-14 Thread Andrii Nakryiko
On Thu, Jan 14, 2021 at 7:37 AM Alan Maguire wrote: > > On Mon, 11 Jan 2021, Andrii Nakryiko wrote: > > > On Mon, Jan 11, 2021 at 9:34 AM Alan Maguire > > wrote: > > > Currently the only "show" function for userspace is to write the > > >

Re: [PATCH 5.4 106/453] libbpf: Fix BTF data layout checks and allow empty BTF

2020-12-28 Thread Andrii Nakryiko
On Mon, Dec 28, 2020 at 7:49 AM Naresh Kamboju wrote: > > Perf build failed on stable-rc 5.4 branch due to this patch. > > On Mon, 28 Dec 2020 at 19:15, Greg Kroah-Hartman > wrote: > > > > From: Andrii Nakryiko > > > > [ Upstream commit d8123624506cd627

Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-30 Thread Andrii Nakryiko
On Mon, Mar 29, 2021 at 8:28 PM Alexei Starovoitov wrote: > > On Sun, Mar 28, 2021 at 07:38:42PM -0700, Andrii Nakryiko wrote: > > > > See above. I don't know which hassle is libbpf for users today. You > > were implying code size used for functionality users mi

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-30 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 1:11 AM Kumar Kartikeya Dwivedi wrote: > > On Sun, Mar 28, 2021 at 10:12:40AM IST, Andrii Nakryiko wrote: > > Is there some succinct but complete enough documentation/tutorial/etc > > that I can reasonably read to understand kernel APIs provided by TC &

Re: [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-03-30 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 9:11 AM Pedro Tammela wrote: > > The current way to provide a no-op flag to 'bpf_ringbuf_submit()', > 'bpf_ringbuf_discard()' and 'bpf_ringbuf_output()' is to provide a '0' > value. > > A '0' value might notify the consumer if it already caught up in processing, > so let's

Re: [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-30 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 9:12 AM Pedro Tammela wrote: > > The current code only checks flags in 'bpf_ringbuf_output()'. > > Signed-off-by: Pedro Tammela > --- > include/uapi/linux/bpf.h | 8 > kernel/bpf/ringbuf.c | 13 +++-- > tools/include/uapi/linux/bpf.h | 8

Re: [PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-03-31 Thread Andrii Nakryiko
On Tue, Mar 30, 2021 at 4:16 PM Alexei Starovoitov wrote: > > On Tue, Mar 30, 2021 at 3:54 PM Pedro Tammela wrote: > > > > BPF_CALL_2(bpf_ringbuf_submit, void *, sample, u64, flags) > > { > > + if (unlikely(flags & ~(BPF_RB_NO_WAKEUP | BPF_RB_FORCE_WAKEUP))) > > + return -EI

Re: [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()'

2021-03-31 Thread Andrii Nakryiko
On Mon, Mar 29, 2021 at 9:28 AM Song Liu wrote: > > > > > On Mar 28, 2021, at 9:10 AM, Pedro Tammela wrote: > > > > 'bpf_ring_buffer__poll()' abstracts the polling method, so abstract the > > constants that make the implementation don't wait or wait indefinetly > > for data. > > > > Signed-off-by

Re: [PATCH] selftests/bpf: add LDFLAGS when building test_verifier

2021-03-31 Thread Andrii Nakryiko
On Mon, Mar 29, 2021 at 11:11 AM Jisheng Zhang wrote: > > From: Jisheng Zhang > > This is useful for cross compile process to point linker to the > correct libelf, libcap, libz path. Is this enough to make cross-compilation of selftests/bpf work? I think there was a discussion another day about

Re: [PATCH v2 0/8] Implement EBPF on powerpc32

2021-03-22 Thread Andrii Nakryiko
On Mon, Mar 22, 2021 at 9:37 AM Christophe Leroy wrote: > > This series implements extended BPF on powerpc32. For the implementation > details, see the patch before the last. > > The following operations are not implemented: > > case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */ >

Re: [PATCH bpf-next 1/5] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > This type provides the guarantee that an argument is going to be a const > pointer to somewhere in a read-only map value. It also checks that this > pointer is followed by a NULL character before the end of the map value. > > Signed-off-by:

Re: [PATCH bpf-next 2/5] bpf: Add a bpf_snprintf helper

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > The implementation takes inspiration from the existing bpf_trace_printk > helper but there are a few differences: > > To allow for a large number of format-specifiers, parameters are > provided in an array, like in bpf_seq_printf. > > Becau

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > When initializing the __param array with a one liner, if all args are > const, the initial array value will be placed in the rodata section but > because libbpf does not support relocation in the rodata section, any > pointer in this array

Re: [PATCH bpf-next 4/5] libbpf: Introduce a BPF_SNPRINTF helper macro

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > Similarly to BPF_SEQ_PRINTF, this macro turns variadic arguments into an > array of u64, making it more natural to call the bpf_snprintf helper. > > Signed-off-by: Florent Revest > --- > tools/lib/bpf/bpf_tracing.h | 15 +++ >

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-15 Thread Andrii Nakryiko
On Mon, Mar 15, 2021 at 9:36 PM Andrii Nakryiko wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > > When initializing the __param array with a one liner, if all args are > > const, the initial array value will be placed in the rodata section but >

Re: [PATCH bpf-next 5/5] selftests/bpf: Add a series of tests for bpf_snprintf

2021-03-15 Thread Andrii Nakryiko
On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > This exercices most of the format specifiers when things go well. typo: exercises > > Signed-off-by: Florent Revest > --- > .../selftests/bpf/prog_tests/snprintf.c | 71 +++ > .../selftests/bpf/progs/test_snprintf.

Re: [PATCH] samples: bpf: Fix a spelling typo in do_hbm_test.sh

2021-03-15 Thread Andrii Nakryiko
On Mon, Mar 15, 2021 at 5:45 AM Masanari Iida wrote: > > This patch fixes a spelling typo in do_hbm_test.sh > > Signed-off-by: Masanari Iida > --- Thanks, applied to bpf-next. For the future patches, please use [PATCH bpf-next] subject prefix if you are sending patches against bpf-next tree (of

Re: [PATCH] libbpf: avoid inline hint definition from 'linux/stddef.h'

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 2:01 PM Daniel Borkmann wrote: > > On 3/14/21 6:38 PM, Pedro Tammela wrote: > > Linux headers might pull 'linux/stddef.h' which defines > > '__always_inline' as the following: > > > > #ifndef __always_inline > > #define __always_inline __inline__ > > #endif > >

Re: [PATCH bpf-next 3/5] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 3:43 PM Florent Revest wrote: > > On Tue, Mar 16, 2021 at 5:36 AM Andrii Nakryiko > wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > +#define ___bpf_build_param0(narg, x) > > > +#define ___bpf_build_param

Re: [PATCH bpf-next 1/5] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 4:58 PM Florent Revest wrote: > > On Tue, Mar 16, 2021 at 2:03 AM Andrii Nakryiko > wrote: > > On Wed, Mar 10, 2021 at 2:02 PM Florent Revest wrote: > > > + } else if (arg_type == ARG_PTR_TO_CONST_STR) { > > > + s

Re: [PATCH bpf-next 1/5] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-16 Thread Andrii Nakryiko
On Tue, Mar 16, 2021 at 5:46 PM Florent Revest wrote: > > On Wed, Mar 17, 2021 at 1:35 AM Andrii Nakryiko > wrote: > > On Tue, Mar 16, 2021 at 4:58 PM Florent Revest wrote: > > > On Tue, Mar 16, 2021 at 2:03 AM Andrii Nakryiko > > > wrote: > > > > O

Re: [PATCH bpf-next] libbpf: fix bail out from 'ringbuf_process_ring()' on error

2021-03-25 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 8:02 AM Pedro Tammela wrote: > > The current code bails out with negative and positive returns. > If the callback returns a positive return code, 'ring_buffer__consume()' > and 'ring_buffer__poll()' will return a spurious number of records > consumed, but mostly important w

Re: [PATCH bpf] bpf: link: refuse non-zero file_flags in BPF_OBJ_GET

2021-03-25 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 8:22 AM Lorenz Bauer wrote: > > Invoking BPF_OBJ_GET on a pinned bpf_link checks the path access > permissions based on file_flags, but the returned fd ignores flags. > This means that any user can acquire a "read-write" fd for a pinned > link with mode 0664 by invoking BPF

Re: [PATCH v2 0/8] Implement EBPF on powerpc32

2021-03-26 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 7:42 AM Christophe Leroy wrote: > > > > Le 22/03/2021 à 18:53, Andrii Nakryiko a écrit : > > On Mon, Mar 22, 2021 at 9:37 AM Christophe Leroy > > wrote: > >> > >> This series implements extended BPF on powerpc32. For the impleme

Re: [PATCH bpf-next v2 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > Two helpers (trace_printk and seq_printf) have very similar > implementations of format string parsing and a third one is coming > (snprintf). To avoid code duplication and make the code easier to > maintain, this moves the operations assoc

Re: [PATCH bpf-next v2 2/6] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > This type provides the guarantee that an argument is going to be a const > pointer to somewhere in a read-only map value. It also checks that this > pointer is followed by a zero character before the end of the map value. > > Signed-off-by:

Re: [PATCH bpf-next v2 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-03-26 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 2:53 PM Andrii Nakryiko wrote: > > On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > > > Two helpers (trace_printk and seq_printf) have very similar > > implementations of format string parsing and a third one is coming > > (snprin

Re: [PATCH bpf-next v2 3/6] bpf: Add a bpf_snprintf helper

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > The implementation takes inspiration from the existing bpf_trace_printk > helper but there are a few differences: > > To allow for a large number of format-specifiers, parameters are > provided in an array, like in bpf_seq_printf. > > Becau

Re: [PATCH bpf-next v2 4/6] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > When initializing the __param array with a one liner, if all args are > const, the initial array value will be placed in the rodata section but > because libbpf does not support relocation in the rodata section, any > pointer in this array

Re: [PATCH bpf-next v2 5/6] libbpf: Introduce a BPF_SNPRINTF helper macro

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > Similarly to BPF_SEQ_PRINTF, this macro turns variadic arguments into an > array of u64, making it more natural to call the bpf_snprintf helper. > > Signed-off-by: Florent Revest > --- > tools/lib/bpf/bpf_tracing.h | 18 ++

Re: [PATCH bpf-next v2 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-03-26 Thread Andrii Nakryiko
On Tue, Mar 23, 2021 at 7:23 PM Florent Revest wrote: > > This exercises most of the format specifiers when things go well. > > Signed-off-by: Florent Revest > --- Looks good. Please add a no-argument test case as well. Acked-by: Andrii Nakryiko > .../selftests/bpf/pro

Re: [PATCH bpf-next 1/5] tools pkt_cls.h: sync with kernel sources

2021-03-26 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 5:01 AM Kumar Kartikeya Dwivedi wrote: > > Update the header file so we can use the new defines in subsequent > patches. > > Reviewed-by: Toke Høiland-Jørgensen > Signed-off-by: Kumar Kartikeya Dwivedi > --- > tools/include/uapi/linux/pkt_cls.h | 174

Re: [PATCH bpf-next 2/5] libbpf: add helpers for preparing netlink attributes

2021-03-26 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 5:01 AM Kumar Kartikeya Dwivedi wrote: > > This change introduces a few helpers to wrap open coded attribute > preparation in netlink.c. > > Every nested attribute's closure must happen using the helper > end_nlattr_nested, which sets its length properly. NLA_F_NESTED is >

Re: [PATCH bpf-next 1/5] tools pkt_cls.h: sync with kernel sources

2021-03-26 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 8:54 PM Kumar Kartikeya Dwivedi wrote: > > On Sat, Mar 27, 2021 at 04:55:51AM IST, Andrii Nakryiko wrote: > > On Thu, Mar 25, 2021 at 5:01 AM Kumar Kartikeya Dwivedi > > wrote: > > > > > > Update the header file so we can use the new

Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-27 Thread Andrii Nakryiko
On Fri, Mar 26, 2021 at 7:15 PM Alexei Starovoitov wrote: > > On Thu, Mar 25, 2021 at 05:30:03PM +0530, Kumar Kartikeya Dwivedi wrote: > > This adds some basic tests for the low level bpf_tc_* API and its > > bpf_program__attach_tc_* wrapper on top. > > *_block() apis from patch 3 and 4 are not co

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-03-27 Thread Andrii Nakryiko
On Thu, Mar 25, 2021 at 5:02 AM Kumar Kartikeya Dwivedi wrote: > > This adds functions that wrap the netlink API used for adding, > manipulating, and removing filters and actions. These functions operate > directly on the loaded prog's fd, and return a handle to the filter and > action using an ou

Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API

2021-03-28 Thread Andrii Nakryiko
On Sun, Mar 28, 2021 at 6:40 PM Alexei Starovoitov wrote: > > On Sat, Mar 27, 2021 at 09:32:58PM -0700, Andrii Nakryiko wrote: > > > I think it's better to start with new library for tc/xdp and have > > > libbpf as a dependency on that new lib. > > > For ex

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-15 Thread Andrii Nakryiko
On Thu, Apr 15, 2021 at 8:57 AM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen > > wrote: > >> > >> Andrii Nakryiko writes: > >> > >> > On Wed, A

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-15 Thread Andrii Nakryiko
On Thu, Apr 15, 2021 at 3:10 PM Daniel Borkmann wrote: > > On 4/15/21 1:58 AM, Andrii Nakryiko wrote: > > On Wed, Apr 14, 2021 at 4:32 PM Daniel Borkmann > > wrote: > >> On 4/15/21 1:19 AM, Andrii Nakryiko wrote: > >>> On Wed, Apr 14, 2021 at 3:51

Re: [PATCH bpf-next v4 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-04-15 Thread Andrii Nakryiko
On Thu, Apr 15, 2021 at 2:33 AM Florent Revest wrote: > > On Thu, Apr 15, 2021 at 2:38 AM Andrii Nakryiko > wrote: > > On Wed, Apr 14, 2021 at 11:54 AM Florent Revest wrote: > > > +static int try_get_fmt_tmp_buf(char **tmp_buf) > > > +{ > >

Re: [PATCH bpf-next v4 3/6] bpf: Add a bpf_snprintf helper

2021-04-15 Thread Andrii Nakryiko
ormat string length > arg. > > Because the format-string is known at verification time, we also do > a first pass of format string validation in the verifier logic. This > makes debugging easier. > > Signed-off-by: Florent Revest > --- LGTM. Acked-by: Andrii Nakryiko

Re: [PATCH bpf-next v4 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-15 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:54 AM Florent Revest wrote: > > The "positive" part tests all format specifiers when things go well. > > The "negative" part makes sure that incorrect format strings fail at > load time. > > Signed-off-by: Florent Revest > --- > .../selftests/bpf/prog_tests/snprintf.c

Re: [PATCH bpf-next v2] libbpf: clarify flags in ringbuf helpers

2021-04-12 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 12:25 PM Pedro Tammela wrote: > > In 'bpf_ringbuf_reserve()' we require the flag to '0' at the moment. > > For 'bpf_ringbuf_{discard,submit,output}' a flag of '0' might send a > notification to the process if needed. > > Signed-off-by: Pedro Tammela > --- Great, thanks! A

Re: mmotm 2021-04-11-20-47 uploaded (bpf: xsk.c)

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 9:38 AM Randy Dunlap wrote: > > On 4/11/21 8:48 PM, a...@linux-foundation.org wrote: > > The mm-of-the-moment snapshot 2021-04-11-20-47 has been uploaded to > > > >https://www.ozlabs.org/~akpm/mmotm/ > > > > mmotm-readme.txt says > > > > README for mm-of-the-moment: > >

Re: [PATCH bpf-next v3 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > Two helpers (trace_printk and seq_printf) have very similar > implementations of format string parsing and a third one is coming > (snprintf). To avoid code duplication and make the code easier to > maintain, this moves the operations assoc

Re: [PATCH bpf-next v3 2/6] bpf: Add a ARG_PTR_TO_CONST_STR argument type

2021-04-13 Thread Andrii Nakryiko
> Signed-off-by: Florent Revest > --- LGTM. Acked-by: Andrii Nakryiko > include/linux/bpf.h | 1 + > kernel/bpf/verifier.c | 41 + > 2 files changed, 42 insertions(+) > [...]

Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > The implementation takes inspiration from the existing bpf_trace_printk > helper but there are a few differences: > > To allow for a large number of format-specifiers, parameters are > provided in an array, like in bpf_seq_printf. > > Becau

Re: [PATCH bpf-next v3 4/6] libbpf: Initialize the bpf_seq_printf parameters array field by field

2021-04-13 Thread Andrii Nakryiko
r in this array will stay NULL. > > Fixes: c09add2fbc5a ("tools/libbpf: Add bpf_iter support") > Signed-off-by: Florent Revest > --- Looks good! Acked-by: Andrii Nakryiko > tools/lib/bpf/bpf_tracing.h | 40 +++-- > 1 file changed, 29 insertions(+), 11 deletions(-) > [...]

Re: [PATCH bpf-next v3 5/6] libbpf: Introduce a BPF_SNPRINTF helper macro

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > Similarly to BPF_SEQ_PRINTF, this macro turns variadic arguments into an > array of u64, making it more natural to call the bpf_snprintf helper. > > Signed-off-by: Florent Revest > --- Nice! Acked-by: Andrii Nakryiko

Re: [PATCH bpf-next v3 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-13 Thread Andrii Nakryiko
On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > This exercises most of the format specifiers. > > Signed-off-by: Florent Revest > Acked-by: Andrii Nakryiko > --- As I mentioned on another patch, we probably need negative tests even more than positive ones. I thin

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-13 Thread Andrii Nakryiko
On Tue, Apr 6, 2021 at 3:06 AM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Sat, Apr 3, 2021 at 10:47 AM Alexei Starovoitov > > wrote: > >> > >> On Sat, Apr 03, 2021 at 12:38:06AM +0530, Kumar Kartikeya Dwivedi wrote: > >>

Re: [PATCH bpf-next v3 6/6] selftests/bpf: Add a series of tests for bpf_snprintf

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 2:21 AM Florent Revest wrote: > > On Wed, Apr 14, 2021 at 1:21 AM Andrii Nakryiko > wrote: > > > > On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > > > > > This exercises most of the format specifiers. > > > >

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Tue, Apr 6, 2021 at 3:06 AM Toke Høiland-Jørgensen > > wrote: > >> > >> Andrii Nakryiko writes: > >> > >> > On Sat, Apr 3, 2021 at 1

Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 2:46 AM Florent Revest wrote: > > On Wed, Apr 14, 2021 at 1:16 AM Andrii Nakryiko > wrote: > > On Mon, Apr 12, 2021 at 8:38 AM Florent Revest wrote: > > > +static int check_bpf_snprintf_call(struct bpf_verifier_env *env, > > > +

Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:30 AM Florent Revest wrote: > > Hey Geert! :) > > On Wed, Apr 14, 2021 at 8:02 PM Geert Uytterhoeven > wrote: > > On Wed, Apr 14, 2021 at 9:41 AM Andrii Nakryiko > > wrote: > > > On Mon, Apr 12, 2021 at 8:38 AM Florent Reves

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen wrote: > > Andrii Nakryiko writes: > > > On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland-Jørgensen > > wrote: > >> > >> Andrii Nakryiko writes: > >> > >> > On Tue,

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 4:32 PM Daniel Borkmann wrote: > > On 4/15/21 1:19 AM, Andrii Nakryiko wrote: > > On Wed, Apr 14, 2021 at 3:51 PM Toke Høiland-Jørgensen > > wrote: > >> Andrii Nakryiko writes: > >>> On Wed, Apr 14, 2021 at 3:58 AM Toke Høiland

Re: [PATCH] selftests/bpf: Fix the ASSERT_ERR_PTR macro

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:58 AM Martin KaFai Lau wrote: > > On Wed, Apr 14, 2021 at 05:56:32PM +0200, Florent Revest wrote: > > It is just missing a ';'. This macro is not used by any test yet. > > > > Signed-off-by: Florent Revest > Fixes: 22ba36351631 ("selftests/bpf: Move and extend ASSERT_xx

Re: [PATCH bpf-next v4 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf

2021-04-14 Thread Andrii Nakryiko
On Wed, Apr 14, 2021 at 11:54 AM Florent Revest wrote: > > Two helpers (trace_printk and seq_printf) have very similar > implementations of format string parsing and a third one is coming > (snprintf). To avoid code duplication and make the code easier to > maintain, this moves the operations asso

Re: [PATCH bpf-next v5 0/6] Add a snprintf eBPF helper

2021-04-19 Thread Andrii Nakryiko
f/prog_tests/snprintf.c > create mode 100644 tools/testing/selftests/bpf/progs/test_snprintf.c > create mode 100644 tools/testing/selftests/bpf/progs/test_snprintf_single.c > > -- > 2.31.1.368.gbe11c130af-goog > Looks great, thank you! For the series: Acked-by: Andrii Nakryiko

Re: [PATCH bpf-next v2 4/4] libbpf: add selftests for TC-BPF API

2021-04-19 Thread Andrii Nakryiko
On Mon, Apr 19, 2021 at 5:18 AM Kumar Kartikeya Dwivedi wrote: > > This adds some basic tests for the low level bpf_tc_cls_* API. > > Reviewed-by: Toke Høiland-Jørgensen > Signed-off-by: Kumar Kartikeya Dwivedi > --- > .../selftests/bpf/prog_tests/test_tc_bpf.c| 112 ++ > ..

Re: [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag

2021-04-03 Thread Andrii Nakryiko
On Sat, Apr 3, 2021 at 6:34 AM Pedro Tammela wrote: > > Em qua., 31 de mar. de 2021 às 03:54, Andrii Nakryiko > escreveu: > > > > On Sun, Mar 28, 2021 at 9:11 AM Pedro Tammela wrote: > > > > > > The current way to provide a no-op flag to 'bpf_ringbuf_

Re: [PATCH bpf-next v2] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()'

2021-04-03 Thread Andrii Nakryiko
On Sat, Apr 3, 2021 at 6:29 AM Pedro Tammela wrote: > > Em qua., 31 de mar. de 2021 às 04:02, Andrii Nakryiko > escreveu: > > > > On Tue, Mar 30, 2021 at 4:16 PM Alexei Starovoitov > > wrote: > > > > > > On Tue, Mar 30, 2021 at 3:54 PM Pedr

Re: [PATCH] libbpf: Fix KERNEL_VERSION macro

2021-04-04 Thread Andrii Nakryiko
On Sun, Apr 4, 2021 at 2:53 AM Hengqi Chen wrote: > > Add missing ')' for KERNEL_VERSION macro. > > Signed-off-by: Hengqi Chen > --- The fix looks good, thank you. But your patch didn't make it into bpf/netdev patchworks instance ([0]) most probably due to too long CC list. Can you please re-sen

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-05 Thread Andrii Nakryiko
On Fri, Apr 2, 2021 at 8:27 AM Kumar Kartikeya Dwivedi wrote: > > On Fri, Apr 02, 2021 at 05:49:29AM IST, Daniel Borkmann wrote: > > On 3/31/21 11:44 AM, Kumar Kartikeya Dwivedi wrote: > > > On Wed, Mar 31, 2021 at 02:55:47AM IST, Daniel Borkmann wrote: > > > > Do we even need the _block variant?

Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API

2021-04-05 Thread Andrii Nakryiko
On Sat, Apr 3, 2021 at 10:47 AM Alexei Starovoitov wrote: > > On Sat, Apr 03, 2021 at 12:38:06AM +0530, Kumar Kartikeya Dwivedi wrote: > > On Sat, Apr 03, 2021 at 12:02:14AM IST, Alexei Starovoitov wrote: > > > On Fri, Apr 2, 2021 at 8:27 AM Kumar Kartikeya Dwivedi > > > wrote: > > > > [...] > >

Re: [RFC bpf-next 1/3] bpf: add module support to btf display helpers

2020-11-17 Thread Andrii Nakryiko
On Sun, Nov 15, 2020 at 2:53 AM Alan Maguire wrote: > > On Sat, 14 Nov 2020, Yonghong Song wrote: > > > > > > > On 11/14/20 8:04 AM, Alexei Starovoitov wrote: > > > On Fri, Nov 13, 2020 at 10:59 PM Andrii Nakryiko > > > wrote: > > >

Re: BPF selftests build failure in 5.10-rc

2020-12-09 Thread Andrii Nakryiko
On Wed, Dec 9, 2020 at 2:24 PM Seth Forshee wrote: > > Building the BPF selftests with clang 11, I'm getting the following > error: > >CLNG-LLC [test_maps] profiler1.o > In file included from progs/profiler1.c:6: > progs/profiler.inc.h:260:17: error: use of unknown builtin > '__builtin_pres

Re: [PATCH bpf-next v3 12/14] bpf: Pull tools/build/feature biz into selftests Makefile

2020-12-04 Thread Andrii Nakryiko
On Fri, Dec 4, 2020 at 1:41 AM Brendan Jackman wrote: > > On Thu, Dec 03, 2020 at 01:01:27PM -0800, Andrii Nakryiko wrote: > > On Thu, Dec 3, 2020 at 8:07 AM Brendan Jackman wrote: > > > > > > This is somewhat cargo-culted from the libbpf build. It will be used

Re: [PATCH bpf-next v3 13/14] bpf: Add tests for new BPF atomic operations

2020-12-04 Thread Andrii Nakryiko
On Fri, Dec 4, 2020 at 7:29 AM Yonghong Song wrote: > > > > On 12/4/20 1:45 AM, Brendan Jackman wrote: > > On Thu, Dec 03, 2020 at 11:06:31PM -0800, Yonghong Song wrote: > >> On 12/3/20 8:02 AM, Brendan Jackman wrote: > > [...] > >>> diff --git a/tools/testing/selftests/bpf/prog_tests/atomics_test

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-18 Thread Andrii Nakryiko
On Thu, Dec 17, 2020 at 7:20 PM Alexei Starovoitov wrote: > > On Thu, Dec 17, 2020 at 09:26:09AM -0800, Yonghong Song wrote: > > > > > > On 12/17/20 7:31 AM, Florent Revest wrote: > > > On Mon, Dec 14, 2020 at 7:47 AM Yonghong Song wrote: > > > > On 12/11/20 6:40 AM, Florent Revest wrote: > > > >

Re: [RFC PATCH v1 7/7] powerpc/bpf: Implement extended BPF on PPC32

2020-12-18 Thread Andrii Nakryiko
On Thu, Dec 17, 2020 at 1:54 AM Christophe Leroy wrote: > > > > Le 17/12/2020 à 07:11, Alexei Starovoitov a écrit : > > On Wed, Dec 16, 2020 at 10:07:37AM +, Christophe Leroy wrote: > >> Implement Extended Berkeley Packet Filter on Powerpc 32 > >> > >> Test result with test_bpf module: > >> >

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-18 Thread Andrii Nakryiko
On Fri, Dec 18, 2020 at 12:36 PM Alexei Starovoitov wrote: > > On Fri, Dec 18, 2020 at 10:53:57AM -0800, Andrii Nakryiko wrote: > > On Thu, Dec 17, 2020 at 7:20 PM Alexei Starovoitov > > wrote: > > > > > > On Thu, Dec 17, 2020 at 09:26:09AM -0800, Yonghong So

Re: [PATCH bpf-next] kbuild: Restore ability to build out-of-tree modules

2020-12-01 Thread Andrii Nakryiko
On Tue, Dec 1, 2020 at 6:37 AM Leon Romanovsky wrote: > > From: Leon Romanovsky > > The out-of-tree modules are built without vmlinux target and request > to recompile that target unconditionally causes to the following > compilation error. > > [root@server kernel]# make > <..> > make -f ./script

Re: [PATCH bpf-next] kbuild: Restore ability to build out-of-tree modules

2020-12-01 Thread Andrii Nakryiko
On Tue, Dec 1, 2020 at 11:32 AM Leon Romanovsky wrote: > > On Tue, Dec 01, 2020 at 10:01:23AM -0800, Andrii Nakryiko wrote: > > On Tue, Dec 1, 2020 at 6:37 AM Leon Romanovsky wrote: > > > > > > From: Leon Romanovsky > > > > > > The out-of-t

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-01 Thread Andrii Nakryiko
On Fri, Nov 27, 2020 at 3:20 AM KP Singh wrote: > > On Fri, Nov 27, 2020 at 8:35 AM Yonghong Song wrote: > > > > > > > > On 11/26/20 8:57 AM, Florent Revest wrote: > > > This helper exposes the kallsyms_lookup function to eBPF tracing > > > programs. This can be used to retrieve the name of the s

Re: [PATCH bpf-next 1/2] bpf: Add a bpf_kallsyms_lookup helper

2020-12-01 Thread Andrii Nakryiko
On Fri, Nov 27, 2020 at 8:09 AM Yonghong Song wrote: > > > > On 11/27/20 3:20 AM, KP Singh wrote: > > On Fri, Nov 27, 2020 at 8:35 AM Yonghong Song wrote: > >> > >> > >> > >> On 11/26/20 8:57 AM, Florent Revest wrote: > >>> This helper exposes the kallsyms_lookup function to eBPF tracing > >>> pr

Re: [PATCH bpf-next 2/2] selftests/bpf: Add bpf_kallsyms_lookup test

2020-12-01 Thread Andrii Nakryiko
On Thu, Nov 26, 2020 at 8:59 AM Florent Revest wrote: > > This piggybacks on the existing "ksyms" test because this test also > relies on a __ksym symbol and requires CONFIG_KALLSYMS. > > Signed-off-by: Florent Revest > --- > tools/testing/selftests/bpf/config| 1 + > .../testing/se

Re: [PATCH bpf-next 2/2] bpf: Add a selftest for the tracing bpf_get_socket_cookie

2020-12-01 Thread Andrii Nakryiko
On Thu, Nov 26, 2020 at 9:02 AM Florent Revest wrote: > > This builds up on the existing socket cookie test which checks whether > the bpf_get_socket_cookie helpers provide the same value in > cgroup/connect6 and sockops programs for a socket created by the > userspace part of the test. > > Adding

Re: [PATCH] tools/bpf: Return the appropriate error value

2020-12-01 Thread Andrii Nakryiko
On Mon, Nov 30, 2020 at 7:06 PM 彭浩(Richard) wrote: > > Compile times error: > "Error: failed to load BTF from /mnt/linux/vmlinux: No such file or > directory". > This file "/mnt/linux/vmlinux" actually exists, but only because > CONFIG_DEBUG_INFO_BTF > is not configured with this error. > > Sign

Re: [PATCH v2 bpf-next 00/13] Atomics for eBPF

2020-12-01 Thread Andrii Nakryiko
On Mon, Nov 30, 2020 at 7:51 PM Yonghong Song wrote: > > > > On 11/30/20 9:22 AM, Yonghong Song wrote: > > > > > > On 11/28/20 5:40 PM, Alexei Starovoitov wrote: > >> On Fri, Nov 27, 2020 at 09:53:05PM -0800, Yonghong Song wrote: > >>> > >>> > >>> On 11/27/20 9:57 AM, Brendan Jackman wrote: >

Re: [PATCH v1 bpf-next 06/11] bpf: Introduce two attach types for BPF_PROG_TYPE_SK_REUSEPORT.

2020-12-01 Thread Andrii Nakryiko
On Tue, Dec 1, 2020 at 6:49 AM Kuniyuki Iwashima wrote: > > This commit adds new bpf_attach_type for BPF_PROG_TYPE_SK_REUSEPORT to > check if the attached eBPF program is capable of migrating sockets. > > When the eBPF program is attached, the kernel runs it for socket migration > only if the expe

Re: [PATCH v2 bpf-next 12/13] bpf: Add tests for new BPF atomic operations

2020-12-01 Thread Andrii Nakryiko
On Fri, Nov 27, 2020 at 10:01 AM Brendan Jackman wrote: > > This relies on the work done by Yonghong Song in > https://reviews.llvm.org/D72184 > > Note the hackery in the Makefile that is necessary to avoid breaking > tests for people who haven't yet got a version of Clang supporting > V4. It seem

Re: [PATCH v2 bpf-next 00/13] Atomics for eBPF

2020-12-01 Thread Andrii Nakryiko
On Tue, Dec 1, 2020 at 9:53 PM John Fastabend wrote: > > Yonghong Song wrote: > > > > > > [...] > > > > Great, this means that all existing valid uses of > > > __sync_fetch_and_add() will generate BPF_XADD instructions and will > > > work on old kernels, right? > > > > That is correct. > > > > > >

Re: [PATCH bpf-next v3 12/14] bpf: Pull tools/build/feature biz into selftests Makefile

2020-12-03 Thread Andrii Nakryiko
On Thu, Dec 3, 2020 at 8:07 AM Brendan Jackman wrote: > > This is somewhat cargo-culted from the libbpf build. It will be used > in a subsequent patch to query for Clang BPF atomics support. > > Change-Id: I9318a1702170eb752acced35acbb33f45126c44c Haven't seen this before. What's this Change-Id b

Re: [PATCH bpf-next v3 11/14] tools build: Implement feature check for BPF atomics in Clang

2020-12-03 Thread Andrii Nakryiko
On Thu, Dec 3, 2020 at 8:08 AM Brendan Jackman wrote: > > Change-Id: Ia15bb76f7152fff2974e38242d7430ce2987a71e > See recent discussion on KP's patch set. There needs to be a commit message, even if it's just a copy/paste of subject line. But see also my other reply, I'm not sure it's worth it to

Re: [PATCH] libbpf: Use the correct fd when attaching to perf events

2021-03-12 Thread Andrii Nakryiko
On Fri, Mar 12, 2021 at 1:43 PM Sultan Alsawaf wrote: > > From: Sultan Alsawaf > > We should be using the program fd here, not the perf event fd. Why? Can you elaborate on what issue you ran into with the current code? > > Fixes: 63f2f5ee856ba ("libbpf: add ability to attach/detach BPF program

Re: [PATCH] libbpf: Use the correct fd when attaching to perf events

2021-03-12 Thread Andrii Nakryiko
On Fri, Mar 12, 2021 at 6:22 PM Sultan Alsawaf wrote: > > On Fri, Mar 12, 2021 at 05:31:14PM -0800, Andrii Nakryiko wrote: > > On Fri, Mar 12, 2021 at 1:43 PM Sultan Alsawaf > > wrote: > > > > > > From: Sultan Alsawaf > > > > > > We shou

Re: [PATCH] libbpf: Use the correct fd when attaching to perf events

2021-03-12 Thread Andrii Nakryiko
On Fri, Mar 12, 2021 at 6:43 PM Sultan Alsawaf wrote: > > On Fri, Mar 12, 2021 at 06:33:01PM -0800, Andrii Nakryiko wrote: > > On Fri, Mar 12, 2021 at 6:22 PM Sultan Alsawaf > > wrote: > > > > > > On Fri, Mar 12, 2021 at 05:31:14PM -0800, Andrii Nakryiko wrot

<    1   2   3   4   5   6   7   8   >