AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/08/01 09:48 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": [
    "DMA_SHARED_BUFFER",
    "PAGE_POOL"
  ],
  "FocusSymbols": [
    "netdev_nl_bind_rx_doit",
    "netdev_nl_bind_tx_doit",
    "net_devmem_bind_dmabuf",
    "net_devmem_bind_dmabuf_to_queue",
    "net_devmem_alloc_dmabuf",
    "net_devmem_free_dmabuf",
    "net_devmem_get_niov_at",
    "mp_dmabuf_devmem_init"
  ],
  "Reasoning": "The patch introduces support for configuring `rx-page-size` for devmem (DMABUF) in the networking subsystem. It modifies the netlink API (`NETDEV_CMD_BIND_RX`) to accept the new attribute and updates the core devmem logic to handle variable page sizes (`niov_shift`). These are functional changes in reachable core kernel logic and should be fuzzed.",
  "WorthFuzzing": true
}

1/1 2026/08/01 09:48 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 0ed679a0bf1eee5b0440862ceb5040cf8ac5164e\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sat Aug 1 09:48:28 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml\nindex 5f143da7458cf..3e3f03bd5c29b 100644\n--- a/Documentation/netlink/specs/netdev.yaml\n+++ b/Documentation/netlink/specs/netdev.yaml\n@@ -6,6 +6,14 @@ doc: \u003e-\n   netdev configuration over generic netlink.\n \n definitions:\n+  -\n+    type: const\n+    name: page-size\n+    # Dummy value, codegen needs a number. The real value comes from\n+    # the PAGE_SIZE macro in the header below.\n+    value: 0\n+    header: asm/page.h\n+    scope: kernel\n   -\n     type: flags\n     name: xdp-act\n@@ -598,6 +606,16 @@ attribute-sets:\n         type: u32\n         checks:\n           min: 1\n+      -\n+        name: rx-page-size\n+        doc: |\n+          Size in bytes of each device page the NIC writes into from the bound\n+          dmabuf. Must be a power of two and \u003e= PAGE_SIZE; defaults to\n+          PAGE_SIZE.\n+        type: u32\n+        checks:\n+          min: page-size\n+          max: u32-max\n \n operations:\n   list:\n@@ -812,6 +830,7 @@ operations:\n             - ifindex\n             - fd\n             - queues\n+            - rx-page-size\n         reply:\n           attributes:\n             - id\ndiff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h\nindex 2f3ab75e8cc0f..35ff083221c71 100644\n--- a/include/uapi/linux/netdev.h\n+++ b/include/uapi/linux/netdev.h\n@@ -219,6 +219,7 @@ enum {\n \tNETDEV_A_DMABUF_QUEUES,\n \tNETDEV_A_DMABUF_FD,\n \tNETDEV_A_DMABUF_ID,\n+\tNETDEV_A_DMABUF_RX_PAGE_SIZE,\n \n \t__NETDEV_A_DMABUF_MAX,\n \tNETDEV_A_DMABUF_MAX = (__NETDEV_A_DMABUF_MAX - 1)\ndiff --git a/net/core/devmem.c b/net/core/devmem.c\nindex 957d6b96216b3..b036f14cb23a1 100644\n--- a/net/core/devmem.c\n+++ b/net/core/devmem.c\n@@ -46,7 +46,7 @@ static dma_addr_t net_devmem_get_dma_addr(const struct net_iov *niov)\n \n \towner = net_devmem_iov_to_chunk_owner(niov);\n \treturn owner-\u003ebase_dma_addr +\n-\t       ((dma_addr_t)net_iov_idx(niov) \u003c\u003c PAGE_SHIFT);\n+\t       ((dma_addr_t)net_iov_idx(niov) \u003c\u003c owner-\u003ebinding-\u003eniov_shift);\n }\n \n static void net_devmem_dmabuf_binding_release(struct percpu_ref *ref)\n@@ -93,13 +93,14 @@ net_devmem_alloc_dmabuf(struct net_devmem_dmabuf_binding *binding)\n \tssize_t offset;\n \tssize_t index;\n \n-\tdma_addr = gen_pool_alloc_owner(binding-\u003echunk_pool, PAGE_SIZE,\n+\tdma_addr = gen_pool_alloc_owner(binding-\u003echunk_pool,\n+\t\t\t\t\t1UL \u003c\u003c binding-\u003eniov_shift,\n \t\t\t\t\t(void **)\u0026owner);\n \tif (!dma_addr)\n \t\treturn NULL;\n \n \toffset = dma_addr - owner-\u003ebase_dma_addr;\n-\tindex = offset / PAGE_SIZE;\n+\tindex = offset \u003e\u003e binding-\u003eniov_shift;\n \tniov = \u0026owner-\u003earea.niovs[index];\n \n \tniov-\u003edesc.pp_magic = 0;\n@@ -113,12 +114,13 @@ void net_devmem_free_dmabuf(struct net_iov *niov)\n {\n \tstruct net_devmem_dmabuf_binding *binding = net_devmem_iov_binding(niov);\n \tunsigned long dma_addr = net_devmem_get_dma_addr(niov);\n+\tsize_t niov_size = 1UL \u003c\u003c binding-\u003eniov_shift;\n \n \tif (WARN_ON(!gen_pool_has_addr(binding-\u003echunk_pool, dma_addr,\n-\t\t\t\t       PAGE_SIZE)))\n+\t\t\t\t       niov_size)))\n \t\treturn;\n \n-\tgen_pool_free(binding-\u003echunk_pool, dma_addr, PAGE_SIZE);\n+\tgen_pool_free(binding-\u003echunk_pool, dma_addr, niov_size);\n }\n \n void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)\n@@ -163,6 +165,9 @@ int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx,\n \tu32 xa_idx;\n \tint err;\n \n+\tif (binding-\u003eniov_shift != PAGE_SHIFT)\n+\t\tmp_params.rx_page_size = 1U \u003c\u003c binding-\u003eniov_shift;\n+\n \terr = netif_mp_open_rxq(dev, rxq_idx, \u0026mp_params, extack);\n \tif (err)\n \t\treturn err;\n@@ -184,10 +189,12 @@ struct net_devmem_dmabuf_binding *\n net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \t\t       struct device *dma_dev,\n \t\t       enum dma_data_direction direction,\n-\t\t       unsigned int dmabuf_fd, struct netdev_nl_sock *priv,\n+\t\t       unsigned int dmabuf_fd, unsigned int niov_shift,\n+\t\t       struct netdev_nl_sock *priv,\n \t\t       struct netlink_ext_ack *extack)\n {\n \tstruct net_devmem_dmabuf_binding *binding;\n+\tsize_t niov_size = 1UL \u003c\u003c niov_shift;\n \tstatic u32 id_alloc_next;\n \tstruct scatterlist *sg;\n \tstruct dma_buf *dmabuf;\n@@ -213,6 +220,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \n \tbinding-\u003edev = dev;\n \tbinding-\u003evdev = vdev;\n+\tbinding-\u003eniov_shift = niov_shift;\n \txa_init_flags(\u0026binding-\u003ebound_rxqs, XA_FLAGS_ALLOC);\n \n \terr = percpu_ref_init(\u0026binding-\u003eref,\n@@ -248,18 +256,14 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \t\t\tgoto err_unmap;\n \t\t}\n \t\tbinding-\u003etx_vec = kvmalloc_objs(struct net_iov *,\n-\t\t\t\t\t\tdmabuf-\u003esize / PAGE_SIZE);\n+\t\t\t\t\t\tdmabuf-\u003esize \u003e\u003e niov_shift);\n \t\tif (!binding-\u003etx_vec) {\n \t\t\terr = -ENOMEM;\n \t\t\tgoto err_unmap;\n \t\t}\n \t}\n \n-\t/* For simplicity we expect to make PAGE_SIZE allocations, but the\n-\t * binding can be much more flexible than that. We may be able to\n-\t * allocate MTU sized chunks here. Leave that for future work...\n-\t */\n-\tbinding-\u003echunk_pool = gen_pool_create(PAGE_SHIFT,\n+\tbinding-\u003echunk_pool = gen_pool_create(niov_shift,\n \t\t\t\t\t      dev_to_node(\u0026dev-\u003edev));\n \tif (!binding-\u003echunk_pool) {\n \t\terr = -ENOMEM;\n@@ -273,9 +277,12 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \t\tsize_t len = sg_dma_len(sg);\n \t\tstruct net_iov *niov;\n \n-\t\tif (!IS_ALIGNED(len, PAGE_SIZE)) {\n+\t\tif (!IS_ALIGNED(dma_addr, niov_size) ||\n+\t\t    !IS_ALIGNED(len, niov_size)) {\n \t\t\terr = -EINVAL;\n-\t\t\tNL_SET_ERR_MSG(extack, \"dma-buf SG length must be PAGE_SIZE aligned\");\n+\t\t\tNL_SET_ERR_MSG_FMT(extack,\n+\t\t\t\t\t   \"dmabuf sg entry (addr=%pad, len=%zu) not aligned to niov size %zu\",\n+\t\t\t\t\t   \u0026dma_addr, len, niov_size);\n \t\t\tgoto err_free_chunks;\n \t\t}\n \n@@ -288,7 +295,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \n \t\towner-\u003earea.base_virtual = virtual;\n \t\towner-\u003ebase_dma_addr = dma_addr;\n-\t\towner-\u003earea.num_niovs = len / PAGE_SIZE;\n+\t\towner-\u003earea.num_niovs = len \u003e\u003e niov_shift;\n \t\towner-\u003ebinding = binding;\n \n \t\terr = gen_pool_add_owner(binding-\u003echunk_pool, dma_addr,\n@@ -313,7 +320,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \t\t\tpage_pool_set_dma_addr_netmem(net_iov_to_netmem(niov),\n \t\t\t\t\t\t      net_devmem_get_dma_addr(niov));\n \t\t\tif (direction == DMA_TO_DEVICE)\n-\t\t\t\tbinding-\u003etx_vec[owner-\u003earea.base_virtual / PAGE_SIZE + i] = niov;\n+\t\t\t\tbinding-\u003etx_vec[(owner-\u003earea.base_virtual \u003e\u003e niov_shift) + i] = niov;\n \t\t}\n \n \t\tvirtual += len;\n@@ -430,13 +437,15 @@ struct net_iov *\n net_devmem_get_niov_at(struct net_devmem_dmabuf_binding *binding,\n \t\t       size_t virt_addr, size_t *off, size_t *size)\n {\n+\tsize_t niov_size = 1UL \u003c\u003c binding-\u003eniov_shift;\n+\n \tif (virt_addr \u003e= binding-\u003edmabuf-\u003esize)\n \t\treturn NULL;\n \n-\t*off = virt_addr % PAGE_SIZE;\n-\t*size = PAGE_SIZE - *off;\n+\t*off = virt_addr \u0026 (niov_size - 1);\n+\t*size = niov_size - *off;\n \n-\treturn binding-\u003etx_vec[virt_addr / PAGE_SIZE];\n+\treturn binding-\u003etx_vec[virt_addr \u003e\u003e binding-\u003eniov_shift];\n }\n \n /*** \"Dmabuf devmem memory provider\" ***/\n@@ -454,7 +463,7 @@ int mp_dmabuf_devmem_init(struct page_pool *pool)\n \tpool-\u003edma_sync = false;\n \tpool-\u003edma_sync_for_cpu = false;\n \n-\tif (pool-\u003ep.order != 0)\n+\tif (pool-\u003ep.order != binding-\u003eniov_shift - PAGE_SHIFT)\n \t\treturn -E2BIG;\n \n \tnet_devmem_dmabuf_binding_get(binding);\ndiff --git a/net/core/devmem.h b/net/core/devmem.h\nindex 3852a56036cb4..4a293a7d1149c 100644\n--- a/net/core/devmem.h\n+++ b/net/core/devmem.h\n@@ -71,6 +71,8 @@ struct net_devmem_dmabuf_binding {\n \t */\n \tstruct net_iov **tx_vec;\n \n+\tunsigned int niov_shift;\n+\n \tstruct work_struct unbind_w;\n };\n \n@@ -93,7 +95,8 @@ struct net_devmem_dmabuf_binding *\n net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \t\t       struct device *dma_dev,\n \t\t       enum dma_data_direction direction,\n-\t\t       unsigned int dmabuf_fd, struct netdev_nl_sock *priv,\n+\t\t       unsigned int dmabuf_fd, unsigned int niov_shift,\n+\t\t       struct netdev_nl_sock *priv,\n \t\t       struct netlink_ext_ack *extack);\n struct net_devmem_dmabuf_binding *net_devmem_lookup_dmabuf(u32 id);\n void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding);\n@@ -122,10 +125,11 @@ static inline u32 net_devmem_iov_binding_id(const struct net_iov *niov)\n \n static inline unsigned long net_iov_virtual_addr(const struct net_iov *niov)\n {\n-\tstruct net_iov_area *owner = net_iov_owner(niov);\n+\tstruct dmabuf_genpool_chunk_owner *co =\n+\t\tnet_devmem_iov_to_chunk_owner(niov);\n \n-\treturn owner-\u003ebase_virtual +\n-\t       ((unsigned long)net_iov_idx(niov) \u003c\u003c PAGE_SHIFT);\n+\treturn net_iov_owner(niov)-\u003ebase_virtual +\n+\t       ((unsigned long)net_iov_idx(niov) \u003c\u003c co-\u003ebinding-\u003eniov_shift);\n }\n \n static inline bool\n@@ -175,6 +179,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n \t\t       struct device *dma_dev,\n \t\t       enum dma_data_direction direction,\n \t\t       unsigned int dmabuf_fd,\n+\t\t       unsigned int niov_shift,\n \t\t       struct netdev_nl_sock *priv,\n \t\t       struct netlink_ext_ack *extack)\n {\ndiff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c\nindex d18c89b5a6c75..f83790341eae6 100644\n--- a/net/core/netdev-genl-gen.c\n+++ b/net/core/netdev-genl-gen.c\n@@ -11,6 +11,7 @@\n \n #include \u003cuapi/linux/netdev.h\u003e\n #include \u003cnet/netdev_netlink.h\u003e\n+#include \u003casm/page.h\u003e\n \n /* Integer value ranges */\n static const struct netlink_range_validation netdev_a_page_pool_id_range = {\n@@ -27,6 +28,11 @@ static const struct netlink_range_validation netdev_a_napi_defer_hard_irqs_range\n \t.max\t= S32_MAX,\n };\n \n+static const struct netlink_range_validation netdev_a_dmabuf_rx_page_size_range = {\n+\t.min\t= PAGE_SIZE,\n+\t.max\t= U32_MAX,\n+};\n+\n /* Common nested types */\n const struct nla_policy netdev_lease_nl_policy[NETDEV_A_LEASE_NETNS_ID + 1] = {\n \t[NETDEV_A_LEASE_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),\n@@ -106,10 +112,11 @@ static const struct nla_policy netdev_qstats_get_nl_policy[NETDEV_A_QSTATS_SCOPE\n };\n \n /* NETDEV_CMD_BIND_RX - do */\n-static const struct nla_policy netdev_bind_rx_nl_policy[NETDEV_A_DMABUF_FD + 1] = {\n+static const struct nla_policy netdev_bind_rx_nl_policy[NETDEV_A_DMABUF_RX_PAGE_SIZE + 1] = {\n \t[NETDEV_A_DMABUF_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),\n \t[NETDEV_A_DMABUF_FD] = { .type = NLA_U32, },\n \t[NETDEV_A_DMABUF_QUEUES] = NLA_POLICY_NESTED(netdev_queue_id_nl_policy),\n+\t[NETDEV_A_DMABUF_RX_PAGE_SIZE] = NLA_POLICY_FULL_RANGE(NLA_U32, \u0026netdev_a_dmabuf_rx_page_size_range),\n };\n \n /* NETDEV_CMD_NAPI_SET - do */\n@@ -219,7 +226,7 @@ static const struct genl_split_ops netdev_nl_ops[] = {\n \t\t.cmd\t\t= NETDEV_CMD_BIND_RX,\n \t\t.doit\t\t= netdev_nl_bind_rx_doit,\n \t\t.policy\t\t= netdev_bind_rx_nl_policy,\n-\t\t.maxattr\t= NETDEV_A_DMABUF_FD,\n+\t\t.maxattr\t= NETDEV_A_DMABUF_RX_PAGE_SIZE,\n \t\t.flags\t\t= GENL_UNS_ADMIN_PERM | GENL_CMD_CAP_DO,\n \t},\n \t{\ndiff --git a/net/core/netdev-genl-gen.h b/net/core/netdev-genl-gen.h\nindex d71b435d72c18..3fae88e8f5c50 100644\n--- a/net/core/netdev-genl-gen.h\n+++ b/net/core/netdev-genl-gen.h\n@@ -12,6 +12,7 @@\n \n #include \u003cuapi/linux/netdev.h\u003e\n #include \u003cnet/netdev_netlink.h\u003e\n+#include \u003casm/page.h\u003e\n \n /* Common nested types */\n extern const struct nla_policy netdev_lease_nl_policy[NETDEV_A_LEASE_NETNS_ID + 1];\ndiff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c\nindex c15d8d4ca1f8f..0eea4ee22f246 100644\n--- a/net/core/netdev-genl.c\n+++ b/net/core/netdev-genl.c\n@@ -1013,6 +1013,7 @@ netdev_nl_get_dma_dev(struct net_device *netdev, unsigned long *rxq_bitmap,\n int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)\n {\n \tstruct net_devmem_dmabuf_binding *binding;\n+\tunsigned int niov_shift = PAGE_SHIFT;\n \tu32 ifindex, dmabuf_fd, rxq_idx;\n \tstruct netdev_nl_sock *priv;\n \tstruct net_device *netdev;\n@@ -1030,6 +1031,18 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)\n \tifindex = nla_get_u32(info-\u003eattrs[NETDEV_A_DEV_IFINDEX]);\n \tdmabuf_fd = nla_get_u32(info-\u003eattrs[NETDEV_A_DMABUF_FD]);\n \n+\tif (info-\u003eattrs[NETDEV_A_DMABUF_RX_PAGE_SIZE]) {\n+\t\tu32 rx_page_size = nla_get_u32(info-\u003eattrs[NETDEV_A_DMABUF_RX_PAGE_SIZE]);\n+\n+\t\tif (!is_power_of_2(rx_page_size)) {\n+\t\t\tNL_SET_ERR_MSG_ATTR(info-\u003eextack,\n+\t\t\t\t\t    info-\u003eattrs[NETDEV_A_DMABUF_RX_PAGE_SIZE],\n+\t\t\t\t\t    \"rx-page-size must be a power of 2\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tniov_shift = ilog2(rx_page_size);\n+\t}\n+\n \tpriv = genl_sk_priv_get(\u0026netdev_nl_family, NETLINK_CB(skb).sk);\n \tif (IS_ERR(priv))\n \t\treturn PTR_ERR(priv);\n@@ -1080,7 +1093,8 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)\n \t}\n \n \tbinding = net_devmem_bind_dmabuf(netdev, NULL, dma_dev, DMA_FROM_DEVICE,\n-\t\t\t\t\t dmabuf_fd, priv, info-\u003eextack);\n+\t\t\t\t\t dmabuf_fd, niov_shift, priv,\n+\t\t\t\t\t info-\u003eextack);\n \tif (IS_ERR(binding)) {\n \t\terr = PTR_ERR(binding);\n \t\tgoto err_rxq_bitmap;\n@@ -1221,7 +1235,7 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)\n \tbinding = net_devmem_bind_dmabuf(bind_dev,\n \t\t\t\t\t bind_dev != netdev ? netdev : NULL,\n \t\t\t\t\t dma_dev, DMA_TO_DEVICE, dmabuf_fd,\n-\t\t\t\t\t priv, info-\u003eextack);\n+\t\t\t\t\t PAGE_SHIFT, priv, info-\u003eextack);\n \tif (IS_ERR(binding)) {\n \t\terr = PTR_ERR(binding);\n \t\tgoto err_unlock_bind_dev;\ndiff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h\nindex 2f3ab75e8cc0f..35ff083221c71 100644\n--- a/tools/include/uapi/linux/netdev.h\n+++ b/tools/include/uapi/linux/netdev.h\n@@ -219,6 +219,7 @@ enum {\n \tNETDEV_A_DMABUF_QUEUES,\n \tNETDEV_A_DMABUF_FD,\n \tNETDEV_A_DMABUF_ID,\n+\tNETDEV_A_DMABUF_RX_PAGE_SIZE,\n \n \t__NETDEV_A_DMABUF_MAX,\n \tNETDEV_A_DMABUF_MAX = (__NETDEV_A_DMABUF_MAX - 1)\ndiff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py\nindex 031cf9905f651..82c11ffc4add7 100755\n--- a/tools/testing/selftests/drivers/net/hw/devmem.py\n+++ b/tools/testing/selftests/drivers/net/hw/devmem.py\n@@ -2,7 +2,8 @@\n # SPDX-License-Identifier: GPL-2.0\n \n from os import path\n-from devmem_lib import setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds\n+from devmem_lib import (setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds,\n+                        run_rx_large_niov)\n from lib.py import ksft_run, ksft_exit, ksft_disruptive\n from lib.py import NetDrvEpEnv\n \n@@ -30,11 +31,17 @@ def check_rx_hds(cfg) -\u003e None:\n     run_rx_hds(cfg)\n \n \n+def check_rx_large_niov(cfg) -\u003e None:\n+    \"\"\"Run the devmem RX test with rx-page-size = 16 KiB.\"\"\"\n+    run_rx_large_niov(cfg)\n+\n+\n def main() -\u003e None:\n     \"\"\"Run the devmem test cases.\"\"\"\n     with NetDrvEpEnv(__file__) as cfg:\n         setup_test(cfg, path.abspath(path.dirname(__file__) + \"/ncdevmem\"))\n-        ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds],\n+        ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds,\n+                  check_rx_large_niov],\n                  args=(cfg,))\n     ksft_exit()\n \ndiff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py\nindex 0921ff03eb81c..cbe3a8e498239 100644\n--- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py\n+++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py\n@@ -1,6 +1,8 @@\n # SPDX-License-Identifier: GPL-2.0\n+# pylint: disable=invalid-name,too-many-arguments\n \"\"\"Shared helpers for devmem TCP selftests.\"\"\"\n \n+import os\n import re\n \n from lib.py import (bkg, cmd, defer, ethtool, rand_port, wait_port_listen,\n@@ -8,7 +10,15 @@ from lib.py import (bkg, cmd, defer, ethtool, rand_port, wait_port_listen,\n                     NetdevFamily)\n \n \n-def require_devmem(cfg):\n+def _is_aligned(value, alignment):\n+    \"\"\"Equivalent of the kernel IS_ALIGNED(value, alignment).\n+\n+    alignment must be a power of two.\n+    \"\"\"\n+    return (value \u0026 (alignment - 1)) == 0\n+\n+\n+def require_devmem(cfg, rx_page_size=0):\n     \"\"\"Probe ncdevmem on cfg.ifname and SKIP the test if devmem isn't supported.\"\"\"\n     if not hasattr(cfg, \"devmem_probed\"):\n         probe_command = f\"{cfg.bin_local} -f {cfg.ifname}\"\n@@ -18,6 +28,25 @@ def require_devmem(cfg):\n     if not cfg.devmem_supported:\n         raise KsftSkipEx(\"Test requires devmem support\")\n \n+    if rx_page_size \u003e 0:\n+        page_size = os.sysconf(\"SC_PAGE_SIZE\")\n+        if not _is_aligned(rx_page_size, page_size):\n+            raise KsftSkipEx(\n+                f\"rx-page-size={rx_page_size} is invalid for this platform \"\n+                f\"(must be a multiple of PAGE_SIZE={page_size})\")\n+\n+        if not hasattr(cfg, \"devmem_rx_page_size_probed\"):\n+            cfg.devmem_rx_page_size_probed = {}\n+\n+        if rx_page_size not in cfg.devmem_rx_page_size_probed:\n+            probe_command = f\"{cfg.bin_local} -f {cfg.ifname} -b {rx_page_size}\"\n+            cfg.devmem_rx_page_size_probed[rx_page_size] = \\\n+                cmd(probe_command, fail=False, shell=True).ret == 0\n+\n+        if not cfg.devmem_rx_page_size_probed[rx_page_size]:\n+            raise KsftSkipEx(\n+                f\"Test requires devmem rx-page-size={rx_page_size} support\")\n+\n \n def configure_nic(cfg):\n     \"\"\"Channels, rings, RSS, queue lease for netkit devmem.\"\"\"\n@@ -76,7 +105,8 @@ def set_flow_rule(cfg, port):\n     return int(re.search(r'ID (\\d+)', output).group(1))\n \n \n-def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False, flow_steer=False):\n+def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False, flow_steer=False,\n+                rx_page_size=0):\n     \"\"\"Build the ncdevmem RX listener command.\"\"\"\n     if hasattr(cfg, 'netns'):\n         flow_rule_id = set_flow_rule(cfg, port)\n@@ -96,6 +126,8 @@ def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False, flow_steer=False):\n         extras.append(\"-v 7\")\n     if fail_on_linear:\n         extras.append(\"-L\")\n+    if rx_page_size \u003e 0:\n+        extras.append(f\"-b {rx_page_size}\")\n \n     parts = [cfg.bin_local, \"-l\", f\"-f {ifname}\", f\"-s {addr}\",\n              f\"-p {port}\", *extras]\n@@ -202,6 +234,44 @@ def run_tx_chunks(cfg):\n     ksft_eq(socat.stdout.strip(), \"hello\\nworld\")\n \n \n+def _restore_nr_hugepages(hp_file, nr_hugepages):\n+    with open(hp_file, 'w', encoding='utf-8') as f:\n+        f.write(str(nr_hugepages))\n+\n+\n+def run_rx_large_niov(cfg):\n+    \"\"\"Run the devmem RX test with a large niov (rx-page-size \u003e PAGE_SIZE).\n+\n+    Sweep payload sizes that straddle the niov boundary: below, equal to,\n+    and above rx_page_size, to exercise sub-niov, exact-niov, and multi-niov\n+    RX paths.\n+    \"\"\"\n+    hp_file = \"/proc/sys/vm/nr_hugepages\"\n+    with open(hp_file, 'r+', encoding='utf-8') as f:\n+        nr_hugepages = int(f.read().strip())\n+        if nr_hugepages \u003c 64:\n+            f.seek(0)\n+            f.write(\"64\")\n+            defer(_restore_nr_hugepages, hp_file, nr_hugepages)\n+    require_devmem(cfg, rx_page_size=16384)\n+    configure_nic(cfg)\n+    netns = getattr(cfg, \"netns\", None)\n+\n+    for size in [1024, 4096, 8192, 16384, 32768, 65536]:\n+        port = rand_port()\n+        socat = socat_send(cfg, port)\n+        listen_cmd = ncdevmem_rx(cfg, port,\n+                                 flow_steer=not netns,\n+                                 rx_page_size=16384)\n+        data_pipe = (f\"yes $(echo -e \\x01\\x02\\x03\\x04\\x05\\x06) | \"\n+                     f\"head -c {size} | {socat}\")\n+        with bkg(listen_cmd, exit_wait=True, ns=netns) as ncdevmem:\n+            wait_port_listen(port, proto=\"tcp\", ns=netns)\n+            cmd(data_pipe, host=cfg.remote, shell=True)\n+        ksft_eq(ncdevmem.ret, 0,\n+                f\"large-niov failed for payload size {size}\")\n+\n+\n def run_rx_hds(cfg):\n     \"\"\"Run the HDS test by running devmem RX across a segment size sweep.\"\"\"\n     require_devmem(cfg)\ndiff --git a/tools/testing/selftests/drivers/net/hw/ncdevmem.c b/tools/testing/selftests/drivers/net/hw/ncdevmem.c\nindex ffe1d5c1fa4e1..918e3b51f3b8c 100644\n--- a/tools/testing/selftests/drivers/net/hw/ncdevmem.c\n+++ b/tools/testing/selftests/drivers/net/hw/ncdevmem.c\n@@ -40,6 +40,7 @@\n \n #include \u003clinux/uio.h\u003e\n #include \u003cstdarg.h\u003e\n+#include \u003cstdint.h\u003e\n #include \u003cstdio.h\u003e\n #include \u003cstdlib.h\u003e\n #include \u003cunistd.h\u003e\n@@ -61,6 +62,7 @@\n #include \u003csys/time.h\u003e\n \n #include \u003clinux/memfd.h\u003e\n+#include \u003csys/param.h\u003e\n #include \u003clinux/dma-buf.h\u003e\n #include \u003clinux/errqueue.h\u003e\n #include \u003clinux/udmabuf.h\u003e\n@@ -79,6 +81,7 @@\n #define PAGE_SHIFT 12\n #define TEST_PREFIX \"ncdevmem\"\n #define NUM_PAGES 16000\n+#define MB(x) ((x) \u003c\u003c 20)\n \n #ifndef MSG_SOCK_DEVMEM\n #define MSG_SOCK_DEVMEM 0x2000000\n@@ -100,6 +103,7 @@ static unsigned int dmabuf_id;\n static uint32_t tx_dmabuf_id;\n static int waittime_ms = 500;\n static bool fail_on_linear;\n+static uint32_t rx_page_size;\n \n /* System state loaded by current_config_load() */\n #define MAX_FLOWS\t8\n@@ -142,6 +146,7 @@ static struct memory_buffer *udmabuf_alloc(size_t size)\n {\n \tstruct udmabuf_create create;\n \tstruct memory_buffer *ctx;\n+\tunsigned int memfd_flags;\n \tint ret;\n \n \tctx = malloc(sizeof(*ctx));\n@@ -156,9 +161,14 @@ static struct memory_buffer *udmabuf_alloc(size_t size)\n \t\tgoto err_free_ctx;\n \t}\n \n-\tctx-\u003ememfd = memfd_create(\"udmabuf-test\", MFD_ALLOW_SEALING);\n+\tmemfd_flags = MFD_ALLOW_SEALING;\n+\tif (rx_page_size \u003e getpagesize())\n+\t\tmemfd_flags |= MFD_HUGETLB | MFD_HUGE_2MB;\n+\n+\tctx-\u003ememfd = memfd_create(\"udmabuf-test\", memfd_flags);\n \tif (ctx-\u003ememfd \u003c 0) {\n-\t\tpr_err(\"[skip,no-memfd]\");\n+\t\tpr_err(\"[skip,no-memfd%s]\",\n+\t\t       (memfd_flags \u0026 MFD_HUGETLB) ? \" (need hugepages)\" : \"\");\n \t\tgoto err_close_dev;\n \t}\n \n@@ -168,6 +178,11 @@ static struct memory_buffer *udmabuf_alloc(size_t size)\n \t\tgoto err_close_memfd;\n \t}\n \n+\tif (memfd_flags \u0026 MFD_HUGETLB) {\n+\t\tsize = roundup(size, MB(2));\n+\t\tctx-\u003esize = size;\n+\t}\n+\n \tret = ftruncate(ctx-\u003ememfd, size);\n \tif (ret == -1) {\n \t\tpr_err(\"[FAIL,memfd-truncate]\");\n@@ -699,6 +714,8 @@ static int bind_rx_queue(unsigned int ifindex, unsigned int dmabuf_fd,\n \tnetdev_bind_rx_req_set_ifindex(req, ifindex);\n \tnetdev_bind_rx_req_set_fd(req, dmabuf_fd);\n \t__netdev_bind_rx_req_set_queues(req, queues, n_queue_index);\n+\tif (rx_page_size)\n+\t\tnetdev_bind_rx_req_set_rx_page_size(req, rx_page_size);\n \n \trsp = netdev_bind_rx(*ys, req);\n \tif (!rsp) {\n@@ -1411,7 +1428,7 @@ int main(int argc, char *argv[])\n \tint is_server = 0, opt;\n \tint ret, err = 1;\n \n-\twhile ((opt = getopt(argc, argv, \"Lls:c:p:v:q:t:f:z:n\")) != -1) {\n+\twhile ((opt = getopt(argc, argv, \"Lls:c:p:v:q:t:f:z:nb:\")) != -1) {\n \t\tswitch (opt) {\n \t\tcase 'L':\n \t\t\tfail_on_linear = true;\n@@ -1446,6 +1463,19 @@ int main(int argc, char *argv[])\n \t\tcase 'n':\n \t\t\tskip_config = 1;\n \t\t\tbreak;\n+\t\tcase 'b': {\n+\t\t\tunsigned long val;\n+\n+\t\t\terrno = 0;\n+\t\t\tval = strtoul(optarg, NULL, 0);\n+\t\t\tif ((val == ULONG_MAX \u0026\u0026 errno == ERANGE) ||\n+\t\t\t    val \u003e UINT32_MAX) {\n+\t\t\t\tpr_err(\"invalid rx_page_size: %s\", optarg);\n+\t\t\t\treturn 1;\n+\t\t\t}\n+\t\t\trx_page_size = val;\n+\t\t\tbreak;\n+\t\t}\n \t\tcase '?':\n \t\t\tfprintf(stderr, \"unknown option: %c\\n\", optopt);\n \t\t\tbreak;\ndiff --git a/tools/testing/selftests/drivers/net/hw/nk_devmem.py b/tools/testing/selftests/drivers/net/hw/nk_devmem.py\nindex 300ed2a70ab44..61c6f31f01e51 100755\n--- a/tools/testing/selftests/drivers/net/hw/nk_devmem.py\n+++ b/tools/testing/selftests/drivers/net/hw/nk_devmem.py\n@@ -3,7 +3,8 @@\n \"\"\"Test devmem TCP with netkit.\"\"\"\n \n import os\n-from devmem_lib import setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds\n+from devmem_lib import (setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds,\n+                        run_rx_large_niov)\n from lib.py import ksft_run, ksft_exit, ksft_disruptive\n from lib.py import NetDrvContEnv\n \n@@ -31,6 +32,11 @@ def check_nk_rx_hds(cfg) -\u003e None:\n     run_rx_hds(cfg)\n \n \n+def check_nk_rx_large_niov(cfg) -\u003e None:\n+    \"\"\"Run the devmem RX large-niov test through netkit.\"\"\"\n+    run_rx_large_niov(cfg)\n+\n+\n def main() -\u003e None:\n     \"\"\"Run the netkit devmem test cases.\"\"\"\n     with NetDrvContEnv(__file__, rxqueues=2, primary_rx_redirect=True) as cfg:\n@@ -38,7 +44,7 @@ def main() -\u003e None:\n                    os.path.join(os.path.dirname(os.path.abspath(__file__)),\n                                 \"ncdevmem\"))\n         ksft_run([check_nk_rx, check_nk_tx, check_nk_tx_chunks,\n-                  check_nk_rx_hds], args=(cfg,))\n+                  check_nk_rx_hds, check_nk_rx_large_niov], args=(cfg,))\n     ksft_exit()\n \n \n"
}

2/1 2026/08/01 09:48 agent patch-evaluator
1m Model:
best-expensive

Args:
null

Results:
{
  "EnableConfigs": [
    "DMA_SHARED_BUFFER",
    "PAGE_POOL"
  ],
  "FocusSymbols": [
    "netdev_nl_bind_rx_doit",
    "netdev_nl_bind_tx_doit",
    "net_devmem_bind_dmabuf",
    "net_devmem_bind_dmabuf_to_queue",
    "net_devmem_alloc_dmabuf",
    "net_devmem_free_dmabuf",
    "net_devmem_get_niov_at",
    "mp_dmabuf_devmem_init"
  ],
  "Reasoning": "The patch introduces support for configuring `rx-page-size` for devmem (DMABUF) in the networking subsystem. It modifies the netlink API (`NETDEV_CMD_BIND_RX`) to accept the new attribute and updates the core devmem logic to handle variable page sizes (`niov_shift`). These are functional changes in reachable core kernel logic and should be fuzzed.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer.
Your job is to review a provided patch series and determine
if it makes functional changes to the kernel that should be fuzzed.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively
use your code access tools to examine the actual source code and confirm any assumptions.

Return WorthFuzzing=false if the patch only contains:
- Modifications to Documentation/, Kconfig files, or code comments.
- Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints.
- Changes to numeric constants or macros that do not functionally alter execution flow.
- Code paths that are impossible to reach in virtualized environments like GCE or QEMU,
  even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim).
- Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed,
  ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU.
- Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove)
  that are executed only during PCI hot-unplug or sysfs driver unbind operations.

If it modifies reachable core kernel logic, drivers, or architectures, use your code search
tools to verify the code can be executed, then return WorthFuzzing=true.

When returning WorthFuzzing=true, you MUST ALSO:
1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols.
   Avoid listing generic hot-path functions to prevent skewed test distributions.
   Prefer non-static, non-inlined API entrypoint functions over internal static helper functions
   (which are inlined by the compiler and do not have distinct symbol addresses).
2. Identify any specific CONFIG_ options required to properly test this new/modified feature.
   Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions.
   Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs
   needed for Kbuild to compile the code statically into vmlinux. List them in the EnableConfigs
   output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
For your convenience, here is the diff of the changes:
commit 0ed679a0bf1eee5b0440862ceb5040cf8ac5164e
Author: syz-cluster <triage@syzkaller.com>
Date:   Sat Aug 1 09:48:28 2026 +0000

    syz-cluster: applied patch under review

diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
index 5f143da7458cf..3e3f03bd5c29b 100644
--- a/Documentation/netlink/specs/netdev.yaml
+++ b/Documentation/netlink/specs/netdev.yaml
@@ -6,6 +6,14 @@ doc: >-
   netdev configuration over generic netlink.
 
 definitions:
+  -
+    type: const
+    name: page-size
+    # Dummy value, codegen needs a number. The real value comes from
+    # the PAGE_SIZE macro in the header below.
+    value: 0
+    header: asm/page.h
+    scope: kernel
   -
     type: flags
     name: xdp-act
@@ -598,6 +606,16 @@ attribute-sets:
         type: u32
         checks:
           min: 1
+      -
+        name: rx-page-size
+        doc: |
+          Size in bytes of each device page the NIC writes into from the bound
+          dmabuf. Must be a power of two and >= PAGE_SIZE; defaults to
+          PAGE_SIZE.
+        type: u32
+        checks:
+          min: page-size
+          max: u32-max
 
 operations:
   list:
@@ -812,6 +830,7 @@ operations:
             - ifindex
             - fd
             - queues
+            - rx-page-size
         reply:
           attributes:
             - id
diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
index 2f3ab75e8cc0f..35ff083221c71 100644
--- a/include/uapi/linux/netdev.h
+++ b/include/uapi/linux/netdev.h
@@ -219,6 +219,7 @@ enum {
 	NETDEV_A_DMABUF_QUEUES,
 	NETDEV_A_DMABUF_FD,
 	NETDEV_A_DMABUF_ID,
+	NETDEV_A_DMABUF_RX_PAGE_SIZE,
 
 	__NETDEV_A_DMABUF_MAX,
 	NETDEV_A_DMABUF_MAX = (__NETDEV_A_DMABUF_MAX - 1)
diff --git a/net/core/devmem.c b/net/core/devmem.c
index 957d6b96216b3..b036f14cb23a1 100644
--- a/net/core/devmem.c
+++ b/net/core/devmem.c
@@ -46,7 +46,7 @@ static dma_addr_t net_devmem_get_dma_addr(const struct net_iov *niov)
 
 	owner = net_devmem_iov_to_chunk_owner(niov);
 	return owner->base_dma_addr +
-	       ((dma_addr_t)net_iov_idx(niov) << PAGE_SHIFT);
+	       ((dma_addr_t)net_iov_idx(niov) << owner->binding->niov_shift);
 }
 
 static void net_devmem_dmabuf_binding_release(struct percpu_ref *ref)
@@ -93,13 +93,14 @@ net_devmem_alloc_dmabuf(struct net_devmem_dmabuf_binding *binding)
 	ssize_t offset;
 	ssize_t index;
 
-	dma_addr = gen_pool_alloc_owner(binding->chunk_pool, PAGE_SIZE,
+	dma_addr = gen_pool_alloc_owner(binding->chunk_pool,
+					1UL << binding->niov_shift,
 					(void **)&owner);
 	if (!dma_addr)
 		return NULL;
 
 	offset = dma_addr - owner->base_dma_addr;
-	index = offset / PAGE_SIZE;
+	index = offset >> binding->niov_shift;
 	niov = &owner->area.niovs[index];
 
 	niov->desc.pp_magic = 0;
@@ -113,12 +114,13 @@ void net_devmem_free_dmabuf(struct net_iov *niov)
 {
 	struct net_devmem_dmabuf_binding *binding = net_devmem_iov_binding(niov);
 	unsigned long dma_addr = net_devmem_get_dma_addr(niov);
+	size_t niov_size = 1UL << binding->niov_shift;
 
 	if (WARN_ON(!gen_pool_has_addr(binding->chunk_pool, dma_addr,
-				       PAGE_SIZE)))
+				       niov_size)))
 		return;
 
-	gen_pool_free(binding->chunk_pool, dma_addr, PAGE_SIZE);
+	gen_pool_free(binding->chunk_pool, dma_addr, niov_size);
 }
 
 void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)
@@ -163,6 +165,9 @@ int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx,
 	u32 xa_idx;
 	int err;
 
+	if (binding->niov_shift != PAGE_SHIFT)
+		mp_params.rx_page_size = 1U << binding->niov_shift;
+
 	err = netif_mp_open_rxq(dev, rxq_idx, &mp_params, extack);
 	if (err)
 		return err;
@@ -184,10 +189,12 @@ struct net_devmem_dmabuf_binding *
 net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 		       struct device *dma_dev,
 		       enum dma_data_direction direction,
-		       unsigned int dmabuf_fd, struct netdev_nl_sock *priv,
+		       unsigned int dmabuf_fd, unsigned int niov_shift,
+		       struct netdev_nl_sock *priv,
 		       struct netlink_ext_ack *extack)
 {
 	struct net_devmem_dmabuf_binding *binding;
+	size_t niov_size = 1UL << niov_shift;
 	static u32 id_alloc_next;
 	struct scatterlist *sg;
 	struct dma_buf *dmabuf;
@@ -213,6 +220,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 
 	binding->dev = dev;
 	binding->vdev = vdev;
+	binding->niov_shift = niov_shift;
 	xa_init_flags(&binding->bound_rxqs, XA_FLAGS_ALLOC);
 
 	err = percpu_ref_init(&binding->ref,
@@ -248,18 +256,14 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 			goto err_unmap;
 		}
 		binding->tx_vec = kvmalloc_objs(struct net_iov *,
-						dmabuf->size / PAGE_SIZE);
+						dmabuf->size >> niov_shift);
 		if (!binding->tx_vec) {
 			err = -ENOMEM;
 			goto err_unmap;
 		}
 	}
 
-	/* For simplicity we expect to make PAGE_SIZE allocations, but the
-	 * binding can be much more flexible than that. We may be able to
-	 * allocate MTU sized chunks here. Leave that for future work...
-	 */
-	binding->chunk_pool = gen_pool_create(PAGE_SHIFT,
+	binding->chunk_pool = gen_pool_create(niov_shift,
 					      dev_to_node(&dev->dev));
 	if (!binding->chunk_pool) {
 		err = -ENOMEM;
@@ -273,9 +277,12 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 		size_t len = sg_dma_len(sg);
 		struct net_iov *niov;
 
-		if (!IS_ALIGNED(len, PAGE_SIZE)) {
+		if (!IS_ALIGNED(dma_addr, niov_size) ||
+		    !IS_ALIGNED(len, niov_size)) {
 			err = -EINVAL;
-			NL_SET_ERR_MSG(extack, "dma-buf SG length must be PAGE_SIZE aligned");
+			NL_SET_ERR_MSG_FMT(extack,
+					   "dmabuf sg entry (addr=%pad, len=%zu) not aligned to niov size %zu",
+					   &dma_addr, len, niov_size);
 			goto err_free_chunks;
 		}
 
@@ -288,7 +295,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 
 		owner->area.base_virtual = virtual;
 		owner->base_dma_addr = dma_addr;
-		owner->area.num_niovs = len / PAGE_SIZE;
+		owner->area.num_niovs = len >> niov_shift;
 		owner->binding = binding;
 
 		err = gen_pool_add_owner(binding->chunk_pool, dma_addr,
@@ -313,7 +320,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 			page_pool_set_dma_addr_netmem(net_iov_to_netmem(niov),
 						      net_devmem_get_dma_addr(niov));
 			if (direction == DMA_TO_DEVICE)
-				binding->tx_vec[owner->area.base_virtual / PAGE_SIZE + i] = niov;
+				binding->tx_vec[(owner->area.base_virtual >> niov_shift) + i] = niov;
 		}
 
 		virtual += len;
@@ -430,13 +437,15 @@ struct net_iov *
 net_devmem_get_niov_at(struct net_devmem_dmabuf_binding *binding,
 		       size_t virt_addr, size_t *off, size_t *size)
 {
+	size_t niov_size = 1UL << binding->niov_shift;
+
 	if (virt_addr >= binding->dmabuf->size)
 		return NULL;
 
-	*off = virt_addr % PAGE_SIZE;
-	*size = PAGE_SIZE - *off;
+	*off = virt_addr & (niov_size - 1);
+	*size = niov_size - *off;
 
-	return binding->tx_vec[virt_addr / PAGE_SIZE];
+	return binding->tx_vec[virt_addr >> binding->niov_shift];
 }
 
 /*** "Dmabuf devmem memory provider" ***/
@@ -454,7 +463,7 @@ int mp_dmabuf_devmem_init(struct page_pool *pool)
 	pool->dma_sync = false;
 	pool->dma_sync_for_cpu = false;
 
-	if (pool->p.order != 0)
+	if (pool->p.order != binding->niov_shift - PAGE_SHIFT)
 		return -E2BIG;
 
 	net_devmem_dmabuf_binding_get(binding);
diff --git a/net/core/devmem.h b/net/core/devmem.h
index 3852a56036cb4..4a293a7d1149c 100644
--- a/net/core/devmem.h
+++ b/net/core/devmem.h
@@ -71,6 +71,8 @@ struct net_devmem_dmabuf_binding {
 	 */
 	struct net_iov **tx_vec;
 
+	unsigned int niov_shift;
+
 	struct work_struct unbind_w;
 };
 
@@ -93,7 +95,8 @@ struct net_devmem_dmabuf_binding *
 net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 		       struct device *dma_dev,
 		       enum dma_data_direction direction,
-		       unsigned int dmabuf_fd, struct netdev_nl_sock *priv,
+		       unsigned int dmabuf_fd, unsigned int niov_shift,
+		       struct netdev_nl_sock *priv,
 		       struct netlink_ext_ack *extack);
 struct net_devmem_dmabuf_binding *net_devmem_lookup_dmabuf(u32 id);
 void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding);
@@ -122,10 +125,11 @@ static inline u32 net_devmem_iov_binding_id(const struct net_iov *niov)
 
 static inline unsigned long net_iov_virtual_addr(const struct net_iov *niov)
 {
-	struct net_iov_area *owner = net_iov_owner(niov);
+	struct dmabuf_genpool_chunk_owner *co =
+		net_devmem_iov_to_chunk_owner(niov);
 
-	return owner->base_virtual +
-	       ((unsigned long)net_iov_idx(niov) << PAGE_SHIFT);
+	return net_iov_owner(niov)->base_virtual +
+	       ((unsigned long)net_iov_idx(niov) << co->binding->niov_shift);
 }
 
 static inline bool
@@ -175,6 +179,7 @@ net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,
 		       struct device *dma_dev,
 		       enum dma_data_direction direction,
 		       unsigned int dmabuf_fd,
+		       unsigned int niov_shift,
 		       struct netdev_nl_sock *priv,
 		       struct netlink_ext_ack *extack)
 {
diff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c
index d18c89b5a6c75..f83790341eae6 100644
--- a/net/core/netdev-genl-gen.c
+++ b/net/core/netdev-genl-gen.c
@@ -11,6 +11,7 @@
 
 #include <uapi/linux/netdev.h>
 #include <net/netdev_netlink.h>
+#include <asm/page.h>
 
 /* Integer value ranges */
 static const struct netlink_range_validation netdev_a_page_pool_id_range = {
@@ -27,6 +28,11 @@ static const struct netlink_range_validation netdev_a_napi_defer_hard_irqs_range
 	.max	= S32_MAX,
 };
 
+static const struct netlink_range_validation netdev_a_dmabuf_rx_page_size_range = {
+	.min	= PAGE_SIZE,
+	.max	= U32_MAX,
+};
+
 /* Common nested types */
 const struct nla_policy netdev_lease_nl_policy[NETDEV_A_LEASE_NETNS_ID + 1] = {
 	[NETDEV_A_LEASE_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
@@ -106,10 +112,11 @@ static const struct nla_policy netdev_qstats_get_nl_policy[NETDEV_A_QSTATS_SCOPE
 };
 
 /* NETDEV_CMD_BIND_RX - do */
-static const struct nla_policy netdev_bind_rx_nl_policy[NETDEV_A_DMABUF_FD + 1] = {
+static const struct nla_policy netdev_bind_rx_nl_policy[NETDEV_A_DMABUF_RX_PAGE_SIZE + 1] = {
 	[NETDEV_A_DMABUF_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
 	[NETDEV_A_DMABUF_FD] = { .type = NLA_U32, },
 	[NETDEV_A_DMABUF_QUEUES] = NLA_POLICY_NESTED(netdev_queue_id_nl_policy),
+	[NETDEV_A_DMABUF_RX_PAGE_SIZE] = NLA_POLICY_FULL_RANGE(NLA_U32, &netdev_a_dmabuf_rx_page_size_range),
 };
 
 /* NETDEV_CMD_NAPI_SET - do */
@@ -219,7 +226,7 @@ static const struct genl_split_ops netdev_nl_ops[] = {
 		.cmd		= NETDEV_CMD_BIND_RX,
 		.doit		= netdev_nl_bind_rx_doit,
 		.policy		= netdev_bind_rx_nl_policy,
-		.maxattr	= NETDEV_A_DMABUF_FD,
+		.maxattr	= NETDEV_A_DMABUF_RX_PAGE_SIZE,
 		.flags		= GENL_UNS_ADMIN_PERM | GENL_CMD_CAP_DO,
 	},
 	{
diff --git a/net/core/netdev-genl-gen.h b/net/core/netdev-genl-gen.h
index d71b435d72c18..3fae88e8f5c50 100644
--- a/net/core/netdev-genl-gen.h
+++ b/net/core/netdev-genl-gen.h
@@ -12,6 +12,7 @@
 
 #include <uapi/linux/netdev.h>
 #include <net/netdev_netlink.h>
+#include <asm/page.h>
 
 /* Common nested types */
 extern const struct nla_policy netdev_lease_nl_policy[NETDEV_A_LEASE_NETNS_ID + 1];
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index c15d8d4ca1f8f..0eea4ee22f246 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -1013,6 +1013,7 @@ netdev_nl_get_dma_dev(struct net_device *netdev, unsigned long *rxq_bitmap,
 int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
 {
 	struct net_devmem_dmabuf_binding *binding;
+	unsigned int niov_shift = PAGE_SHIFT;
 	u32 ifindex, dmabuf_fd, rxq_idx;
 	struct netdev_nl_sock *priv;
 	struct net_device *netdev;
@@ -1030,6 +1031,18 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
 	ifindex = nla_get_u32(info->attrs[NETDEV_A_DEV_IFINDEX]);
 	dmabuf_fd = nla_get_u32(info->attrs[NETDEV_A_DMABUF_FD]);
 
+	if (info->attrs[NETDEV_A_DMABUF_RX_PAGE_SIZE]) {
+		u32 rx_page_size = nla_get_u32(info->attrs[NETDEV_A_DMABUF_RX_PAGE_SIZE]);
+
+		if (!is_power_of_2(rx_page_size)) {
+			NL_SET_ERR_MSG_ATTR(info->extack,
+					    info->attrs[NETDEV_A_DMABUF_RX_PAGE_SIZE],
+					    "rx-page-size must be a power of 2");
+			return -EINVAL;
+		}
+		niov_shift = ilog2(rx_page_size);
+	}
+
 	priv = genl_sk_priv_get(&netdev_nl_family, NETLINK_CB(skb).sk);
 	if (IS_ERR(priv))
 		return PTR_ERR(priv);
@@ -1080,7 +1093,8 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	binding = net_devmem_bind_dmabuf(netdev, NULL, dma_dev, DMA_FROM_DEVICE,
-					 dmabuf_fd, priv, info->extack);
+					 dmabuf_fd, niov_shift, priv,
+					 info->extack);
 	if (IS_ERR(binding)) {
 		err = PTR_ERR(binding);
 		goto err_rxq_bitmap;
@@ -1221,7 +1235,7 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)
 	binding = net_devmem_bind_dmabuf(bind_dev,
 					 bind_dev != netdev ? netdev : NULL,
 					 dma_dev, DMA_TO_DEVICE, dmabuf_fd,
-					 priv, info->extack);
+					 PAGE_SHIFT, priv, info->extack);
 	if (IS_ERR(binding)) {
 		err = PTR_ERR(binding);
 		goto err_unlock_bind_dev;
diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h
index 2f3ab75e8cc0f..35ff083221c71 100644
--- a/tools/include/uapi/linux/netdev.h
+++ b/tools/include/uapi/linux/netdev.h
@@ -219,6 +219,7 @@ enum {
 	NETDEV_A_DMABUF_QUEUES,
 	NETDEV_A_DMABUF_FD,
 	NETDEV_A_DMABUF_ID,
+	NETDEV_A_DMABUF_RX_PAGE_SIZE,
 
 	__NETDEV_A_DMABUF_MAX,
 	NETDEV_A_DMABUF_MAX = (__NETDEV_A_DMABUF_MAX - 1)
diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py
index 031cf9905f651..82c11ffc4add7 100755
--- a/tools/testing/selftests/drivers/net/hw/devmem.py
+++ b/tools/testing/selftests/drivers/net/hw/devmem.py
@@ -2,7 +2,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
 from os import path
-from devmem_lib import setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds
+from devmem_lib import (setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds,
+                        run_rx_large_niov)
 from lib.py import ksft_run, ksft_exit, ksft_disruptive
 from lib.py import NetDrvEpEnv
 
@@ -30,11 +31,17 @@ def check_rx_hds(cfg) -> None:
     run_rx_hds(cfg)
 
 
+def check_rx_large_niov(cfg) -> None:
+    """Run the devmem RX test with rx-page-size = 16 KiB."""
+    run_rx_large_niov(cfg)
+
+
 def main() -> None:
     """Run the devmem test cases."""
     with NetDrvEpEnv(__file__) as cfg:
         setup_test(cfg, path.abspath(path.dirname(__file__) + "/ncdevmem"))
-        ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds],
+        ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds,
+                  check_rx_large_niov],
                  args=(cfg,))
     ksft_exit()
 
diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
index 0921ff03eb81c..cbe3a8e498239 100644
--- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
+++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
+# pylint: disable=invalid-name,too-many-arguments
 """Shared helpers for devmem TCP selftests."""
 
+import os
 import re
 
 from lib.py import (bkg, cmd, defer, ethtool, rand_port, wait_port_listen,
@@ -8,7 +10,15 @@ from lib.py import (bkg, cmd, defer, ethtool, rand_port, wait_port_listen,
                     NetdevFamily)
 
 
-def require_devmem(cfg):
+def _is_aligned(value, alignment):
+    """Equivalent of the kernel IS_ALIGNED(value, alignment).
+
+    alignment must be a power of two.
+    """
+    return (value & (alignment - 1)) == 0
+
+
+def require_devmem(cfg, rx_page_size=0):
     """Probe ncdevmem on cfg.ifname and SKIP the test if devmem isn't supported."""
     if not hasattr(cfg, "devmem_probed"):
         probe_command = f"{cfg.bin_local} -f {cfg.ifname}"
@@ -18,6 +28,25 @@ def require_devmem(cfg):
     if not cfg.devmem_supported:
         raise KsftSkipEx("Test requires devmem support")
 
+    if rx_page_size > 0:
+        page_size = os.sysconf("SC_PAGE_SIZE")
+        if not _is_aligned(rx_page_size, page_size):
+            raise KsftSkipEx(
+                f"rx-page-size={rx_page_size} is invalid for this platform "
+                f"(must be a multiple of PAGE_SIZE={page_size})")
+
+        if not hasattr(cfg, "devmem_rx_page_size_probed"):
+            cfg.devmem_rx_page_size_probed = {}
+
+        if rx_page_size not in cfg.devmem_rx_page_size_probed:
+            probe_command = f"{cfg.bin_local} -f {cfg.ifname} -b {rx_page_size}"
+            cfg.devmem_rx_page_size_probed[rx_page_size] = \
+                cmd(probe_command, fail=False, shell=True).ret == 0
+
+        if not cfg.devmem_rx_page_size_probed[rx_page_size]:
+            raise KsftSkipEx(
+                f"Test requires devmem rx-page-size={rx_page_size} support")
+
 
 def configure_nic(cfg):
     """Channels, rings, RSS, queue lease for netkit devmem."""
@@ -76,7 +105,8 @@ def set_flow_rule(cfg, port):
     return int(re.search(r'ID (\d+)', output).group(1))
 
 
-def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False, flow_steer=False):
+def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False, flow_steer=False,
+                rx_page_size=0):
     """Build the ncdevmem RX listener command."""
     if hasattr(cfg, 'netns'):
         flow_rule_id = set_flow_rule(cfg, port)
@@ -96,6 +126,8 @@ def ncdevmem_rx(cfg, port, verify=True, fail_on_linear=False, flow_steer=False):
         extras.append("-v 7")
     if fail_on_linear:
         extras.append("-L")
+    if rx_page_size > 0:
+        extras.append(f"-b {rx_page_size}")
 
     parts = [cfg.bin_local, "-l", f"-f {ifname}", f"-s {addr}",
              f"-p {port}", *extras]
@@ -202,6 +234,44 @@ def run_tx_chunks(cfg):
     ksft_eq(socat.stdout.strip(), "hello\nworld")
 
 
+def _restore_nr_hugepages(hp_file, nr_hugepages):
+    with open(hp_file, 'w', encoding='utf-8') as f:
+        f.write(str(nr_hugepages))
+
+
+def run_rx_large_niov(cfg):
+    """Run the devmem RX test with a large niov (rx-page-size > PAGE_SIZE).
+
+    Sweep payload sizes that straddle the niov boundary: below, equal to,
+    and above rx_page_size, to exercise sub-niov, exact-niov, and multi-niov
+    RX paths.
+    """
+    hp_file = "/proc/sys/vm/nr_hugepages"
+    with open(hp_file, 'r+', encoding='utf-8') as f:
+        nr_hugepages = int(f.read().strip())
+        if nr_hugepages < 64:
+            f.seek(0)
+            f.write("64")
+            defer(_restore_nr_hugepages, hp_file, nr_hugepages)
+    require_devmem(cfg, rx_page_size=16384)
+    configure_nic(cfg)
+    netns = getattr(cfg, "netns", None)
+
+    for size in [1024, 4096, 8192, 16384, 32768, 65536]:
+        port = rand_port()
+        socat = socat_send(cfg, port)
+        listen_cmd = ncdevmem_rx(cfg, port,
+                                 flow_steer=not netns,
+                                 rx_page_size=16384)
+        data_pipe = (f"yes $(echo -e \x01\x02\x03\x04\x05\x06) | "
+                     f"head -c {size} | {socat}")
+        with bkg(listen_cmd, exit_wait=True, ns=netns) as ncdevmem:
+            wait_port_listen(port, proto="tcp", ns=netns)
+            cmd(data_pipe, host=cfg.remote, shell=True)
+        ksft_eq(ncdevmem.ret, 0,
+                f"large-niov failed for payload size {size}")
+
+
 def run_rx_hds(cfg):
     """Run the HDS test by running devmem RX across a segment size sweep."""
     require_devmem(cfg)
diff --git a/tools/testing/selftests/drivers/net/hw/ncdevmem.c b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
index ffe1d5c1fa4e1..918e3b51f3b8c 100644
--- a/tools/testing/selftests/drivers/net/hw/ncdevmem.c
+++ b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
@@ -40,6 +40,7 @@
 
 #include <linux/uio.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -61,6 +62,7 @@
 #include <sys/time.h>
 
 #include <linux/memfd.h>
+#include <sys/param.h>
 #include <linux/dma-buf.h>
 #include <linux/errqueue.h>
 #include <linux/udmabuf.h>
@@ -79,6 +81,7 @@
 #define PAGE_SHIFT 12
 #define TEST_PREFIX "ncdevmem"
 #define NUM_PAGES 16000
+#define MB(x) ((x) << 20)
 
 #ifndef MSG_SOCK_DEVMEM
 #define MSG_SOCK_DEVMEM 0x2000000
@@ -100,6 +103,7 @@ static unsigned int dmabuf_id;
 static uint32_t tx_dmabuf_id;
 static int waittime_ms = 500;
 static bool fail_on_linear;
+static uint32_t rx_page_size;
 
 /* System state loaded by current_config_load() */
 #define MAX_FLOWS	8
@@ -142,6 +146,7 @@ static struct memory_buffer *udmabuf_alloc(size_t size)
 {
 	struct udmabuf_create create;
 	struct memory_buffer *ctx;
+	unsigned int memfd_flags;
 	int ret;
 
 	ctx = malloc(sizeof(*ctx));
@@ -156,9 +161,14 @@ static struct memory_buffer *udmabuf_alloc(size_t size)
 		goto err_free_ctx;
 	}
 
-	ctx->memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING);
+	memfd_flags = MFD_ALLOW_SEALING;
+	if (rx_page_size > getpagesize())
+		memfd_flags |= MFD_HUGETLB | MFD_HUGE_2MB;
+
+	ctx->memfd = memfd_create("udmabuf-test", memfd_flags);
 	if (ctx->memfd < 0) {
-		pr_err("[skip,no-memfd]");
+		pr_err("[skip,no-memfd%s]",
+		       (memfd_flags & MFD_HUGETLB) ? " (need hugepages)" : "");
 		goto err_close_dev;
 	}
 
@@ -168,6 +178,11 @@ static struct memory_buffer *udmabuf_alloc(size_t size)
 		goto err_close_memfd;
 	}
 
+	if (memfd_flags & MFD_HUGETLB) {
+		size = roundup(size, MB(2));
+		ctx->size = size;
+	}
+
 	ret = ftruncate(ctx->memfd, size);
 	if (ret == -1) {
 		pr_err("[FAIL,memfd-truncate]");
@@ -699,6 +714,8 @@ static int bind_rx_queue(unsigned int ifindex, unsigned int dmabuf_fd,
 	netdev_bind_rx_req_set_ifindex(req, ifindex);
 	netdev_bind_rx_req_set_fd(req, dmabuf_fd);
 	__netdev_bind_rx_req_set_queues(req, queues, n_queue_index);
+	if (rx_page_size)
+		netdev_bind_rx_req_set_rx_page_size(req, rx_page_size);
 
 	rsp = netdev_bind_rx(*ys, req);
 	if (!rsp) {
@@ -1411,7 +1428,7 @@ int main(int argc, char *argv[])
 	int is_server = 0, opt;
 	int ret, err = 1;
 
-	while ((opt = getopt(argc, argv, "Lls:c:p:v:q:t:f:z:n")) != -1) {
+	while ((opt = getopt(argc, argv, "Lls:c:p:v:q:t:f:z:nb:")) != -1) {
 		switch (opt) {
 		case 'L':
 			fail_on_linear = true;
@@ -1446,6 +1463,19 @@ int main(int argc, char *argv[])
 		case 'n':
 			skip_config = 1;
 			break;
+		case 'b': {
+			unsigned long val;
+
+			errno = 0;
+			val = strtoul(optarg, NULL, 0);
+			if ((val == ULONG_MAX && errno == ERANGE) ||
+			    val > UINT32_MAX) {
+				pr_err("invalid rx_page_size: %s", optarg);
+				return 1;
+			}
+			rx_page_size = val;
+			break;
+		}
 		case '?':
 			fprintf(stderr, "unknown option: %c\n", optopt);
 			break;
diff --git a/tools/testing/selftests/drivers/net/hw/nk_devmem.py b/tools/testing/selftests/drivers/net/hw/nk_devmem.py
index 300ed2a70ab44..61c6f31f01e51 100755
--- a/tools/testing/selftests/drivers/net/hw/nk_devmem.py
+++ b/tools/testing/selftests/drivers/net/hw/nk_devmem.py
@@ -3,7 +3,8 @@
 """Test devmem TCP with netkit."""
 
 import os
-from devmem_lib import setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds
+from devmem_lib import (setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds,
+                        run_rx_large_niov)
 from lib.py import ksft_run, ksft_exit, ksft_disruptive
 from lib.py import NetDrvContEnv
 
@@ -31,6 +32,11 @@ def check_nk_rx_hds(cfg) -> None:
     run_rx_hds(cfg)
 
 
+def check_nk_rx_large_niov(cfg) -> None:
+    """Run the devmem RX large-niov test through netkit."""
+    run_rx_large_niov(cfg)
+
+
 def main() -> None:
     """Run the netkit devmem test cases."""
     with NetDrvContEnv(__file__, rxqueues=2, primary_rx_redirect=True) as cfg:
@@ -38,7 +44,7 @@ def main() -> None:
                    os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                 "ncdevmem"))
         ksft_run([check_nk_rx, check_nk_tx, check_nk_tx_chunks,
-                  check_nk_rx_hds], args=(cfg,))
+                  check_nk_rx_hds, check_nk_rx_large_niov], args=(cfg,))
     ksft_exit()
 
 

3/2 2026/08/01 09:48 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 12048
							output: 20
							thoughts: 432
						

Thoughts:
**My Assessment of the Devmem Rx-Page-Size Patch Series**

Okay, so I'm looking at this patch series that introduces `rx-page-size` configuration for devmem (DMABUF) within the networking subsystem. My initial thought is to quickly assess the scope and implications. It touches quite a few files, spanning documentation, header files, the core devmem implementation, the netlink interface, and even selftests. The files are:
*   `Documentation/netlink/specs/netdev.yaml`
*   `include/uapi/linux/netdev.h`
*   `net/core/devmem.c`
*   `net/core/devmem.h`
*   `net/core/netdev-genl-gen.c`
*   `net/core/netdev-genl-gen.h`
*   `net/core/netdev-genl.c`
*   `tools/testing/selftests/drivers/net/hw/devmem.py`
*   `tools/testing/selftests/drivers/net/hw/devmem_lib.py`
*   `tools/testing/selftests/drivers/net/hw/ncdevmem.c`
*   `tools/testing/selftests/drivers/net/hw/nk_devmem.py`

Functionally, this is a core networking change. It looks like we're adding a new netlink attribute, `NETDEV_A_DMABUF_RX_PAGE_SIZE`, to `NETDEV_CMD_BIND_RX`. Good, that's the entry point. It also looks like it's updating the `net_devmem_bind_dmabuf`, `net_devmem_bind_dmabuf_to_queue`, `net_devmem_alloc_dmabuf`, `net_devmem_free_dmabuf` and `net_devmem_get_niov_at` functions to accommodate this new feature. These functions manage the core DMABUF operations, so this is where the meat of the change lies.

Now, I'm thinking about fuzzing and testing strategy. Is this even reachable and worth the effort? Yes, the change is reachable via netlink (`NETDEV_CMD_BIND_RX`), which means we can target it. We now need to check to make sure it is worth testing by confirming the dependencies of this feature. I need to make sure this is actually a viable feature. Is it related to `CONFIG_PAGE_POOL` and `CONFIG_NET_DEVMEM` or similar configuration options? Let me quickly check the Kconfig for devmem and confirm the dependencies.



4/2 2026/08/01 09:48 tool grepper
0m Args:
{
  "Expression": "config NET_DEVMEM"
}

Results:
{
  "Output": "net/Kconfig=66=config SKB_EXTENSIONS\n--\nnet/Kconfig-68-\nnet/Kconfig:69:config NET_DEVMEM\nnet/Kconfig-70-\tdef_bool y\n"
}

5/2 2026/08/01 09:48 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 13156
							output: 31
							thoughts: 27
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Investigating a Kernel Configuration Flag**

Okay, so I see `NET_DEVMEM` is defined as a `def_bool y`. That raises a flag. I need to understand why it's configured that way, and what the implications are. My first instinct is to immediately jump into the `net/Kconfig` file. That's the definitive source for the network subsystem's configuration options. I need to understand the logic behind the default setting and what dependencies or constraints it might have. This flag is important, and I need to fully understand its impact.



6/2 2026/08/01 09:48 tool read-file
0m Args:
{
  "File": "net/Kconfig",
  "FirstLine": 60,
  "LineCount": 20
}

Results:
{
  "Contents": "  60:\tconfig NET_REDIRECT\n  61:\t\tbool\n  62:\t\n  63:\tconfig SKB_DECRYPTED\n  64:\t\tbool\n  65:\t\n  66:\tconfig SKB_EXTENSIONS\n  67:\t\tbool\n  68:\t\n  69:\tconfig NET_DEVMEM\n  70:\t\tdef_bool y\n  71:\t\tselect GENERIC_ALLOCATOR\n  72:\t\tdepends on DMA_SHARED_BUFFER\n  73:\t\tdepends on PAGE_POOL\n  74:\t\n  75:\tconfig NET_SHAPER\n  76:\t\tbool\n  77:\t\n  78:\tconfig NET_CRC32C\n  79:\t\tbool\n"
}

7/2 2026/08/01 09:48 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 13547
							output: 20
							thoughts: 35
						

Thoughts:
Okay, here's my take on those thoughts, framed from an expert's perspective:

**Dependencies and Buffer Allocation: A Quick Check**

Right, so `NET_DEVMEM` is contingent on both `DMA_SHARED_BUFFER` and `PAGE_POOL`. That's standard practice, but it's always worth a quick sanity check to ensure the interdependencies are solid. Let's start with `DMA_SHARED_BUFFER`. I need to confirm its configuration and ensure it's functioning as expected, given its role as a shared resource that devmem leverages for DMA operations. Proper buffer allocation and management at this level is crucial to avoid any potential performance bottlenecks or, worse, memory corruption issues further down the line, especially with network device memory. Understanding its state and potential impact is the first step.



8/2 2026/08/01 09:48 tool grepper
0m Args:
{
  "Expression": "config DMA_SHARED_BUFFER"
}

Results:
{
  "Output": "drivers/base/Kconfig=213=source \"drivers/base/regmap/Kconfig\"\ndrivers/base/Kconfig-214-\ndrivers/base/Kconfig:215:config DMA_SHARED_BUFFER\ndrivers/base/Kconfig-216-\tbool\n"
}

9/2 2026/08/01 09:48 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 13852
							output: 18
							thoughts: 51
						

Thoughts:
Okay, let's break this down.

**Investigating the Role of `DMA_SHARED_BUFFER` and `PAGE_POOL`**

Alright, my immediate thought is to understand the impact of `DMA_SHARED_BUFFER`. Where is this boolean variable used? What code selects it, or depends on it? I need to trace its connections to fully grasp its function. Wait a minute, it's just a simple boolean! This is much easier than I initially anticipated. Since it's a bool, I can just include it directly within `EnableConfigs`. That's a clean and efficient approach. While I'm at it, I should investigate `PAGE_POOL`. That's also a boolean, isn't it? Okay, I'll treat it the same way and incorporate it into `EnableConfigs` as well.



10/2 2026/08/01 09:48 tool grepper
0m Args:
{
  "Expression": "config PAGE_POOL"
}

Results:
{
  "Output": "net/Kconfig=487=config NET_DEVLINK\n--\nnet/Kconfig-490-\nnet/Kconfig:491:config PAGE_POOL\nnet/Kconfig-492-\tbool\nnet/Kconfig-493-\nnet/Kconfig:494:config PAGE_POOL_STATS\nnet/Kconfig-495-\tdefault n\n"
}

11/2 2026/08/01 09:48 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 14200
							output: 24
							thoughts: 60
						

Thoughts:
**Kernel Configuration Considerations**

Okay, so we're looking at optimizing this kernel configuration, and the immediate thought is to enable `DMA_SHARED_BUFFER` and `PAGE_POOL`. That seems like a solid starting point for improving memory management. But, hang on a second... before we commit to those, let's just double-check something. The `NET_DEVMEM` option... that's defined as a `def_bool y` if its dependencies are met, right? I need to quickly verify those dependencies haven't changed. Given we are talking about `NET_DEVMEM`, let's go poke around in `net/core/devmem.c` to see which functions are being modified or using that memory, just to get a lay of the land and a quick refresher on how this thing works.



12/2 2026/08/01 09:48 tool grepper
0m Args:
{
  "Expression": "net_devmem_bind_dmabuf"
}

Results:
{
  "Output": "net/core/devmem.c=126=void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)\n--\nnet/core/devmem.c-155-\nnet/core/devmem.c:156:int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx,\nnet/core/devmem.c-157-\t\t\t\t    struct net_devmem_dmabuf_binding *binding,\n--\nnet/core/devmem.c=188=struct net_devmem_dmabuf_binding *\nnet/core/devmem.c:189:net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\nnet/core/devmem.c-190-\t\t       struct device *dma_dev,\n--\nnet/core/devmem.h=94=struct net_devmem_dmabuf_binding *\nnet/core/devmem.h:95:net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\nnet/core/devmem.h-96-\t\t       struct device *dma_dev,\n--\nnet/core/devmem.h=102=void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding);\nnet/core/devmem.h:103:int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx,\nnet/core/devmem.h-104-\t\t\t\t    struct net_devmem_dmabuf_binding *binding,\n--\nnet/core/devmem.h=177=static inline struct net_devmem_dmabuf_binding *\nnet/core/devmem.h:178:net_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\nnet/core/devmem.h-179-\t\t       struct device *dma_dev,\n--\nnet/core/devmem.h=199=static inline int\nnet/core/devmem.h:200:net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx,\nnet/core/devmem.h-201-\t\t\t\tstruct net_devmem_dmabuf_binding *binding,\n--\nnet/core/netdev-genl.c=1013=int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)\n--\nnet/core/netdev-genl.c-1094-\nnet/core/netdev-genl.c:1095:\tbinding = net_devmem_bind_dmabuf(netdev, NULL, dma_dev, DMA_FROM_DEVICE,\nnet/core/netdev-genl.c-1096-\t\t\t\t\t dmabuf_fd, niov_shift, priv,\n--\nnet/core/netdev-genl.c-1103-\tfor_each_set_bit(rxq_idx, rxq_bitmap, netdev-\u003ereal_num_rx_queues) {\nnet/core/netdev-genl.c:1104:\t\terr = net_devmem_bind_dmabuf_to_queue(netdev, rxq_idx, binding,\nnet/core/netdev-genl.c-1105-\t\t\t\t\t\t      info-\u003eextack);\n--\nnet/core/netdev-genl.c=1169=int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)\n--\nnet/core/netdev-genl.c-1234-\nnet/core/netdev-genl.c:1235:\tbinding = net_devmem_bind_dmabuf(bind_dev,\nnet/core/netdev-genl.c-1236-\t\t\t\t\t bind_dev != netdev ? netdev : NULL,\n"
}

13/2 2026/08/01 09:48 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 15485
							output: 24
							thoughts: 245
						

Thoughts:
**Analyzing Network Device Memory Functions**

Okay, let's zero in on these key functions: `netdev_nl_bind_rx_doit`, `net_devmem_bind_dmabuf`, `net_devmem_bind_dmabuf_to_queue`, `net_devmem_alloc_dmabuf`, `net_devmem_free_dmabuf`, and `net_devmem_get_niov_at`. I need to understand their scope, so first thing's first: are they static? I'm checking each one... Nope, none of them are. Good to know. Since I'm particularly interested in `net_devmem_alloc_dmabuf` I'll have a look at `net/core/devmem.c` to understand this function better.



14/2 2026/08/01 09:49 tool grepper
0m Args:
{
  "Expression": "net_devmem_alloc_dmabuf"
}

Results:
{
  "Output": "net/core/devmem.c=87=struct net_iov *\nnet/core/devmem.c:88:net_devmem_alloc_dmabuf(struct net_devmem_dmabuf_binding *binding)\nnet/core/devmem.c-89-{\n--\nnet/core/devmem.c=473=netmem_ref mp_dmabuf_devmem_alloc_netmems(struct page_pool *pool, gfp_t gfp)\n--\nnet/core/devmem.c-478-\nnet/core/devmem.c:479:\tniov = net_devmem_alloc_dmabuf(binding);\nnet/core/devmem.c-480-\tif (!niov)\n--\nnet/core/devmem.h=150=struct net_iov *\nnet/core/devmem.h:151:net_devmem_alloc_dmabuf(struct net_devmem_dmabuf_binding *binding);\nnet/core/devmem.h-152-void net_devmem_free_dmabuf(struct net_iov *ppiov);\n--\nnet/core/devmem.h=208=static inline struct net_iov *\nnet/core/devmem.h:209:net_devmem_alloc_dmabuf(struct net_devmem_dmabuf_binding *binding)\nnet/core/devmem.h-210-{\n"
}

15/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 16299
							output: 25
							thoughts: 85
						

Thoughts:
**Examining the Network Device Memory Allocation Functions**

Okay, so I'm looking at these network device memory functions: `net_devmem_alloc_dmabuf`, `net_devmem_free_dmabuf`, and `net_devmem_get_niov_at`. Good, I've confirmed that none of them are declared as static. This makes sense; they need to be accessible from outside the immediate compilation unit.

Now, I need to see how these functions are being used, or likely used, within the broader networking context. Let's shift our focus to `net/core/netdev-genl.c`. I expect to find some key interactions there, specifically, I'll be investigating the potential connections to `netdev_nl_bind_rx_doit`. I'm going to determine if the functions I've identified are directly or indirectly involved in the processing of the data streams.



16/2 2026/08/01 09:49 tool grepper
0m Args:
{
  "Expression": "netdev_nl_bind_rx_doit"
}

Results:
{
  "Output": "net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {\n--\nnet/core/netdev-genl-gen.c-226-\t\t.cmd\t\t= NETDEV_CMD_BIND_RX,\nnet/core/netdev-genl-gen.c:227:\t\t.doit\t\t= netdev_nl_bind_rx_doit,\nnet/core/netdev-genl-gen.c-228-\t\t.policy\t\t= netdev_bind_rx_nl_policy,\n--\nnet/core/netdev-genl-gen.h=36=int netdev_nl_qstats_get_dumpit(struct sk_buff *skb,\nnet/core/netdev-genl-gen.h-37-\t\t\t\tstruct netlink_callback *cb);\nnet/core/netdev-genl-gen.h:38:int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info);\nnet/core/netdev-genl-gen.h-39-int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info);\n--\nnet/core/netdev-genl.c=989=netdev_nl_get_dma_dev(struct net_device *netdev, unsigned long *rxq_bitmap,\n--\nnet/core/netdev-genl.c-1012-\nnet/core/netdev-genl.c:1013:int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)\nnet/core/netdev-genl.c-1014-{\n"
}

17/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 17059
							output: 31
							thoughts: 222
						

Thoughts:
**My Current Assessment of the Network Device Memory (DEVMEM) Configuration**

Okay, so I'm honing in on the crucial functions here. My attention needs to be on these, in particular: `netdev_nl_bind_rx_doit`, `net_devmem_bind_dmabuf`, `net_devmem_bind_dmabuf_to_queue`, `net_devmem_alloc_dmabuf`, `net_devmem_free_dmabuf`, and `net_devmem_get_niov_at`. I need to ensure I have a complete grasp on how they interact and the specific context of their operations.

Now, a quick scan for dependencies is in order. Are there any other configuration parameters I need to be aware of? Ah, yes, `NET_DEVMEM` is contingent upon `DMA_SHARED_BUFFER` and `PAGE_POOL`. Gotta make sure those are properly set. Just to be thorough, I should check if there are any *other* relevant configuration variables that might impact this functionality.

Alright, let's see. `CONFIG_NET_DEVMEM` is defined as `def_bool y` provided that both `DMA_SHARED_BUFFER` and `PAGE_POOL` are enabled, so that simplifies things. Wait a minute… This isn't a user-selectable config! `NET_DEVMEM` is not something the user sets directly; it's automatically enabled if the dependencies are met. That changes the focus slightly. It means I need to concentrate on verifying the state of `DMA_SHARED_BUFFER` and `PAGE_POOL`. I should probably go back and re-examine `net/Kconfig` to confirm these dependencies and any other potentially related configurations.



18/2 2026/08/01 09:49 tool read-file
0m Args:
{
  "File": "net/Kconfig",
  "FirstLine": 69,
  "LineCount": 10
}

Results:
{
  "Contents": "  69:\tconfig NET_DEVMEM\n  70:\t\tdef_bool y\n  71:\t\tselect GENERIC_ALLOCATOR\n  72:\t\tdepends on DMA_SHARED_BUFFER\n  73:\t\tdepends on PAGE_POOL\n  74:\t\n  75:\tconfig NET_SHAPER\n  76:\t\tbool\n  77:\t\n  78:\tconfig NET_CRC32C\n"
}

19/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 17799
							output: 24
							thoughts: 218
						

Thoughts:
**My Analysis of the `NET_DEVMEM` Configuration and Potential Fuzzing Targets**

Okay, so I see that the `NET_DEVMEM` option is contingent on both `DMA_SHARED_BUFFER` and `PAGE_POOL` being enabled. Seems straightforward, so I need to make sure I add both of those to the `EnableConfigs` list. No brainer there. Let's make sure I'm not missing anything else obvious… no, looks like those two are the dependencies.

Now, the patch touches `net/core/devmem.c` and `net/core/netdev-genl.c`. Hmm, both files deal with fundamental networking functionality; definitely reachable code. Given the nature of memory management and DMA, this is *absolutely* worth fuzzing. The potential for vulnerabilities here is significant.

Right, let's take a look at the FocusSymbols to solidify my fuzzing strategy. I've got:

*   `netdev_nl_bind_rx_doit`
*   `net_devmem_bind_dmabuf`
*   `net_devmem_bind_dmabuf_to_queue`
*   `net_devmem_alloc_dmabuf`
*   `net_devmem_free_dmabuf`
*   `net_devmem_get_niov_at`

Those all look like good candidates – specifically functions involved in binding, allocating, and freeing DMA buffers. But I'm going to quickly re-review that `net/core/devmem.c` diff again, just to ensure I'm not missing any other potential entry points or interesting calls. Gotta be thorough.



20/2 2026/08/01 09:49 tool grepper
0m Args:
{
  "Expression": "mp_dmabuf_devmem_init"
}

Results:
{
  "Output": "net/core/devmem.c=437=net_devmem_get_niov_at(struct net_devmem_dmabuf_binding *binding,\n--\nnet/core/devmem.c-452-\nnet/core/devmem.c:453:int mp_dmabuf_devmem_init(struct page_pool *pool)\nnet/core/devmem.c-454-{\n--\nnet/core/devmem.c=547=static const struct memory_provider_ops dmabuf_devmem_ops = {\nnet/core/devmem.c:548:\t.init\t\t\t= mp_dmabuf_devmem_init,\nnet/core/devmem.c-549-\t.destroy\t\t= mp_dmabuf_devmem_destroy,\n--\nnet/core/mp_dmabuf_devmem.h-13-#if defined(CONFIG_NET_DEVMEM)\nnet/core/mp_dmabuf_devmem.h:14:int mp_dmabuf_devmem_init(struct page_pool *pool);\nnet/core/mp_dmabuf_devmem.h-15-\n--\nnet/core/mp_dmabuf_devmem.h=20=bool mp_dmabuf_devmem_release_page(struct page_pool *pool, netmem_ref netmem);\nnet/core/mp_dmabuf_devmem.h-21-#else\nnet/core/mp_dmabuf_devmem.h:22:static inline int mp_dmabuf_devmem_init(struct page_pool *pool)\nnet/core/mp_dmabuf_devmem.h-23-{\n"
}

21/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 18832
							output: 25
							thoughts: 958
						

Thoughts:
**Analyzing DMA-BUF and Netlink Changes**

Okay, so I've been dissecting these code changes, focusing on the DMA-BUF and Netlink interactions. The `mp_dmabuf_devmem_init` function looks like it's been updated, so I need to add that to my list of key symbols.

I'm double-checking the `net/core/devmem.c` diff, and right away I see that `net_devmem_get_dma_addr` has been modified. However, it's static, so that one I can leave off the list.

Now I'm going through the non-static functions in that file, so:
*   `net_devmem_alloc_dmabuf` is on my list.
*   `net_devmem_free_dmabuf` goes on there too.
*   And of course, `net_devmem_bind_dmabuf_to_queue` is modified, so that one is key.
*   `net_devmem_bind_dmabuf` gets added.
*   Finally, `net_devmem_get_niov_at` needs to be in my list as well.
*   `mp_dmabuf_devmem_init` needs to be in my list as well.

Wait a minute, I missed something. I need to go back and check `netdev_nl_bind_tx_doit`, because it looks like it's been updated to pass `PAGE_SHIFT` to `net_devmem_bind_dmabuf`. So, I'll add that to my focus list.

I need to confirm this in `net/core/netdev-genl.c`, and I'll add the following symbols:
*   `netdev_nl_bind_rx_doit`
*   `net_devmem_bind_dmabuf`
*   `net_devmem_bind_dmabuf_to_queue`
*   `net_devmem_alloc_dmabuf`
*   `net_devmem_free_dmabuf`
*   `net_devmem_get_niov_at`
*   `mp_dmabuf_devmem_init`
*   `netdev_nl_bind_tx_doit`

These will be my focus for now.



22/2 2026/08/01 09:49 tool grepper
0m Args:
{
  "Expression": "netdev_nl_bind_tx_doit"
}

Results:
{
  "Output": "net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {\n--\nnet/core/netdev-genl-gen.c-240-\t\t.cmd\t\t= NETDEV_CMD_BIND_TX,\nnet/core/netdev-genl-gen.c:241:\t\t.doit\t\t= netdev_nl_bind_tx_doit,\nnet/core/netdev-genl-gen.c-242-\t\t.policy\t\t= netdev_bind_tx_nl_policy,\n--\nnet/core/netdev-genl-gen.h=39=int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info);\nnet/core/netdev-genl-gen.h:40:int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info);\nnet/core/netdev-genl-gen.h-41-int netdev_nl_queue_create_doit(struct sk_buff *skb, struct genl_info *info);\n--\nnet/core/netdev-genl.c=1143=netdev_find_netmem_tx_dev(struct net_device *dev)\n--\nnet/core/netdev-genl.c-1168-\nnet/core/netdev-genl.c:1169:int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)\nnet/core/netdev-genl.c-1170-{\n"
}

23/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 20764
							output: 18
							thoughts: 314
						

Thoughts:
**My Analysis of the Devmem DMABUF Patch**

Okay, so I've confirmed that `netdev_nl_bind_tx_doit` *isn't* static. This is important for determining its visibility. Let's see...

My FocusSymbols are clearly:
*   `netdev_nl_bind_rx_doit`
*   `netdev_nl_bind_tx_doit`
*   `net_devmem_bind_dmabuf`
*   `net_devmem_bind_dmabuf_to_queue`
*   `net_devmem_alloc_dmabuf`
*   `net_devmem_free_dmabuf`
*   `net_devmem_get_niov_at`
*   `mp_dmabuf_devmem_init`

The patch is introducing this `rx-page-size` configuration for devmem/DMABUF within networking. I see that it's updating the netlink API with `NETDEV_CMD_BIND_RX` to handle a new attribute, and then adjusting the core devmem logic to handle the variable page sizes, specifically the `niov_shift` thing. It's touching core kernel logic that's reachable, therefore, fuzzing is required.

Let me just double-check if there are any other configurations involved. I already know that `CONFIG_NET_DEVMEM` is enabled by default if both `DMA_SHARED_BUFFER` and `PAGE_POOL` are enabled, but I should scan `net/core/Makefile` just to be absolutely certain I haven't missed anything.



24/2 2026/08/01 09:49 tool grepper
0m Args:
{
  "Expression": "devmem\\.o"
}

Results:
{
  "Output": "net/core/Makefile=48=obj-$(CONFIG_NET_TEST) += net_test.o\nnet/core/Makefile:49:obj-$(CONFIG_NET_DEVMEM) += devmem.o\nnet/core/Makefile-50-obj-$(CONFIG_DEBUG_NET) += lock_debug.o\n"
}

25/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 21542
							output: 23
							thoughts: 117
						

Thoughts:
**Kernel Configuration: Enabling DMA Shared Buffers and Page Pools**

Okay, so looking at this, it seems pretty clear that `CONFIG_NET_DEVMEM` is the key configuration option. Yes, definitely `CONFIG_NET_DEVMEM`. Since it's defined as a boolean and set to "y", and crucially *depends* on both `DMA_SHARED_BUFFER` and `PAGE_POOL`, it's a no-brainer to enable those as well. We need those dependencies satisfied.

Hang on a minute... while `PAGE_POOL` is often implicitly enabled through other driver selections, I think it's still good practice, especially in this context, to explicitly enable it. It makes the intent clearer.

Now, I should do a quick sweep to make sure there aren't any other related configuration options I'm missing. Let me glance through `net/core/netdev-genl.c` to see if there are any conditional compilation blocks (`#ifdef`) that might impact this. Gotta be thorough.



26/2 2026/08/01 09:49 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "#ifdef CONFIG_NET_DEVMEM"
}

Results:
{
  "error": "no matches"
}

27/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 21914
							output: 25
							thoughts: 31
						

Thoughts:
Okay, here's my take on those thoughts, framed as an expert's internal monologue:

**Diving into the Netlink Device Binding**

Right, time to get to the heart of the matter. My gut tells me the issue likely lies within the Netlink interface, specifically how device bindings are handled. Let's see... I'm thinking, based on the context, `net/core/netdev-genl.c` is the place to start digging. That file should contain the code responsible for processing Netlink messages related to network devices. And specifically, I need to focus on `netdev_nl_bind_rx_doit`. That function name itself is a pretty strong indicator – it screams "receive, Netlink, bind, do it," and binding is precisely what I'm interested in here. So, that's where the critical logic for handling the binding requests and device association *should* reside. Let's fire up the editor and see what's actually going on in there. It's time to analyze the implementation and track the flows, error handling, and the data structures it uses. I suspect the problem is likely related to this binding implementation.



28/2 2026/08/01 09:49 tool grepper
0m Args:
{
  "Expression": "netdev_nl_bind_rx_doit"
}

Results:
{
  "Output": "net/core/netdev-genl-gen.c=145=static const struct genl_split_ops netdev_nl_ops[] = {\n--\nnet/core/netdev-genl-gen.c-226-\t\t.cmd\t\t= NETDEV_CMD_BIND_RX,\nnet/core/netdev-genl-gen.c:227:\t\t.doit\t\t= netdev_nl_bind_rx_doit,\nnet/core/netdev-genl-gen.c-228-\t\t.policy\t\t= netdev_bind_rx_nl_policy,\n--\nnet/core/netdev-genl-gen.h=36=int netdev_nl_qstats_get_dumpit(struct sk_buff *skb,\nnet/core/netdev-genl-gen.h-37-\t\t\t\tstruct netlink_callback *cb);\nnet/core/netdev-genl-gen.h:38:int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info);\nnet/core/netdev-genl-gen.h-39-int netdev_nl_napi_set_doit(struct sk_buff *skb, struct genl_info *info);\n--\nnet/core/netdev-genl.c=989=netdev_nl_get_dma_dev(struct net_device *netdev, unsigned long *rxq_bitmap,\n--\nnet/core/netdev-genl.c-1012-\nnet/core/netdev-genl.c:1013:int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)\nnet/core/netdev-genl.c-1014-{\n"
}

29/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 22671
							output: 40
							thoughts: 36
						

Thoughts:
Okay, let's see...

**Unconditional Compilation and Protocol Bindings**

Hmm, hold on. Is `netdev_nl_bind_rx_doit` really compiled unconditionally? That seems a bit unusual, especially if it's tied to some particular network device configuration. I should probably double-check that. Let's dig into the code and verify if the function is compiled regardless of other configurations. Time to open up `net/core/netdev-genl.c` and take a closer look at the surrounding definitions and any preprocessor directives that might control its inclusion. I'll focus on anything that could gate the compilation of that specific function.



30/2 2026/08/01 09:49 tool read-file
0m Args:
{
  "File": "net/core/netdev-genl.c",
  "FirstLine": 1000,
  "LineCount": 20
}

Results:
{
  "Contents": "1000:\t\t\tif (dma_dev \u0026\u0026 rxq_dma_dev != dma_dev) {\n1001:\t\t\t\tNL_SET_ERR_MSG_FMT(extack, \"DMA device mismatch between queue %u and %u (multi-PF device?)\",\n1002:\t\t\t\t\t\t   rxq_idx, prev_rxq_idx);\n1003:\t\t\t\treturn ERR_PTR(-EOPNOTSUPP);\n1004:\t\t\t}\n1005:\t\n1006:\t\t\tdma_dev = rxq_dma_dev;\n1007:\t\t\tprev_rxq_idx = rxq_idx;\n1008:\t\t}\n1009:\t\n1010:\t\treturn dma_dev;\n1011:\t}\n1012:\t\n1013:\tint netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)\n1014:\t{\n1015:\t\tstruct net_devmem_dmabuf_binding *binding;\n1016:\t\tunsigned int niov_shift = PAGE_SHIFT;\n1017:\t\tu32 ifindex, dmabuf_fd, rxq_idx;\n1018:\t\tstruct netdev_nl_sock *priv;\n1019:\t\tstruct net_device *netdev;\n"
}

31/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 23242
							output: 36
							thoughts: 52
						

Thoughts:
Okay, here's my interpretation of that thought process, from an expert's perspective:

**Diving into the Device Memory Details**

Alright, let me see... I'm checking out the device memory binding function, specifically `net_devmem_bind_dmabuf`. I see it's defined in the network core's `devmem.h` header. The interesting bit, though, is that it's an inline function that returns `-EOPNOTSUPP` if the `CONFIG_NET_DEVMEM` configuration option isn't enabled. So, if that config option isn't set during the kernel build, this whole function effectively becomes a no-op, returning a 'not supported' error. Nothing too surprising, given the naming convention. That's a sensible approach to conditional compilation and managing the feature's availability.



32/2 2026/08/01 09:49 tool read-file
0m Args:
{
  "File": "net/core/devmem.h",
  "FirstLine": 170,
  "LineCount": 20
}

Results:
{
  "Contents": " 170:\t{\n 171:\t}\n 172:\t\n 173:\tstatic inline void net_devmem_put_net_iov(struct net_iov *niov)\n 174:\t{\n 175:\t}\n 176:\t\n 177:\tstatic inline struct net_devmem_dmabuf_binding *\n 178:\tnet_devmem_bind_dmabuf(struct net_device *dev, void *vdev,\n 179:\t\t\t       struct device *dma_dev,\n 180:\t\t\t       enum dma_data_direction direction,\n 181:\t\t\t       unsigned int dmabuf_fd,\n 182:\t\t\t       unsigned int niov_shift,\n 183:\t\t\t       struct netdev_nl_sock *priv,\n 184:\t\t\t       struct netlink_ext_ack *extack)\n 185:\t{\n 186:\t\treturn ERR_PTR(-EOPNOTSUPP);\n 187:\t}\n 188:\t\n 189:\tstatic inline struct net_devmem_dmabuf_binding *net_devmem_lookup_dmabuf(u32 id)\n"
}

33/2 2026/08/01 09:49 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 23829
							output: 235
							thoughts: 206
						

Thoughts:
Okay, let's break this down.

**Configuration Dependencies for Network Device Memory Management**

Right, so to get this network device memory management feature working, `CONFIG_NET_DEVMEM` is the key. But that's not the end of the story; I need to ensure its dependencies are sorted. It seems `CONFIG_NET_DEVMEM` relies on both `DMA_SHARED_BUFFER` and `PAGE_POOL`. Therefore, I need to make sure those two configs are enabled as well. They are the prerequisites here.

Now, let's revisit those `FocusSymbols` to make sure everything's as expected. Okay, a quick scan of the list:
- `netdev_nl_bind_rx_doit`
- `netdev_nl_bind_tx_doit`
- `net_devmem_bind_dmabuf`
- `net_devmem_bind_dmabuf_to_queue`
- `net_devmem_alloc_dmabuf`
- `net_devmem_free_dmabuf`
- `net_devmem_get_niov_at`
- `mp_dmabuf_devmem_init`

Yep, these functions look right on track. They cover the necessary aspects of binding, allocation, freeing, and initialization related to this device memory setup. Good.

With that confirmed, I think we're ready to proceed and call `set-results`.



34/2 2026/08/01 09:49 tool set-results
0m Args:
{
  "EnableConfigs": [
    "DMA_SHARED_BUFFER",
    "PAGE_POOL"
  ],
  "FocusSymbols": [
    "netdev_nl_bind_rx_doit",
    "netdev_nl_bind_tx_doit",
    "net_devmem_bind_dmabuf",
    "net_devmem_bind_dmabuf_to_queue",
    "net_devmem_alloc_dmabuf",
    "net_devmem_free_dmabuf",
    "net_devmem_get_niov_at",
    "mp_dmabuf_devmem_init"
  ],
  "Reasoning": "The patch introduces support for configuring `rx-page-size` for devmem (DMABUF) in the networking subsystem. It modifies the netlink API (`NETDEV_CMD_BIND_RX`) to accept the new attribute and updates the core devmem logic to handle variable page sizes (`niov_shift`). These are functional changes in reachable core kernel logic and should be fuzzed.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "DMA_SHARED_BUFFER",
    "PAGE_POOL"
  ],
  "FocusSymbols": [
    "netdev_nl_bind_rx_doit",
    "netdev_nl_bind_tx_doit",
    "net_devmem_bind_dmabuf",
    "net_devmem_bind_dmabuf_to_queue",
    "net_devmem_alloc_dmabuf",
    "net_devmem_free_dmabuf",
    "net_devmem_get_niov_at",
    "mp_dmabuf_devmem_init"
  ],
  "Reasoning": "The patch introduces support for configuring `rx-page-size` for devmem (DMABUF) in the networking subsystem. It modifies the netlink API (`NETDEV_CMD_BIND_RX`) to accept the new attribute and updates the core devmem logic to handle variable page sizes (`niov_shift`). These are functional changes in reachable core kernel logic and should be fuzzed.",
  "WorthFuzzing": true
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)