[PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule

2024-11-11 Thread Daniel Xu
Extend the rss_ctx test suite to test that an ntuple action that redirects to an RSS context contains that information in `ethtool -n`. Otherwise the output from ethtool is highly deceiving. This test helps ensure drivers are compliant with the API. Signed-off-by: Daniel Xu --- tools/testing

[PATCH net v2 0/2] bnxt: Fix failure to report RSS context in ntuple rule

2024-11-11 Thread Daniel Xu
This patchset fixes a bug where bnxt driver was failing to report that an ntuple rule is redirecting to an RSS context. First commit is the fix, then second commit extends selftests to detect if other/new drivers are compliant with ntuple/rss_ctx API. Daniel Xu (2): bnxt_en: ethtool: Supply

Re: [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule

2024-11-12 Thread Daniel Xu
Hi Jakub, On Tue, Nov 12, 2024, at 5:44 PM, Jakub Kicinski wrote: > On Mon, 11 Nov 2024 19:23:31 -0700 Daniel Xu wrote: >> Extend the rss_ctx test suite to test that an ntuple action that >> redirects to an RSS context contains that information in `ethtool -n`. >> Othe

Re: [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule

2024-11-12 Thread Daniel Xu
Hi Ed, On Tue, Nov 12, 2024, at 3:10 AM, Edward Cree wrote: > On 12/11/2024 02:23, Daniel Xu wrote: >> Extend the rss_ctx test suite to test that an ntuple action that >> redirects to an RSS context contains that information in `ethtool -n`. >> Otherwise the output f

Re: [PATCH bpf-next v2 1/2] bpf: verifier: Support eliding map lookup nullness

2024-09-22 Thread Daniel Xu
On Fri, Sep 20, 2024 at 03:05:35PM GMT, Eduard Zingerman wrote: > On Sun, 2024-09-15 at 21:45 -0600, Daniel Xu wrote: > > This commit allows progs to elide a null check on statically known map > > lookup keys. In other words, if the verifier can statically prove that > >

[PATCH bpf-next v3 1/2] bpf: verifier: Support eliding map lookup nullness

2024-09-24 Thread Daniel Xu
d in sync with these changes, as the verifier is more efficient with this change. Notable, iters.c tests had to be changed to use a map type that still requires null checks, as it's exercising verifier tracking logic w.r.t iterators. Signed-off-by: Daniel Xu --- kernel/bpf/verifier.c

[PATCH bpf-next v3 0/2] Support eliding map lookup nullness

2024-09-24 Thread Daniel Xu
e for when R2 can be both const and non-const Daniel Xu (2): bpf: verifier: Support eliding map lookup nullness bpf: selftests: verifier: Add nullness elision tests kernel/bpf/verifier.c | 67 ++- tools/testing/selftests/bpf/progs/iters.c | 14 +- ...

[PATCH bpf-next v3 2/2] bpf: selftests: verifier: Add nullness elision tests

2024-09-24 Thread Daniel Xu
d-off-by: Daniel Xu --- .../bpf/progs/verifier_array_access.c | 166 ++ 1 file changed, 166 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/verifier_array_access.c b/tools/testing/selftests/bpf/progs/verifier_array_access.c index 95d7ecc12963..2e74504ddbb5 1

[PATCH bpf-next v4 0/2] Support eliding map lookup nullness

2024-10-02 Thread Daniel Xu
ck for when stack is uninitialized (no stack slot yet) * Updated existing tests to account for null elision * Added test case for when R2 can be both const and non-const Daniel Xu (2): bpf: verifier: Support eliding map lookup nullness bpf: selftests: verifier: Add nullness elision tests k

[PATCH bpf-next v4 1/2] bpf: verifier: Support eliding map lookup nullness

2024-10-02 Thread Daniel Xu
d in sync with these changes, as the verifier is more efficient with this change. Notable, iters.c tests had to be changed to use a map type that still requires null checks, as it's exercising verifier tracking logic w.r.t iterators. Acked-by: Eduard Zingerman Signed-off-by: Daniel Xu -

[PATCH bpf-next v4 2/2] bpf: selftests: verifier: Add nullness elision tests

2024-10-02 Thread Daniel Xu
d-off-by: Daniel Xu --- .../bpf/progs/verifier_array_access.c | 183 ++ 1 file changed, 183 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/verifier_array_access.c b/tools/testing/selftests/bpf/progs/verifier_array_access.c index 95d7ecc12963..872edded1623 1

[PATCH net v3 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule

2024-11-27 Thread Daniel Xu
Extend the rss_ctx test suite to test that an ntuple action that redirects to an RSS context contains that information in `ethtool -n`. Otherwise the output from ethtool is highly deceiving. This test helps ensure drivers are compliant with the API. Signed-off-by: Daniel Xu --- tools/testing

[PATCH net v3 0/2] bnxt: Fix failure to report RSS context in ntuple rule

2024-11-27 Thread Daniel Xu
to net instead of net-next * Make regex work with ethtool output changes Changes from v1: * Add selftest in patch 2 Daniel Xu (2): bnxt_en: ethtool: Supply ntuple rss context action selftests: drv-net: rss_ctx: Add test for ntuple rule drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 8

[PATCH bpf-next v2 2/3] bpf: selftests: Test constant key extraction on irrelevant maps

2025-02-04 Thread Daniel Xu
Test that very high constant map keys are not interpreted as an error value by the verifier. This would previously fail. Acked-by: Eduard Zingerman Signed-off-by: Daniel Xu --- .../selftests/bpf/progs/verifier_array_access.c | 15 +++ 1 file changed, 15 insertions(+) diff --git

[PATCH bpf-next v2 0/3] bpf: Some fixes for nullness elision

2025-02-04 Thread Daniel Xu
Two fixes for nullness elision. See commits for more details. === Changelog === Changes from v1: * Reword commit message in patch 1 * Add tags Daniel Xu (3): bpf: verifier: Do not extract constant map keys for irrelevant maps bpf: selftests: Test constant key extraction on irrelevant maps

Re: [PATCH bpf-next v7 4/5] bpf: verifier: Support eliding map lookup nullness

2025-02-01 Thread Daniel Xu
On Thu, Jan 30, 2025, at 7:41 PM, Daniel Xu wrote: > Hi Ilya, > > On Thu, Jan 30, 2025, at 2:06 AM, Ilya Leoshkevich wrote: >> On Wed, 2025-01-29 at 10:45 -0700, Daniel Xu wrote: >>> On Wed, Jan 29, 2025 at 09:49:12AM -0700, Daniel Xu wrote: >>> > Hi Ilya,

[PATCH] selftests: bpf: Support dynamic linking LLVM if static not available

2025-01-30 Thread Daniel Xu
e. If both options are available, static linking is chosen. Signed-off-by: Daniel Xu --- tools/testing/selftests/bpf/Makefile | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 67

[PATCH bpf-next 0/3] bpf: Some fixes for nullness elision

2025-02-01 Thread Daniel Xu
Two fixes for nullness elision. See commits for more details. Daniel Xu (3): bpf: verifier: Do not extract constant map keys for irrelevant maps bpf: selftests: Test constant key extraction on irrelevant maps bpf: verifier: Disambiguate get_constant_map_key() errors kernel/bpf/verifier.c

[PATCH bpf-next 2/3] bpf: selftests: Test constant key extraction on irrelevant maps

2025-02-01 Thread Daniel Xu
Test that very high constant map keys are not interpreted as an error value by the verifier. This would previously fail. Signed-off-by: Daniel Xu --- .../selftests/bpf/progs/verifier_array_access.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/tools/testing/selftests

Re: [PATCH bpf-next v7 4/5] bpf: verifier: Support eliding map lookup nullness

2025-01-30 Thread Daniel Xu
Hi Ilya, On Thu, Jan 30, 2025, at 2:06 AM, Ilya Leoshkevich wrote: > On Wed, 2025-01-29 at 10:45 -0700, Daniel Xu wrote: >> On Wed, Jan 29, 2025 at 09:49:12AM -0700, Daniel Xu wrote: >> > Hi Ilya, >> > >> > On Wed, Jan 29, 2025 at 03:58:54PM +0100, Ilya Leosh

Re: [PATCH] selftests: bpf: Support dynamic linking LLVM if static not available

2025-02-01 Thread Daniel Xu
Hi Yonghong, On Thu, Jan 30, 2025 at 10:28:11PM -0800, Yonghong Song wrote: > > > > On 1/30/25 2:33 PM, Daniel Xu wrote: > > Since 67ab80a01886 ("selftests/bpf: Prefer static linking for LLVM > > libraries"), only statically linking test_progs is support

Re: [PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-18 Thread Daniel Xu
On Mon, Dec 16, 2024 at 03:24:01PM -0800, Andrii Nakryiko wrote: > On Fri, Dec 13, 2024 at 7:13 PM Eduard Zingerman wrote: > > > > On Fri, 2024-12-13 at 19:44 -0700, Daniel Xu wrote: > > [...] > > > > > > with Eduard's suggestion this also becomes

Re: [PATCH bpf-next v5 5/5] bpf: selftests: verifier: Add nullness elision tests

2024-12-17 Thread Daniel Xu
On Fri, Dec 13, 2024, at 10:17 PM, Eduard Zingerman wrote: > On Thu, 2024-12-12 at 16:22 -0700, Daniel Xu wrote: >> Test that nullness elision works for common use cases. For example, we >> want to check that both full and subreg stack slots are recognized. As >> well as wh

[PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-12 Thread Daniel Xu
d in sync with these changes, as the verifier is more efficient with this change. Notable, iters.c tests had to be changed to use a map type that still requires null checks, as it's exercising verifier tracking logic w.r.t iterators. Signed-off-by: Daniel Xu --- kernel/bpf/verifier.c

Re: [PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-13 Thread Daniel Xu
On Thu, Dec 12, 2024 at 08:04:45PM GMT, Eduard Zingerman wrote: > On Thu, 2024-12-12 at 16:22 -0700, Daniel Xu wrote: > > I think these changes are fine in general, but see below. > > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > > index 58b36cc96

Re: [PATCH bpf-next v5 3/5] bpf: verifier: Refactor helper access type tracking

2024-12-13 Thread Daniel Xu
On Thu, Dec 12, 2024 at 08:04:28PM GMT, Eduard Zingerman wrote: > On Thu, 2024-12-12 at 16:22 -0700, Daniel Xu wrote: > > Previously, the verifier was treating all PTR_TO_STACK registers passed > > to a helper call as potentially written to by the helper. However, a

[PATCH bpf-next v5 0/5] Support eliding map lookup nullness

2024-12-12 Thread Daniel Xu
ck for when stack is uninitialized (no stack slot yet) * Updated existing tests to account for null elision * Added test case for when R2 can be both const and non-const Daniel Xu (5): bpf: verifier: Add missing newline on verbose() call bpf: tcp: Mark bpf_load_hdr_opt() arg2 as read-write bpf

[PATCH bpf-next v5 3/5] bpf: verifier: Refactor helper access type tracking

2024-12-12 Thread Daniel Xu
. An additional benefit is the verifier logs are also more precise. For this particular error, users will enjoy a slightly clearer message. See included selftest updates for examples. Signed-off-by: Daniel Xu --- kernel/bpf/verifier.c | 45 +++ .../testing

[PATCH bpf-next v5 5/5] bpf: selftests: verifier: Add nullness elision tests

2024-12-12 Thread Daniel Xu
Test that nullness elision works for common use cases. For example, we want to check that both full and subreg stack slots are recognized. As well as when there's both const and non-const values of R2 leading up to a lookup. And obviously some bound checks. Signed-off-by: Daniel Xu --- ..

Re: [PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-13 Thread Daniel Xu
On Fri, Dec 13, 2024 at 03:02:11PM GMT, Andrii Nakryiko wrote: > On Thu, Dec 12, 2024 at 3:23 PM Daniel Xu wrote: > > > > This commit allows progs to elide a null check on statically known map > > lookup keys. In other words, if the verifier can statically prove that >

Re: [PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-19 Thread Daniel Xu
On Mon, Dec 16, 2024 at 03:24:01PM -0800, Andrii Nakryiko wrote: > On Fri, Dec 13, 2024 at 7:13 PM Eduard Zingerman wrote: > > > > On Fri, 2024-12-13 at 19:44 -0700, Daniel Xu wrote: > > > > [...] > > > > > > > + /* First handle precisely t

Re: [PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-19 Thread Daniel Xu
On Thu, Dec 19, 2024 at 04:04:43PM -0800, Eduard Zingerman wrote: > On Thu, 2024-12-19 at 14:41 -0700, Daniel Xu wrote: > > [...] > > > > > I think that if test operates on a key like: > > > > > > > > valid key 15 > > > >

Re: [PATCH bpf-next v5 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-19 Thread Daniel Xu
On Thu, Dec 19, 2024 at 04:49:13PM -0800, Alexei Starovoitov wrote: > On Thu, Dec 19, 2024 at 4:43 PM Eduard Zingerman wrote: > > > > On Thu, 2024-12-19 at 17:40 -0700, Daniel Xu wrote: > > > > [...] > > > > > > Ok, thinking a bit more, the best tes

[PATCH bpf-next v6 0/5] Support eliding map lookup nullness

2024-12-19 Thread Daniel Xu
* Added a check for when R2 is not a ptr to stack * Added a check for when stack is uninitialized (no stack slot yet) * Updated existing tests to account for null elision * Added test case for when R2 can be both const and non-const Daniel Xu (5): bpf: verifier: Add missing newline on verbose() c

[PATCH bpf-next v6 5/5] bpf: selftests: verifier: Add nullness elision tests

2024-12-19 Thread Daniel Xu
ointer. So check that we disallow both. Signed-off-by: Daniel Xu --- .../bpf/progs/verifier_array_access.c | 168 ++ 1 file changed, 168 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/verifier_array_access.c b/tools/testing/selftests/bpf/progs/verifier_arra

[PATCH bpf-next v6 3/5] bpf: verifier: Refactor helper access type tracking

2024-12-19 Thread Daniel Xu
. An additional benefit is the verifier logs are also more precise. For this particular error, users will enjoy a slightly clearer message. See included selftest updates for examples. Acked-by: Eduard Zingerman Signed-off-by: Daniel Xu --- kernel/bpf/verifier.c | 45

[PATCH bpf-next v6 4/5] bpf: verifier: Support eliding map lookup nullness

2024-12-19 Thread Daniel Xu
d in sync with these changes, as the verifier is more efficient with this change. Notable, iters.c tests had to be changed to use a map type that still requires null checks, as it's exercising verifier tracking logic w.r.t iterators. Signed-off-by: Daniel Xu --- kernel/bpf/verifier.c

[PATCH bpf-next] bpf: veristat: Document verifier log dumping capability

2025-01-09 Thread Daniel Xu
: Daniel Xu --- tools/testing/selftests/bpf/veristat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c index 974c808f9321..7d0a9cb753e3 100644 --- a/tools/testing/selftests/bpf/veristat.c

Re: [PATCH bpf-next v6 4/5] bpf: verifier: Support eliding map lookup nullness

2025-01-09 Thread Daniel Xu
On Thu, Jan 02, 2025 at 06:53:54PM -0800, Eduard Zingerman wrote: > On Thu, 2024-12-19 at 21:09 -0700, Daniel Xu wrote: > > lgtm, but please see a note below. > > [...] > > > +/* Returns constant key value if possible, else negative error */ > > +static s

Re: [PATCH bpf-next v7 4/5] bpf: verifier: Support eliding map lookup nullness

2025-01-29 Thread Daniel Xu
On Wed, Jan 29, 2025 at 09:49:12AM -0700, Daniel Xu wrote: > Hi Ilya, > > On Wed, Jan 29, 2025 at 03:58:54PM +0100, Ilya Leoshkevich wrote: > > On Tue, 2025-01-14 at 13:28 -0700, Daniel Xu wrote: > > > This commit allows progs to elide a null check on statically known >

Re: [PATCH bpf-next v7 4/5] bpf: verifier: Support eliding map lookup nullness

2025-01-29 Thread Daniel Xu
Hi Ilya, On Wed, Jan 29, 2025 at 03:58:54PM +0100, Ilya Leoshkevich wrote: > On Tue, 2025-01-14 at 13:28 -0700, Daniel Xu wrote: > > This commit allows progs to elide a null check on statically known > > map > > lookup keys. In other words, if the verifier can statically p

[PATCH bpf-next v7 0/5] Support eliding map lookup nullness

2025-01-14 Thread Daniel Xu
elision * Added test case for when R2 can be both const and non-const Daniel Xu (5): bpf: verifier: Add missing newline on verbose() call bpf: tcp: Mark bpf_load_hdr_opt() arg2 as read-write bpf: verifier: Refactor helper access type tracking bpf: verifier: Support eliding map lookup nulln

[PATCH bpf-next v7 4/5] bpf: verifier: Support eliding map lookup nullness

2025-01-14 Thread Daniel Xu
d in sync with these changes, as the verifier is more efficient with this change. Notable, iters.c tests had to be changed to use a map type that still requires null checks, as it's exercising verifier tracking logic w.r.t iterators. Signed-off-by: Daniel Xu --- kernel/bpf/verifier.c

[PATCH bpf-next v7 3/5] bpf: verifier: Refactor helper access type tracking

2025-01-14 Thread Daniel Xu
. An additional benefit is the verifier logs are also more precise. For this particular error, users will enjoy a slightly clearer message. See included selftest updates for examples. Acked-by: Eduard Zingerman Signed-off-by: Daniel Xu --- kernel/bpf/verifier.c | 45

[PATCH bpf-next v7 5/5] bpf: selftests: verifier: Add nullness elision tests

2025-01-14 Thread Daniel Xu
ointer. So check that we disallow both. Signed-off-by: Daniel Xu --- .../bpf/progs/verifier_array_access.c | 188 ++ 1 file changed, 188 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/verifier_array_access.c b/tools/testing/selftests/bpf/progs/verifier_arra

[RFC bpf-next 08/13] selftests: bpf: Avoid attaching to bpf_check()

2025-04-09 Thread Daniel Xu
bpf_check(), as it currently exists, will soon be going away to make way for loadable BPF verifier support. Fixup selftests so they fentry attach to a more reliable location. Signed-off-by: Daniel Xu --- tools/testing/selftests/bpf/progs/exceptions_assert.c | 2 +- tools/testing/selftests/bpf

Re: [PATCH bpf-next 0/2] Allow mmap of /sys/kernel/btf/vmlinux

2025-05-01 Thread Daniel Xu
On Thu, May 1, 2025, at 7:28 AM, Lorenz Bauer wrote: > I'd like to cut down the memory usage of parsing vmlinux BTF in ebpf-go. > With some upcoming changes the library is sitting at 5MiB for a parse. > Most of that memory is simply copying the BTF blob into user space. > By allowing vmlinux BTF to

<    1   2