🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Arnd Bergmann Fri, 13 Nov 2026 10:11
[PATCH] net: kunit: move struct net_devmem_dmabuf_binding off stack
#15755
Author: Arnd Bergmann
Date: Fri, 13 Nov 2026 10:11
127 lines
12112 bytes
From: Arnd Bergmann <arnd@arndb.de>

The net_devmem_dmabuf_binding structure is really way too big to
live on the stack, and causes warnings on my randconfig build machine
with a reasonable per-function limit:

net/core/net_test.c: In function 'netmem_ref_test_tcp_devmem_recv':
net/core/net_test.c:1720:1: error: the frame size of 1744 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
 1720 | }
      | ^
net/core/net_test.c: In function 'netmem_ref_test_skb_segment':
net/core/net_test.c:1477:1: error: the frame size of 1584 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]

Since the binding object is never used concurrently in multiple tests,
avoid this by just having a global copy of it and reinitializing it
for every user.

Fixes: 2285346afc99 ("net: kunit: test netmem, page_pool, and skb frag refcounting")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I don't particularly like this workaround, as global variables are
always hacky like this. If anyone has a better idea to avoid the
last stack structure, let's do that instead.

Without the patch, I run into this every few randconfig builds,
which did not happen on linux-next before the merge window.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/core/net_test.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/core/net_test.c b/net/core/net_test.c
index 976d14896251..19f422300d9c 100644
--- a/net/core/net_test.c
+++ b/net/core/net_test.c
@@ -984,13 +984,14 @@ static void netmem_ref_test_pp_page(struct kunit *test)
 #endif
 
 #if defined(CONFIG_PAGE_POOL) && defined(CONFIG_NET_DEVMEM)
+static struct net_devmem_dmabuf_binding binding;
+
 static void dummy_percpu_ref_release(struct percpu_ref *ref)
 {
 }
 
 static void netmem_ref_test_net_iov(struct kunit *test)
 {
-	struct net_devmem_dmabuf_binding binding = {};
 	struct page_pool_params pp_params = {
 		.order = 0,
 		.pool_size = 4,
@@ -1003,6 +1004,7 @@ static void netmem_ref_test_net_iov(struct kunit *test)
 	long base_ref;
 	int err;
 
+	memset(&binding, 0, sizeof(binding));
 	err = percpu_ref_init(&binding.ref, dummy_percpu_ref_release,
 			      PERCPU_REF_INIT_ATOMIC, GFP_KERNEL);
 	KUNIT_ASSERT_EQ(test, err, 0);
@@ -1145,7 +1147,6 @@ static void netmem_ref_test_release_data(struct kunit *test)
 		.nid = NUMA_NO_NODE,
 	};
 	struct sk_buff *skb, *clone1, *clone2, *ext;
-	struct net_devmem_dmabuf_binding binding = {};
 	struct net_iov niov = {};
 	struct page_pool *pool;
 	struct page *page;
@@ -1154,6 +1155,7 @@ static void netmem_ref_test_release_data(struct kunit *test)
 	int base_ref;
 	int i;
 
+	memset(&binding, 0, sizeof(binding));
 	pool = page_pool_create(&pp_params);
 	KUNIT_ASSERT_FALSE(test, IS_ERR(pool));
 	page = page_pool_dev_alloc_pages(pool);
@@ -1335,7 +1337,6 @@ static void netmem_ref_test_skb_segment(struct kunit *test)
 		.flags = SKBFL_ZEROCOPY_ENABLE,
 	};
 	struct sk_buff *head, *list, *segs, *seg;
-	struct net_devmem_dmabuf_binding binding = {};
 	struct net_iov niov = {};
 	struct page *pp_page, *reg_page;
 	netmem_ref pp_nm, niov_nm;
@@ -1343,6 +1344,7 @@ static void netmem_ref_test_skb_segment(struct kunit *test)
 	long base_pp_ref, base_iov_ref;
 	int base_pp_page_ref, base_reg_ref;
 
+	memset(&binding, 0, sizeof(binding));
 	pool = page_pool_create(&pp_params);
 	KUNIT_ASSERT_FALSE(test, IS_ERR(pool));
 	pp_page = page_pool_dev_alloc_pages(pool);
@@ -1634,7 +1636,6 @@ static void netmem_ref_test_try_coalesce(struct kunit *test)
 		.nid = NUMA_NO_NODE,
 	};
 	struct sk_buff *to, *from, *clone;
-	struct net_devmem_dmabuf_binding binding = {};
 	struct net_iov niov = {};
 	struct page *pp_page, *reg_page;
 	netmem_ref pp_nm, niov_nm;
@@ -1644,6 +1645,7 @@ static void netmem_ref_test_try_coalesce(struct kunit *test)
 	bool fragstolen;
 	int delta;
 
+	memset(&binding, 0, sizeof(binding));
 	pool = page_pool_create(&pp_params);
 	KUNIT_ASSERT_FALSE(test, IS_ERR(pool));
 	pp_page = page_pool_dev_alloc_pages(pool);
@@ -1766,7 +1768,6 @@ static void netmem_ref_test_tcp_devmem_recv(struct kunit *test)
 		.pool_size = 4,
 		.nid = NUMA_NO_NODE,
 	};
-	struct net_devmem_dmabuf_binding binding = {};
 	struct msghdr msg = {};
 	struct dmabuf_token token;
 	struct dmabuf_cmsg *cmsg;
@@ -1780,6 +1781,7 @@ static void netmem_ref_test_tcp_devmem_recv(struct kunit *test)
 	long base_iov_ref;
 	int ret;
 
+	memset(&binding, 0, sizeof(binding));
 	KUNIT_ASSERT_EQ(test,
 			sock_create_kern(&init_net, AF_INET, SOCK_STREAM,
 					 IPPROTO_TCP, &sock),
-- 
2.53.0
Re: [PATCH] net: kunit: move struct net_devmem_dmabuf_binding off stack
#17520
Author: patchwork-bot+netdevbpf
Date: Tue, 17 Nov 2026 00:00
30 lines
9028 bytes
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 13 Nov 2026 11:11:00 +0100 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The net_devmem_dmabuf_binding structure is really way too big to
> live on the stack, and causes warnings on my randconfig build machine
> with a reasonable per-function limit:
> 
> net/core/net_test.c: In function 'netmem_ref_test_tcp_devmem_recv':
> net/core/net_test.c:1720:1: error: the frame size of 1744 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
>  1720 | }
>       | ^
> net/core/net_test.c: In function 'netmem_ref_test_skb_segment':
> net/core/net_test.c:1477:1: error: the frame size of 1584 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
> 
> [...]

Here is the summary with links:
  - net: kunit: move struct net_devmem_dmabuf_binding off stack
    https://git.kernel.org/netdev/net/c/271884902742

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads