net_sched: introduce eBPF based Qdisc
Subsystems (5)
v3 cover net_sched: introduce eBPF based Qdisc
From: Cong Wang <[email protected]>
This *incomplete* patch introduces a programmable Qdisc with eBPF. The goal is to make this Qdisc as programmable as possible, that is, to replace as many existing Qdisc's as we can, no matter in tree or out of tree. And we want to make programmer's and researcher's life as easy as possible, so that they don't have to write a complete Qdisc kernel module just to experiment some queuing theory.
The design was discussed during last LPC:
https://linuxplumbersconf.org/event/7/contributions/679/attachments/520/1188/sch_bpf.pdf
Here is a summary of design decisions I made:
1. Avoid eBPF struct_ops, as it would be really hard to program a Qdisc with this approach, literally all the struct Qdisc_ops and struct Qdisc_class_ops are needed to implement. This is almost as hard as programming a Qdisc kernel module.
2. Introduce skb map, which will allow other eBPF programs to store skb's too.
a) As eBPF maps are not directly visible to the kernel, we have to dump the stats via eBPF map API's instead of netlink.
b) The user-space is not allowed to read the entire packets, only __sk_buff itself is readable, because we don't have such a use case yet and it would require a different API to read the data, as map values have fixed length.
c) Two eBPF helpers are introduced for skb map operations:
bpf_skb_map_enqueue() and bpf_skb_map_dequeue(). Normal map update is not allowed.
d) Multi-queue support should be done via map-in-map. This is TBD.
e) Use the netdevice notifier to reset the packets inside skb map upon NETDEV_DOWN event.
3. Integrate with existing TC infra. For example, if the user doesn't want to implement her own filters (e.g. a flow dissector), she should be able to re-use the existing TC filters. Another helper bpf_skb_classify() is introduced for this purpose.
Although the biggest limitation is obviously that users can not traverse the packets or flows inside the Qdisc, I think at least they could store those global information of interest inside their own hashmap.
TBD: should we introduce an eBPF program for skb map which allows users to sort the packets?
Any high-level feedbacks are welcome. Please kindly do not review any coding details until RFC tag is removed.
TODO:
1. actually test it
2. write a document for this Qdisc
3. add test cases and sample code
---
v3: move priority queue from sch_bpf to skb map
introduce skb map and its helpers
introduce bpf_skb_classify()
use netdevice notifier to reset skb's
Rebase on latest bpf-next
v2: Rebase on latest net-next
Make the code more complete (but still incomplete)
Cong Wang (3):
introduce priority queue
bpf: introduce skb map
net_sched: introduce eBPF based Qdisc
include/linux/bpf_types.h | 2 + include/linux/priority_queue.h | 90 ++++++ include/linux/skbuff.h | 2 + include/uapi/linux/bpf.h | 15 + include/uapi/linux/pkt_sched.h | 17 ++ kernel/bpf/Makefile | 2 +- kernel/bpf/skb_map.c | 244 +++++++++++++++ net/sched/Kconfig | 15 + net/sched/Makefile | 1 + net/sched/sch_bpf.c | 521 +++++++++++++++++++++++++++++++++ 10 files changed, 908 insertions(+), 1 deletion(-) create mode 100644 include/linux/priority_queue.h create mode 100644 kernel/bpf/skb_map.c create mode 100644 net/sched/sch_bpf.c
Signature · 1 line
2.32.0
RFC PATCH v3 1/3 introduce priority queue
--- include/linux/priority_queue.h | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 include/linux/priority_queue.h
include/linux/priority_queue.h new file +90 -0
@@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* A priority queue implementation based on rbtree +* +* Copyright (C) 2021, Bytedance, Cong Wang <[email protected]> +*/ + +#ifndef _LINUX_PRIORITY_QUEUE_H +#define _LINUX_PRIORITY_QUEUE_H + +#include <linux/rbtree.h> + +struct pq_node { +struct rb_node rb_node; +}; + +struct pq_root { +struct rb_root_cached rb_root; +bool (*cmp)(struct pq_node *l,struct pq_node *r); +}; + +static inline void pq_root_init (struct pq_root *root, +bool (*cmp)(struct pq_node *l,struct pq_node *r)) +{ + root->rb_root =RB_ROOT_CACHED ; + root->cmp = cmp; +} + +static inline void pq_push (struct pq_root *root,struct pq_node *node) +{ +struct rb_node **link = &root->rb_root.rb_root.rb_node; +struct rb_node *parent =NULL ; +struct pq_node *entry; +bool leftmost = true; + +/* +* Find the right place in the rbtree: +*/ +while (*link) { + parent = *link; + entry = rb_entry(parent, struct pq_node, rb_node); +/* +* We dont care about collisions. Nodes with +* the same key stay together. +*/ +if (root->cmp (entry, node)) { + link = &parent->rb_left; + }else { + link = &parent->rb_right; + leftmost = false; + } + } + +rb_link_node (&node->rb_node, parent, link); +rb_insert_color_cached (&node->rb_node, &root->rb_root, leftmost); +} + +static inline struct pq_node *pq_top (struct pq_root *root) +{ +struct rb_node *left =rb_first_cached (&root->rb_root); + +if (!left) +return NULL ; + return rb_entry(left, struct pq_node, rb_node); +} + +static inline struct pq_node *pq_pop (struct pq_root *root) +{ +struct pq_node *t =pq_top (root); + +if (t) +rb_erase_cached (&t->rb_node, &root->rb_root); +return t; +} + +static inline void pq_flush (struct pq_root *root,void (*destroy)(struct pq_node *)) +{ +struct rb_node *node, *next; + +for (node =rb_first (&root->rb_root.rb_root); + next = node ?rb_next (node) :NULL , node !=NULL ; + node = next) { +struct pq_node *pqe; + + pqe = rb_entry(node, struct pq_node, rb_node); +if (destroy) +destroy (pqe); + } +} +#endif /* _LINUX_PRIORITY_QUEUE_H */
Signature · 1 line
2.32.0
RFC PATCH v3 2/3 bpf: introduce skb map
In reply to Cong WangFrom: Cong Wang <[email protected]>
--- include/linux/skbuff.h | 2 + kernel/bpf/Makefile | 2 +- kernel/bpf/skb_map.c | 244 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 kernel/bpf/skb_map.c
include/linux/skbuff.h +2 -0
@@ -37,6 +37,7 @@#include <linux/in6.h> #include <linux/if_packet.h> #include <linux/llist.h> +#include <linux/priority_queue.h> #include <net/flow.h> #include <net/page_pool.h> #if IS_ENABLED (CONFIG_NF_CONNTRACK )
@@ -746,6 +747,7 @@ struct sk_buff { }; };struct rb_node rbnode;/* used in netem, ip4 defrag, and tcp stack */ +struct pq_node pqnode;/* used in eBPF skb map */ struct list_head list;struct llist_node ll_node; };
kernel/bpf/Makefile +1 -1
@@ -8,7 +8,7 @@ CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy) obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o bpf_iter.o map_iter.o task_iter.o prog_iter.o obj-$(CONFIG_BPF_SYSCALL) += hashtab.o arraymap.o percpu_freelist.o bpf_lru_list.o lpm_trie.o map_in_map.o bloom_filter.o -obj-$(CONFIG_BPF_SYSCALL) += local_storage.o queue_stack_maps.o ringbuf.o +obj-$(CONFIG_BPF_SYSCALL) += local_storage.o queue_stack_maps.o ringbuf.o skb_map.o obj-$(CONFIG_BPF_SYSCALL) += bpf_local_storage.o bpf_task_storage.o obj-${CONFIG_BPF_LSM} += bpf_inode_storage.o obj-$(CONFIG_BPF_SYSCALL) += disasm.o
kernel/bpf/skb_map.c new file +244 -0
244 lines not on this page · raw message
Signature · 1 line
2.32.0
kernel test robot
build botRe: [RFC Patch v3 2/3] bpf: introduce skb map
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Cong,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on bpf-next/master]
[also build test WARNING on net-next/master next-20211224]
[cannot apply to bpf/master net/master horms-ipvs/master linus/master v5.16-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20211226/202112261343.mHcO6jk0-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/98f78772173d9f0122cbeedabfd01bbd531e1da3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 git checkout 98f78772173d9f0122cbeedabfd01bbd531e1da3
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpio/ kernel/bpf/ net/key/ net/sched/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> kernel/bpf/skb_map.c:160:5: warning: no previous prototype for 'skb_map_enqueue' [-Wmissing-prototypes]
160 | int skb_map_enqueue(struct sk_buff *skb, struct bpf_map *map, u64 key)
| ^~~~~~~~~~~~~~~
>> kernel/bpf/skb_map.c:180:17: warning: no previous prototype for 'skb_map_dequeue' [-Wmissing-prototypes] 180 | struct sk_buff *skb_map_dequeue(struct bpf_map *map)
| ^~~~~~~~~~~~~~~
vim +/skb_map_enqueue +160 kernel/bpf/skb_map.c
159
> 160 int skb_map_enqueue(struct sk_buff *skb, struct bpf_map *map, u64 key)
161 {
162 struct bpf_skb_map *pq = bpf_skb_map(map);
163 struct skb_map_node *n;
164 unsigned long flags;
165
166 if (atomic_inc_return(&pq->count) > pq->map.max_entries)
167 return -ENOBUFS;
168 n = alloc_skb_map_node(pq);
169 if (!n)
170 return -ENOMEM;
171 n->key = key;
172 n->skb = skb_get(skb);
173 raw_spin_lock_irqsave(&pq->lock, flags);
174 pq_push(&pq->root, &n->node);
175 raw_spin_unlock_irqrestore(&pq->lock, flags);
176 return 0;
177
178 }
179
> 180 struct sk_buff *skb_map_dequeue(struct bpf_map *map) 181 {
182 struct bpf_skb_map *pq = bpf_skb_map(map);
183 struct skb_map_node *n;
184 struct pq_node *node;
185 unsigned long flags;
186
187 raw_spin_lock_irqsave(&pq->lock, flags);
188 node = pq_pop(&pq->root);
189 if (!node) {
190 raw_spin_unlock_irqrestore(&pq->lock, flags);
191 return NULL;
192 }
193 raw_spin_unlock_irqrestore(&pq->lock, flags);
194 n = container_of(node, struct skb_map_node, node);
195 consume_skb(n->skb);
196 atomic_dec(&pq->count);
197 return n->skb;
198 }
199
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [RFC Patch v3 2/3] bpf: introduce skb map
In reply to Cong Wang[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Cong,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on bpf-next/master]
[also build test ERROR on net-next/master next-20211224]
[cannot apply to bpf/master net/master horms-ipvs/master linus/master v5.16-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: nds32-randconfig-c023-20211228 (https://download.01.org/0day-ci/archive/20211228/202112282238.wQMnXu6l-lkp(a)intel.com/config) compiler: nds32le-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/98f78772173d9f0122cbeedabfd01bbd531e1da3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 git checkout 98f78772173d9f0122cbeedabfd01bbd531e1da3
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
nds32le-linux-ld: kernel/bpf/skb_map.o: in function `skb_flush':
>> skb_map.c:(.text+0xdc): undefined reference to `kfree_skb' >> nds32le-linux-ld: skb_map.c:(.text+0xe0): undefined reference to `kfree_skb' nds32le-linux-ld: kernel/bpf/skb_map.o: in function `skb_map_notification': skb_map.c:(.text+0x150): undefined reference to `kfree_skb' nds32le-linux-ld: skb_map.c:(.text+0x154): undefined reference to `kfree_skb' nds32le-linux-ld: kernel/bpf/skb_map.o: in function `skb_map_free': skb_map.c:(.text+0x30a): undefined reference to `kfree_skb' nds32le-linux-ld: kernel/bpf/skb_map.o:skb_map.c:(.text+0x30e): more undefined references to `kfree_skb' follow nds32le-linux-ld: kernel/bpf/skb_map.o: in function `skb_map_dequeue': >> skb_map.c:(.text+0x4ce): undefined reference to `consume_skb' >> nds32le-linux-ld: skb_map.c:(.text+0x4d2): undefined reference to `consume_skb' nds32le-linux-ld: kernel/bpf/skb_map.o: in function `skb_map_init': >> skb_map.c:(.init.text+0x18): undefined reference to `register_netdevice_notifier' >> nds32le-linux-ld: skb_map.c:(.init.text+0x1c): undefined reference to `register_netdevice_notifier'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
RFC PATCH v3 3/3 net_sched: introduce eBPF based Qdisc
In reply to Cong Wang--- include/linux/bpf_types.h | 2 + include/uapi/linux/bpf.h | 15 + include/uapi/linux/pkt_sched.h | 17 ++ net/sched/Kconfig | 15 + net/sched/Makefile | 1 + net/sched/sch_bpf.c | 521 +++++++++++++++++++++++++++++++++ 6 files changed, 571 insertions(+) create mode 100644 net/sched/sch_bpf.c
include/linux/bpf_types.h +2 -0
@@ -8,6 +8,8 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act, struct __sk_buff, struct sk_buff) BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act, struct __sk_buff, struct sk_buff) +//BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_QDISC, tc_cls_act, +// struct __sk_buff, struct sk_buff) BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp, struct xdp_md, struct xdp_buff)#ifdef CONFIG_CGROUP_BPF
include/uapi/linux/bpf.h +15 -0
@@ -950,6 +950,7 @@ enum bpf_prog_type {BPF_PROG_TYPE_LSM ,BPF_PROG_TYPE_SK_LOOKUP ,BPF_PROG_TYPE_SYSCALL ,/* a program that can execute syscalls */ + BPF_PROG_TYPE_SCHED_QDISC, }; enum bpf_attach_type {
@@ -6489,4 +6490,18 @@ struct bpf_core_relo { enum bpf_core_relo_kind kind; }; +struct sch_bpf_ctx { +struct __sk_buff *skb; +__u32 classid; +__u64 delay; +}; + +enum { +SCH_BPF_OK , +SCH_BPF_QUEUED , +SCH_BPF_DROP , +SCH_BPF_THROTTLE , +SCH_BPF_CONTINUE , +}; +#endif /* _UAPI__LINUX_BPF_H__ */
include/uapi/linux/pkt_sched.h +17 -0
@@ -1267,4 +1267,21 @@ enum {#define TCA_ETS_MAX (__TCA_ETS_MAX - 1) +#define TCA_SCH_BPF_FLAG_DIRECT _BITUL(0) +enum { +TCA_SCH_BPF_UNSPEC , +TCA_SCH_BPF_FLAGS ,/* u32 */ +TCA_SCH_BPF_ENQUEUE_PROG_NAME ,/* string */ +TCA_SCH_BPF_ENQUEUE_PROG_FD ,/* u32 */ +TCA_SCH_BPF_ENQUEUE_PROG_ID ,/* u32 */ +TCA_SCH_BPF_ENQUEUE_PROG_TAG ,/* data */ +TCA_SCH_BPF_DEQUEUE_PROG_NAME ,/* string */ +TCA_SCH_BPF_DEQUEUE_PROG_FD ,/* u32 */ +TCA_SCH_BPF_DEQUEUE_PROG_ID ,/* u32 */ +TCA_SCH_BPF_DEQUEUE_PROG_TAG ,/* data */ + __TCA_SCH_BPF_MAX, +}; + +#define TCA_SCH_BPF_MAX (__TCA_SCH_BPF_MAX - 1) +#endif
net/sched/Kconfig +15 -0
@@ -439,6 +439,21 @@ config NET_SCH_ETS If unsure, say N. +config NET_SCH_BPF + tristate "eBPF based programmable queue discipline" + help + This eBPF based queue discipline offers a way to program your + own packet scheduling algorithm. This is a classful qdisc which + also allows you to decide the hierarchy. + + Say Y here if you want to use the eBPF based programmable queue + discipline. + + To compile this driver as a module, choose M here: the module + will be called sch_bpf. + + If unsure, say N. + menuconfig NET_SCH_DEFAULT bool "Allow override default queue discipline" help
net/sched/Makefile +1 -0
@@ -65,6 +65,7 @@ obj-$(CONFIG_NET_SCH_FQ_PIE) += sch_fq_pie.o obj-$(CONFIG_NET_SCH_CBS) += sch_cbs.o obj-$(CONFIG_NET_SCH_ETF) += sch_etf.o obj-$(CONFIG_NET_SCH_TAPRIO) += sch_taprio.o +obj-$(CONFIG_NET_SCH_BPF) += sch_bpf.o obj-$(CONFIG_NET_CLS_U32) += cls_u32.o obj-$(CONFIG_NET_CLS_ROUTE4) += cls_route.o
net/sched/sch_bpf.c new file +521 -0
521 lines not on this page · raw message
Signature · 1 line
2.32.0
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Cong,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on bpf-next/master]
[also build test WARNING on net-next/master next-20211224]
[cannot apply to bpf/master net/master horms-ipvs/master linus/master v5.16-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20211226/202112261603.pryQwYQT-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/3281415061bcf1a15f10b0a750d35ad9de23b469
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 git checkout 3281415061bcf1a15f10b0a750d35ad9de23b469
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpio/ net/key/ net/sched/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> net/sched/sch_bpf.c:458:5: warning: no previous prototype for 'bpf_skb_classify' [-Wmissing-prototypes]
458 | u32 bpf_skb_classify(struct sk_buff *skb, int ifindex, u32 handle)
| ^~~~~~~~~~~~~~~~
vim +/bpf_skb_classify +458 net/sched/sch_bpf.c
457
> 458 u32 bpf_skb_classify(struct sk_buff *skb, int ifindex, u32 handle)
459 {
460 struct net *net = dev_net(skb->dev);
461 struct tcf_result res = {};
462 struct sch_bpf_qdisc *q;
463 struct net_device *dev;
464 struct tcf_proto *tcf;
465 struct Qdisc *sch;
466 int result;
467
468 rcu_read_lock();
469 dev = dev_get_by_index_rcu(net, ifindex);
470 if (!dev) {
471 rcu_read_unlock();
472 return 0;
473 }
474 sch = qdisc_lookup_rcu(dev, handle);
475 if (!sch) {
476 rcu_read_unlock();
477 return 0;
478 }
479 if (sch->ops != &sch_bpf_qdisc_ops) {
480 rcu_read_unlock();
481 return 0;
482 }
483 q = qdisc_priv(sch);
484 tcf = rcu_dereference_bh(q->filter_list);
485 if (!tcf) {
486 rcu_read_unlock();
487 return 0;
488 }
489 result = tcf_classify(skb, NULL, tcf, &res, false);
490 if (result >= 0) {
491 #ifdef CONFIG_NET_CLS_ACT
492 switch (result) {
493 case TC_ACT_QUEUED:
494 case TC_ACT_STOLEN:
495 case TC_ACT_TRAP:
496 fallthrough;
497 case TC_ACT_SHOT:
498 rcu_read_unlock();
499 return 0;
500 }
501 #endif
502 }
503 rcu_read_unlock();
504 return res.class;
505 }
506
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Cong,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on bpf-next/master]
[also build test WARNING on net-next/master next-20211224]
[cannot apply to bpf/master net/master horms-ipvs/master linus/master v5.16-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: i386-randconfig-c001-20211226 (https://download.01.org/0day-ci/archive/20211227/202112271239.sDqlvXQh-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a9e8b1ee7fd44b53c555a7823ae8fd1a8209c520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3281415061bcf1a15f10b0a750d35ad9de23b469
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Cong-Wang/net_sched-introduce-eBPF-based-Qdisc/20211225-040205 git checkout 3281415061bcf1a15f10b0a750d35ad9de23b469
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/sched/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> net/sched/sch_bpf.c:178:3: warning: variable 'cl' is uninitialized when used here [-Wuninitialized]
cl->overlimits++;
^~
net/sched/sch_bpf.c:162:26: note: initialize the variable 'cl' to silence this warning
struct sch_bpf_class *cl;
^
= NULL
>> net/sched/sch_bpf.c:458:5: warning: no previous prototype for function 'bpf_skb_classify' [-Wmissing-prototypes]
u32 bpf_skb_classify(struct sk_buff *skb, int ifindex, u32 handle)
^ net/sched/sch_bpf.c:458:1: note: declare 'static' if the function is not intended to be used outside of this translation unit u32 bpf_skb_classify(struct sk_buff *skb, int ifindex, u32 handle)
^
static
2 warnings generated.
vim +/cl +178 net/sched/sch_bpf.c
155
156 static struct sk_buff *sch_bpf_dequeue(struct Qdisc *sch)
157 {
158 struct sch_bpf_qdisc *q = qdisc_priv(sch);
159 struct sk_buff *ret = NULL;
160 struct sch_bpf_ctx ctx = {};
161 struct bpf_prog *dequeue;
162 struct sch_bpf_class *cl;
163 s64 now;
164 int res;
165
166 again:
167 dequeue = rcu_dereference(q->dequeue_prog.prog);
168 ctx.classid = sch->handle;
169 res = bpf_prog_run(dequeue, &ctx);
170 switch (res) {
171 case SCH_BPF_OK:
172 ret = (struct sk_buff *)ctx.skb;
173 break;
174 case SCH_BPF_THROTTLE:
175 now = ktime_get_ns();
176 qdisc_watchdog_schedule_ns(&q->watchdog, now + ctx.delay);
177 qdisc_qstats_overlimit(sch);
> 178 cl->overlimits++;
179 return NULL;
180 case SCH_BPF_CONTINUE:
181 goto again;
182 default:
183 kfree_skb((struct sk_buff *)ctx.skb);
184 ret = NULL;
185 }
186
187 return ret;
188 }
189
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org