page_frag test module is an out of tree module, but built
using KDIR as the main kernel tree, the mm test suite is
just getting skipped if newly added page_frag test module
fails to compile due to kernel not yet compiled.
Fix the above problem by ensuring both kernel is built first
and a newer kernel which has page_frag_cache.h is used.
CC: Andrew Morton <akpm(a)linux-foundation.org>
CC: Alexander Duyck <alexanderduyck(a)fb.com>
CC: Linux-MM <linux-mm(a)kvack.org>
Fixes: 7fef0dec415c ("mm: page_frag: add a test module for page_frag")
Fixes: 65941f10caf2 ("mm: move the page fragment allocator from page_alloc into its own file")
Reported-by: Mark Brown <broonie(a)kernel.org>
Signed-off-by: Yunsheng Lin <linyunsheng(a)huawei.com>
Tested-by: Mark Brown <broonie(a)kernel.org>
---
V2: Repost by adding net-next ML.
Note, page_frag test module is only in the net-next tree for now,
so target the net-next tree.
---
tools/testing/selftests/mm/Makefile | 18 ++++++++++++++++++
tools/testing/selftests/mm/page_frag/Makefile | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index acec529baaca..04e04733fc8a 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -36,7 +36,16 @@ MAKEFLAGS += --no-builtin-rules
CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
LDLIBS = -lrt -lpthread -lm
+KDIR ?= /lib/modules/$(shell uname -r)/build
+ifneq (,$(wildcard $(KDIR)/Module.symvers))
+ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h))
TEST_GEN_MODS_DIR := page_frag
+else
+PAGE_FRAG_WARNING = "missing page_frag_cache.h, please use a newer kernel"
+endif
+else
+PAGE_FRAG_WARNING = "missing Module.symvers, please have the kernel built first"
+endif
TEST_GEN_FILES = cow
TEST_GEN_FILES += compaction_test
@@ -214,3 +223,12 @@ warn_missing_liburing:
echo "Warning: missing liburing support. Some tests will be skipped." ; \
echo
endif
+
+ifneq ($(PAGE_FRAG_WARNING),)
+all: warn_missing_page_frag
+
+warn_missing_page_frag:
+ @echo ; \
+ echo "Warning: $(PAGE_FRAG_WARNING). page_frag test will be skipped." ; \
+ echo
+endif
diff --git a/tools/testing/selftests/mm/page_frag/Makefile b/tools/testing/selftests/mm/page_frag/Makefile
index 58dda74d50a3..8c8bb39ffa28 100644
--- a/tools/testing/selftests/mm/page_frag/Makefile
+++ b/tools/testing/selftests/mm/page_frag/Makefile
@@ -1,5 +1,5 @@
PAGE_FRAG_TEST_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
-KDIR ?= $(abspath $(PAGE_FRAG_TEST_DIR)/../../../../..)
+KDIR ?= /lib/modules/$(shell uname -r)/build
ifeq ($(V),1)
Q =
--
2.33.0
The series of patches are for doing basic tests
of NIC driver. Test comprises checks for auto-negotiation,
speed, duplex state and throughput between local NIC and
partner. Tools such as ethtool, iperf3 are used.
Signed-off-by: Mohan Prasad J <mohan.prasad(a)microchip.com>
---
Changes in v4:
- Type hints are added for arguments and return types.
- Test values can be modified through command line.
- Minor code improvements.
- GenerateTraffic class extended for throughput test.
- Protocol testcases separated.
Changes in v3:
Link to v3: https://patchwork.kernel.org/project/netdevbpf/cover/20241016215014.401476-…
- LinkConfig class is included in the hw library. This contains
generic APIs for doing link layer operations.
- Auto-negotiation checks involve changing the auto-neg state
both in local and partner NIC.
- Link layer test and performance test are separated to
different selftest files.
- Resetting of NIC driver done after test completion.
Changes in v2:
Link to v2: https://patchwork.kernel.org/project/netdevbpf/cover/20240917023525.2571082…
- Changed the hardcoded implementation of speed, duplex states,
throughput to generic values, in order to support all type
of NIC drivers.
- Test executes based on the supported link modes between local
NIC driver and partner.
- Instead of lan743x directory, selftest file is now relocated
to /selftests/drivers/net/hw.
Link to v1: https://patchwork.kernel.org/project/netdevbpf/cover/20240903221549.1215842…
---
Mohan Prasad J (3):
selftests: nic_link_layer: Add link layer selftest for NIC driver
selftests: nic_link_layer: Add selftest case for speed and duplex
states
selftests: nic_performance: Add selftest for performance of NIC driver
.../testing/selftests/drivers/net/hw/Makefile | 6 +-
.../drivers/net/hw/lib/py/__init__.py | 1 +
.../drivers/net/hw/lib/py/linkconfig.py | 222 ++++++++++++++++++
.../drivers/net/hw/nic_link_layer.py | 113 +++++++++
.../drivers/net/hw/nic_performance.py | 137 +++++++++++
.../selftests/drivers/net/lib/py/load.py | 20 +-
6 files changed, 496 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/drivers/net/hw/lib/py/linkconfig.py
create mode 100644 tools/testing/selftests/drivers/net/hw/nic_link_layer.py
create mode 100644 tools/testing/selftests/drivers/net/hw/nic_performance.py
--
2.43.0
Hello,
this new series aims to migrate test_flow_dissector.sh into test_progs.
There are 2 "main" parts in test_flow_dissector.sh:
- a set of tests checking flow_dissector programs attachment to either
root namespace or non-root namespace
- dissection test
The first set is integrated in flow_dissector.c, which already contains
some existing tests for flow_dissector programs. This series uses the
opportunity to update a bit this file (use new assert, re-split tests,
etc)
The second part is migrated into a new file under test_progs,
flow_dissector_classification.c. It uses the same eBPF programs as
flow_dissector.c, but the difference is rather about how those program
are executed:
- flow_dissector.c manually runs programs with BPF_PROG_RUN
- flow_dissector_classification.c sends real packets to be dissected, and
so it also executes kernel code related to eBPF flow dissector (eg:
__skb_flow_bpf_to_target)
---
Changes in v2:
- allow tests to run in parallel
- move some generic helpers to network_helpers.h
- define proper function for ASSERT_MEMEQ
- fetch acked-by tags
- Link to v1: https://lore.kernel.org/r/20241113-flow_dissector-v1-0-27c4df0592dc@bootlin…
---
Alexis Lothoré (eBPF Foundation) (13):
selftests/bpf: add a macro to compare raw memory
selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys
selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test
selftests/bpf: re-split main function into dedicated tests
selftests/bpf: expose all subtests from flow_dissector
selftests/bpf: add gre packets testing to flow_dissector
selftests/bpf: migrate flow_dissector namespace exclusivity test
selftests/bpf: Enable generic tc actions in selftests config
selftests/bpf: move ip checksum helper to network helpers
selftests/bpf: rename pseudo headers checksum computation
selftests/bpf: add network helpers to generate udp checksums
selftests/bpf: migrate bpf flow dissectors tests to test_progs
selftests/bpf: remove test_flow_dissector.sh
tools/testing/selftests/bpf/.gitignore | 1 -
tools/testing/selftests/bpf/Makefile | 3 +-
tools/testing/selftests/bpf/config | 1 +
tools/testing/selftests/bpf/network_helpers.h | 64 +-
.../selftests/bpf/prog_tests/flow_dissector.c | 323 +++++++--
.../bpf/prog_tests/flow_dissector_classification.c | 807 +++++++++++++++++++++
.../selftests/bpf/prog_tests/xdp_metadata.c | 24 +-
tools/testing/selftests/bpf/test_flow_dissector.c | 780 --------------------
tools/testing/selftests/bpf/test_flow_dissector.sh | 178 -----
tools/testing/selftests/bpf/test_progs.c | 15 +
tools/testing/selftests/bpf/test_progs.h | 15 +
tools/testing/selftests/bpf/xdp_hw_metadata.c | 12 +-
12 files changed, 1153 insertions(+), 1070 deletions(-)
---
base-commit: 9e71d50d3befb93a6394b0979f8ebd0dc9bd8d0f
change-id: 20241019-flow_dissector-3eb0c07fc163
Best regards,
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Currently the temporary address is not removed when mngtmpaddr is deleted
or becomes unmanaged. The patch set fixed this issue and add a related
test.
Hangbin Liu (2):
net/ipv6: delete temporary address if mngtmpaddr is removed or
un-mngtmpaddr
selftests/rtnetlink.sh: add mngtempaddr test
net/ipv6/addrconf.c | 5 ++
tools/testing/selftests/net/rtnetlink.sh | 89 ++++++++++++++++++++++++
2 files changed, 94 insertions(+)
--
2.46.0
1. fix recursive lock when ebpf prog return SK_PASS.
2. add selftest to reproduce recursive lock.
Note that the test code can reproduce the 'dead-lock' and if just
the selftest merged without first patch, the test case will
definitely fail, because the issue of deadlock is inevitable.
---
v2->v4: fix line length reported by patchwork and remove unused code.
(max_line_length is set to 80 in patchwork but default is 100 in kernel tree)
v1->v2: 1.inspired by martin.lau to add selftest to reproduce the issue.
2. follow the community rules for patch.
v1: https://lore.kernel.org/bpf/55fc6114-7e64-4b65-86d2-92cfd1e9e92f@linux.dev/…
---
Jiayuan Chen (2):
bpf: fix recursive lock when verdict program return SK_PASS
selftests/bpf: Add some tests with sockmap SK_PASS
net/core/skmsg.c | 4 +-
.../selftests/bpf/prog_tests/sockmap_basic.c | 54 +++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)
--
2.43.5
sizeof when applied to a pointer typed expression gives the size of
the pointer.
tools/testing/selftests/bpf/progs/test_tunnel_kern.c:678:41-47: ERROR: application of sizeof to pointer
The proper fix in this particular case is to code sizeof(*gopt)
instead of sizeof(gopt).
This issue was detected with the help of Coccinelle.
Fixes: 5ddafcc377f9 ("selftests/bpf: Fix a few tests for GCC related warnings.")
Signed-off-by: guanjing <guanjing(a)cmss.chinamobile.com>
---
tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
index 32127f1cd687..3a437cdc5c15 100644
--- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
@@ -675,7 +675,7 @@ int ip6geneve_set_tunnel(struct __sk_buff *skb)
gopt->length = 2; /* 4-byte multiple */
*(int *) &gopt->opt_data = bpf_htonl(0xfeedbeef);
- ret = bpf_skb_set_tunnel_opt(skb, gopt, sizeof(gopt));
+ ret = bpf_skb_set_tunnel_opt(skb, gopt, sizeof(*gopt));
if (ret < 0) {
log_err(ret);
return TC_ACT_SHOT;
--
2.33.0