mbox series

[bpf,0/7] selftests/bpf: Restore test_offload.py to working order

Message ID 160703131710.162669.9632344967082582016.stgit@toke.dk
Headers show
Series selftests/bpf: Restore test_offload.py to working order | expand

Message

Toke Høiland-Jørgensen Dec. 3, 2020, 9:35 p.m. UTC
This series restores the test_offload.py selftest to working order. It seems a
number of subtle behavioural changes have crept into various subsystems which
broke test_offload.py in a number of ways. Most of these are fairly benign
changes where small adjustments to the test script seems to be the best fix, but
one is an actual kernel bug that I've observed in the wild caused by a bad
interaction between xdp_attachment_flags_ok() and the rework of XDP program
handling in the core netdev code.

Patch 1 fixes the bug by removing xdp_attachment_flags_ok(), and the reminder of
the patches are adjustments to test_offload.py, including a new feature for
netdevsim to force a BPF verification fail. Please see the individual patches
for details.

---

Toke Høiland-Jørgensen (7):
      xdp: remove the xdp_attachment_flags_ok() callback
      selftests/bpf/test_offload.py: Remove check for program load flags match
      netdevsim: Add debugfs toggle to reject BPF programs in verifier
      selftests/bpf/test_offload.py: only check verifier log on verification fails
      selftests/bpf/test_offload.py: fix expected case of extack messages
      selftests/bpf/test_offload.py: reset ethtool features after failed setting
      selftests/bpf/test_offload.py: filter bpftool internal map when counting maps


 .../ethernet/netronome/nfp/nfp_net_common.c   |  6 ---
 drivers/net/ethernet/ti/cpsw_priv.c           |  3 --
 drivers/net/netdevsim/bpf.c                   | 15 ++++--
 drivers/net/netdevsim/netdevsim.h             |  1 +
 include/net/xdp.h                             |  2 -
 net/core/xdp.c                                | 12 -----
 tools/testing/selftests/bpf/test_offload.py   | 49 +++++++++----------
 7 files changed, 35 insertions(+), 53 deletions(-)

Comments

Jakub Kicinski Dec. 4, 2020, 1:44 a.m. UTC | #1
On Thu, 03 Dec 2020 22:35:20 +0100 Toke Høiland-Jørgensen wrote:
> diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h

> index 827fc80f50a0..d1d329af3e61 100644

> --- a/drivers/net/netdevsim/netdevsim.h

> +++ b/drivers/net/netdevsim/netdevsim.h

> @@ -190,6 +190,7 @@ struct nsim_dev {

>  	struct bpf_offload_dev *bpf_dev;

>  	bool bpf_bind_accept;

>  	u32 bpf_bind_verifier_delay;

> +	bool bpf_bind_verifier_accept;

>  	struct dentry *ddir_bpf_bound_progs;


nit: if you respin please reorder the bpf_bind_verifier_* fields so
that the structure packs better.

Acked-by: Jakub Kicinski <kuba@kernel.org>


Thanks for fixing this test!
Toke Høiland-Jørgensen Dec. 4, 2020, 9:39 a.m. UTC | #2
Jakub Kicinski <kuba@kernel.org> writes:

> On Thu, 03 Dec 2020 22:35:20 +0100 Toke Høiland-Jørgensen wrote:

>> diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h

>> index 827fc80f50a0..d1d329af3e61 100644

>> --- a/drivers/net/netdevsim/netdevsim.h

>> +++ b/drivers/net/netdevsim/netdevsim.h

>> @@ -190,6 +190,7 @@ struct nsim_dev {

>>  	struct bpf_offload_dev *bpf_dev;

>>  	bool bpf_bind_accept;

>>  	u32 bpf_bind_verifier_delay;

>> +	bool bpf_bind_verifier_accept;

>>  	struct dentry *ddir_bpf_bound_progs;

>

> nit: if you respin please reorder the bpf_bind_verifier_* fields so

> that the structure packs better.


Ah, good point, will do!

> Acked-by: Jakub Kicinski <kuba@kernel.org>

>

> Thanks for fixing this test!


You're welcome :)

I'll see if I can't get our CI people to also run it regularly so we can
avoid it regressing again...

-Toke