* [PATCH net-next v2 1/5] net: add dev->bql flag to allow BQL sysfs for IFF_NO_QUEUE devices [not found] <20260413094442.1376022-1-hawk@kernel.org> @ 2026-04-13 9:44 ` hawk 2026-04-13 19:49 ` [syzbot ci] Re: veth: add Byte Queue Limits (BQL) support syzbot ci 1 sibling, 0 replies; 4+ messages in thread From: hawk @ 2026-04-13 9:44 UTC (permalink / raw) To: netdev Cc: kernel-team, Jesper Dangaard Brouer, Jonas Köppeler, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, Jonathan Corbet, Shuah Khan, Kuniyuki Iwashima, Stanislav Fomichev, Frederic Weisbecker, Yajun Deng, Krishna Kumar, linux-doc, linux-kernel From: Jesper Dangaard Brouer <hawk@kernel.org> Virtual devices with IFF_NO_QUEUE or lltx are excluded from BQL sysfs by netdev_uses_bql(), since they traditionally lack real hardware queues. However, some virtual devices like veth implement a real ptr_ring FIFO with NAPI processing and benefit from BQL to limit in-flight bytes and reduce latency. Add a per-device 'bql' bitfield boolean in the priv_flags_slow section of struct net_device. When set, it overrides the IFF_NO_QUEUE/lltx exclusion and exposes BQL sysfs entries (/sys/class/net/<dev>/queues/ tx-<n>/byte_queue_limits/). The flag is still gated on CONFIG_BQL. This allows drivers that use BQL despite being IFF_NO_QUEUE to opt in to sysfs visibility for monitoring and debugging. Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org> Tested-by: Jonas Köppeler <j.koeppeler@tu-berlin.de> --- Documentation/networking/net_cachelines/net_device.rst | 1 + include/linux/netdevice.h | 2 ++ net/core/net-sysfs.c | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/networking/net_cachelines/net_device.rst b/Documentation/networking/net_cachelines/net_device.rst index 1c19bb7705df..b775d3235a2d 100644 --- a/Documentation/networking/net_cachelines/net_device.rst +++ b/Documentation/networking/net_cachelines/net_device.rst @@ -170,6 +170,7 @@ unsigned_long:1 see_all_hwtstamp_requests unsigned_long:1 change_proto_down unsigned_long:1 netns_immutable unsigned_long:1 fcoe_mtu +unsigned_long:1 bql netdev_uses_bql(net-sysfs.c) struct list_head net_notifier_list struct macsec_ops* macsec_ops struct udp_tunnel_nic_info* udp_tunnel_nic_info diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 47417b2d48a4..7a1a491ecdd5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2048,6 +2048,7 @@ enum netdev_reg_state { * @change_proto_down: device supports setting carrier via IFLA_PROTO_DOWN * @netns_immutable: interface can't change network namespaces * @fcoe_mtu: device supports maximum FCoE MTU, 2158 bytes + * @bql: device uses BQL (DQL sysfs) despite having IFF_NO_QUEUE * * @net_notifier_list: List of per-net netdev notifier block * that follow this device when it is moved @@ -2462,6 +2463,7 @@ struct net_device { unsigned long change_proto_down:1; unsigned long netns_immutable:1; unsigned long fcoe_mtu:1; + unsigned long bql:1; struct list_head net_notifier_list; diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index e430645748a7..4360efc8f241 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1945,10 +1945,16 @@ static const struct kobj_type netdev_queue_ktype = { static bool netdev_uses_bql(const struct net_device *dev) { + if (!IS_ENABLED(CONFIG_BQL)) + return false; + + if (dev->bql) + return true; + if (dev->lltx || (dev->priv_flags & IFF_NO_QUEUE)) return false; - return IS_ENABLED(CONFIG_BQL); + return true; } static int netdev_queue_add_kobject(struct net_device *dev, int index) -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [syzbot ci] Re: veth: add Byte Queue Limits (BQL) support [not found] <20260413094442.1376022-1-hawk@kernel.org> 2026-04-13 9:44 ` [PATCH net-next v2 1/5] net: add dev->bql flag to allow BQL sysfs for IFF_NO_QUEUE devices hawk @ 2026-04-13 19:49 ` syzbot ci 2026-04-14 8:06 ` Jesper Dangaard Brouer 1 sibling, 1 reply; 4+ messages in thread From: syzbot ci @ 2026-04-13 19:49 UTC (permalink / raw) To: andrew, ast, bpf, corbet, daniel, davem, edumazet, frederic, hawk, horms, j.koeppeler, jhs, jiri, john.fastabend, kernel-team, krikku, kuba, kuniyu, linux-doc, linux-kernel, linux-kselftest, netdev, pabeni, sdf, shuah, skhan, yajun.deng Cc: syzbot, syzkaller-bugs syzbot ci has tested the following series [v2] veth: add Byte Queue Limits (BQL) support https://lore.kernel.org/all/20260413094442.1376022-1-hawk@kernel.org * [PATCH net-next v2 1/5] net: add dev->bql flag to allow BQL sysfs for IFF_NO_QUEUE devices * [PATCH net-next v2 2/5] veth: implement Byte Queue Limits (BQL) for latency reduction * [PATCH net-next v2 3/5] veth: add tx_timeout watchdog as BQL safety net * [PATCH net-next v2 4/5] net: sched: add timeout count to NETDEV WATCHDOG message * [PATCH net-next v2 5/5] selftests: net: add veth BQL stress test and found the following issue: WARNING in veth_napi_del_range Full report is available here: https://ci.syzbot.org/series/ee732006-8545-4abd-a105-b4b1592a7baf *** WARNING in veth_napi_del_range tree: net-next URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/netdev/net-next.git base: 8806d502e0a7e7d895b74afbd24e8550a65a2b17 arch: amd64 compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8 config: https://ci.syzbot.org/builds/90743a26-f003-44cf-abcc-5991c47588b2/config syz repro: https://ci.syzbot.org/findings/d068bfb2-9f8b-466a-95b4-cd7e7b00006c/syz_repro ------------[ cut here ]------------ index >= dev->num_tx_queues WARNING: ./include/linux/netdevice.h:2672 at netdev_get_tx_queue include/linux/netdevice.h:2672 [inline], CPU#0: syz.1.27/6002 WARNING: ./include/linux/netdevice.h:2672 at veth_napi_del_range+0x3b7/0x4e0 drivers/net/veth.c:1142, CPU#0: syz.1.27/6002 Modules linked in: CPU: 0 UID: 0 PID: 6002 Comm: syz.1.27 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:netdev_get_tx_queue include/linux/netdevice.h:2672 [inline] RIP: 0010:veth_napi_del_range+0x3b7/0x4e0 drivers/net/veth.c:1142 Code: 00 e8 ad 96 69 fe 44 39 6c 24 10 74 5e e8 41 61 44 fb 41 ff c5 49 bc 00 00 00 00 00 fc ff df e9 6d ff ff ff e8 2a 61 44 fb 90 <0f> 0b 90 42 80 3c 23 00 75 8e eb 94 48 8b 0c 24 80 e1 07 80 c1 03 RSP: 0018:ffffc90003adf918 EFLAGS: 00010293 RAX: ffffffff86814ec6 RBX: 1ffff110227a6c03 RCX: ffff888103a857c0 RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000002 RBP: 1ffff110227a6c9a R08: ffff888113f01ab7 R09: 0000000000000000 R10: ffff888113f01a98 R11: ffffed10227e0357 R12: dffffc0000000000 R13: 0000000000000002 R14: 0000000000000002 R15: ffff888113d36018 FS: 000055555ea16500(0000) GS:ffff88818de4a000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007efc287456b8 CR3: 000000010cdd0000 CR4: 00000000000006f0 Call Trace: <TASK> veth_napi_del drivers/net/veth.c:1153 [inline] veth_disable_xdp+0x1b0/0x310 drivers/net/veth.c:1255 veth_xdp_set drivers/net/veth.c:1693 [inline] veth_xdp+0x48e/0x730 drivers/net/veth.c:1717 dev_xdp_propagate+0x125/0x260 net/core/dev_api.c:348 bond_xdp_set drivers/net/bonding/bond_main.c:5715 [inline] bond_xdp+0x3ca/0x830 drivers/net/bonding/bond_main.c:5761 dev_xdp_install+0x42c/0x600 net/core/dev.c:10387 dev_xdp_detach_link net/core/dev.c:10579 [inline] bpf_xdp_link_release+0x362/0x540 net/core/dev.c:10595 bpf_link_free+0x103/0x480 kernel/bpf/syscall.c:3292 bpf_link_put_direct kernel/bpf/syscall.c:3344 [inline] bpf_link_release+0x6b/0x80 kernel/bpf/syscall.c:3351 __fput+0x44f/0xa70 fs/file_table.c:469 task_work_run+0x1d9/0x270 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:67 [inline] exit_to_user_mode_loop+0xed/0x480 kernel/entry/common.c:98 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:325 [inline] do_syscall_64+0x32d/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5bda39c819 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffdca2969e8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007f5bda617da0 RCX: 00007f5bda39c819 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007f5bda617da0 R08: 00007f5bda616128 R09: 0000000000000000 R10: 000000000003fd78 R11: 0000000000000246 R12: 0000000000010fb8 R13: 00007f5bda61609c R14: 0000000000010cdd R15: 00007ffdca296af0 </TASK> *** If these findings have caused you to resend the series or submit a separate fix, please add the following tag to your commit message: Tested-by: syzbot@syzkaller.appspotmail.com --- This report is generated by a bot. It may contain errors. syzbot ci engineers can be reached at syzkaller@googlegroups.com. To test a patch for this bug, please reply with `#syz test` (should be on a separate line). The patch should be attached to the email. Note: arguments like custom git repos and branches are not supported. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [syzbot ci] Re: veth: add Byte Queue Limits (BQL) support 2026-04-13 19:49 ` [syzbot ci] Re: veth: add Byte Queue Limits (BQL) support syzbot ci @ 2026-04-14 8:06 ` Jesper Dangaard Brouer 2026-04-14 8:08 ` syzbot ci 0 siblings, 1 reply; 4+ messages in thread From: Jesper Dangaard Brouer @ 2026-04-14 8:06 UTC (permalink / raw) To: syzbot ci, andrew, ast, bpf, corbet, daniel, davem, edumazet, frederic, horms, j.koeppeler, john.fastabend, kernel-team, kuba, linux-doc, linux-kernel, linux-kselftest, netdev, pabeni, sdf, shuah Cc: syzbot, syzkaller-bugs [-- Attachment #1: Type: text/plain, Size: 4594 bytes --] On 13/04/2026 21.49, syzbot ci wrote: > syzbot ci has tested the following series > > [v2] veth: add Byte Queue Limits (BQL) support > https://lore.kernel.org/all/20260413094442.1376022-1-hawk@kernel.org > * [PATCH net-next v2 1/5] net: add dev->bql flag to allow BQL sysfs for IFF_NO_QUEUE devices > * [PATCH net-next v2 2/5] veth: implement Byte Queue Limits (BQL) for latency reduction > * [PATCH net-next v2 3/5] veth: add tx_timeout watchdog as BQL safety net > * [PATCH net-next v2 4/5] net: sched: add timeout count to NETDEV WATCHDOG message > * [PATCH net-next v2 5/5] selftests: net: add veth BQL stress test > > and found the following issue: > WARNING in veth_napi_del_range > > Full report is available here: > https://ci.syzbot.org/series/ee732006-8545-4abd-a105-b4b1592a7baf > > *** > > WARNING in veth_napi_del_range > Attached a reproducer myself. - I have V3 ready see below for diff > tree: net-next > URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/netdev/net-next.git > base: 8806d502e0a7e7d895b74afbd24e8550a65a2b17 > arch: amd64 > compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8 > config: https://ci.syzbot.org/builds/90743a26-f003-44cf-abcc-5991c47588b2/config > syz repro: https://ci.syzbot.org/findings/d068bfb2-9f8b-466a-95b4-cd7e7b00006c/syz_repro > > ------------[ cut here ]------------ > index >= dev->num_tx_queues > WARNING: ./include/linux/netdevice.h:2672 at netdev_get_tx_queue include/linux/netdevice.h:2672 [inline], CPU#0: syz.1.27/6002 > WARNING: ./include/linux/netdevice.h:2672 at veth_napi_del_range+0x3b7/0x4e0 drivers/net/veth.c:1142, CPU#0: syz.1.27/6002 > Modules linked in: > CPU: 0 UID: 0 PID: 6002 Comm: syz.1.27 Not tainted syzkaller #0 PREEMPT(full) > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 > RIP: 0010:netdev_get_tx_queue include/linux/netdevice.h:2672 [inline] > RIP: 0010:veth_napi_del_range+0x3b7/0x4e0 drivers/net/veth.c:1142 > Code: 00 e8 ad 96 69 fe 44 39 6c 24 10 74 5e e8 41 61 44 fb 41 ff c5 49 bc 00 00 00 00 00 fc ff df e9 6d ff ff ff e8 2a 61 44 fb 90 <0f> 0b 90 42 80 3c 23 00 75 8e eb 94 48 8b 0c 24 80 e1 07 80 c1 03 > RSP: 0018:ffffc90003adf918 EFLAGS: 00010293 > RAX: ffffffff86814ec6 RBX: 1ffff110227a6c03 RCX: ffff888103a857c0 > RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000002 > RBP: 1ffff110227a6c9a R08: ffff888113f01ab7 R09: 0000000000000000 > R10: ffff888113f01a98 R11: ffffed10227e0357 R12: dffffc0000000000 > R13: 0000000000000002 R14: 0000000000000002 R15: ffff888113d36018 > FS: 000055555ea16500(0000) GS:ffff88818de4a000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00007efc287456b8 CR3: 000000010cdd0000 CR4: 00000000000006f0 > Call Trace: > <TASK> > veth_napi_del drivers/net/veth.c:1153 [inline] > veth_disable_xdp+0x1b0/0x310 drivers/net/veth.c:1255 > veth_xdp_set drivers/net/veth.c:1693 [inline] > veth_xdp+0x48e/0x730 drivers/net/veth.c:1717 > dev_xdp_propagate+0x125/0x260 net/core/dev_api.c:348 > bond_xdp_set drivers/net/bonding/bond_main.c:5715 [inline] > bond_xdp+0x3ca/0x830 drivers/net/bonding/bond_main.c:5761 > dev_xdp_install+0x42c/0x600 net/core/dev.c:10387 > dev_xdp_detach_link net/core/dev.c:10579 [inline] > bpf_xdp_link_release+0x362/0x540 net/core/dev.c:10595 > bpf_link_free+0x103/0x480 kernel/bpf/syscall.c:3292 > bpf_link_put_direct kernel/bpf/syscall.c:3344 [inline] > bpf_link_release+0x6b/0x80 kernel/bpf/syscall.c:3351 > __fput+0x44f/0xa70 fs/file_table.c:469 > task_work_run+0x1d9/0x270 kernel/task_work.c:233 The BQL reset loop in veth_napi_del_range() iterates dev->real_num_rx_queues but indexes into peer's TX queues, which goes out of bounds when the peer has fewer TX queues (e.g. veth enslaved to a bond with XDP). Fix is to clamp the loop to the peer's real_num_tx_queues. Will be included in the V3 submission. #syz test --- drivers/net/veth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 911e7e36e166..9d7b085c9548 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1138,7 +1138,9 @@ static void veth_napi_del_range(struct net_device *dev, int start, int end) */ peer = rtnl_dereference(priv->peer); if (peer) { - for (i = start; i < end; i++) + int peer_end = min(end, (int)peer->real_num_tx_queues); + + for (i = start; i < peer_end; i++) netdev_tx_reset_queue(netdev_get_tx_queue(peer, i)); } [-- Attachment #2: repro-syzbot-veth-bql.sh --] [-- Type: application/x-shellscript, Size: 2967 bytes --] ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Re: [syzbot ci] Re: veth: add Byte Queue Limits (BQL) support 2026-04-14 8:06 ` Jesper Dangaard Brouer @ 2026-04-14 8:08 ` syzbot ci 0 siblings, 0 replies; 4+ messages in thread From: syzbot ci @ 2026-04-14 8:08 UTC (permalink / raw) To: hawk Cc: andrew, ast, bpf, corbet, daniel, davem, edumazet, frederic, hawk, horms, j.koeppeler, john.fastabend, kernel-team, kuba, linux-doc, linux-kernel, linux-kselftest, netdev, pabeni, sdf, shuah, syzbot, syzkaller-bugs Please attach the patch to act upon. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-14 8:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260413094442.1376022-1-hawk@kernel.org>
2026-04-13 9:44 ` [PATCH net-next v2 1/5] net: add dev->bql flag to allow BQL sysfs for IFF_NO_QUEUE devices hawk
2026-04-13 19:49 ` [syzbot ci] Re: veth: add Byte Queue Limits (BQL) support syzbot ci
2026-04-14 8:06 ` Jesper Dangaard Brouer
2026-04-14 8:08 ` syzbot ci
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox