Thread (13 messages) 13 messages, 3 authors, 4d ago

RE: [PATCH net-next v2 6/6] net: kunit: test netmem, page_pool, and skb frag refcounting

flat view

From: Loktionov, Aleksandr <hidden>
Date: 2026-10-14 10:47:33
Also in: bpf, linux-rdma, lkml

quoted hunk ↗ jump to hunk
-----Original Message-----
From: Mina Almasry <redacted>
Sent: Monday, October 12, 2026 10:22 AM
To: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
rdma@vger.kernel.org; bpf@vger.kernel.org
Cc: Mina Almasry <redacted>; Ayush Sawal
[off-list ref]; Andrew Lunn [off-list ref]; David S.
Miller [off-list ref]; Eric Dumazet [off-list ref]; Jakub
Kicinski [off-list ref]; Paolo Abeni [off-list ref]; Tariq
Toukan [off-list ref]; Simon Horman [off-list ref]; Steffen
Klassert [off-list ref]; Herbert Xu
[off-list ref]; Neal Cardwell [off-list ref];
Kuniyuki Iwashima [off-list ref]; John Fastabend
[off-list ref]; Sabrina Dubroca [off-list ref]; Eric
Biggers [off-list ref]; Kees Cook [off-list ref]; Loktionov,
Aleksandr [off-list ref]; Uwe Kleine-König (The Capable
Hub) [off-list ref]; Jijie Shao [off-list ref];
Michael Grzeschik [off-list ref]; Jakub Raczynski
[off-list ref]
Subject: [PATCH net-next v2 6/6] net: kunit: test netmem, page_pool, and
skb frag refcounting

Verify that non-pp (page._refcount / binding->ref) and page_pool
(pp_ref_count) references stay balanced without cross-counter leaks or
underflows across regular pages, page_pool pages, non-pp net_iovs, and
page_pool net_iovs with both pp_recycle=0 and pp_recycle=1.

Cover get/put_net_iov(), get/put_netmem(), napi_pp_get/put_page(),
skb_netmem_ref/unref(), skb_frag_ref/unref(), pskb_copy(),
skb_zerocopy(), skb_shift(), skb_split(), skb_try_coalesce(),
skb_release_data() (clones, unclone ordering, pskb_extract(), and
skb_morph()), skb_segment(), and devmem tcp_recvmsg_dmabuf() /
SO_DEVMEM_DONTNEED.

Export skb_shift() via EXPORT_SYMBOL_IF_KUNIT() so the test links when
built as a module (CONFIG_NET_TEST=m).

Assisted-by: LLM
Signed-off-by: Mina Almasry <redacted>
---
v2:
- Export skb_shift() via EXPORT_SYMBOL_IF_KUNIT() to fix the
  CONFIG_NET_TEST=m modpost error reported by NIPA.
- Reset mac_header before skb_segment() and check skb_clone() results
  before reuse (Sashiko).
- Cover compound tail pages, skb_try_coalesce(), TCP devmem recvmsg and
  SO_DEVMEM_DONTNEED, skb_zerocopy() rollbacks, skb_split()/skb_shift()
  edge cases, and mixed pp_recycle frag_list GSO.
- Link to v1: https://lore.kernel.org/netdev/20261010083935.3274178-7-
almasrymina@google.com/
---
 net/core/net_test.c | 1204 +++++++++++++++++++++++++++++++++++++++++++
 net/core/skbuff.c   |    2 +
 2 files changed, 1206 insertions(+)
diff --git a/net/core/net_test.c b/net/core/net_test.c index
9c3a590865d26..6f21e6baf7fb3 100644
--- a/net/core/net_test.c
+++ b/net/core/net_test.c
@@ -370,10 +370,1213 @@ static void ip_tunnel_flags_test_run(struct
kunit *test)
 	KUNIT_ASSERT_TRUE(test, __ipt_flag_op(bitmap_equal, exp, out));
}
...
 /**
  * skb_prepare_seq_read - Prepare a sequential read of skb data
--
2.56.0.385.gd3acb90ef8-goog
Reviewed-by: Aleksandr Loktionov <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help