bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, bpf@vger.kernel.org
Cc: kbuild-all@lists.01.org,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Jamal Hadi Salim" <jhs@mojatatu.com>,
	"Vlad Buslov" <vladbu@nvidia.com>,
	"Cong Wang" <xiyou.wangcong@gmail.com>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>
Subject: Re: [PATCH bpf-next v2 3/7] net: sched: add bpf_link API for bpf classifier
Date: Fri, 4 Jun 2021 19:32:30 +0800	[thread overview]
Message-ID: <202106041949.dHY7EvgX-lkp@intel.com> (raw)
In-Reply-To: <20210604063116.234316-4-memxor@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 7810 bytes --]

Hi Kumar,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Kumar-Kartikeya-Dwivedi/Add-bpf_link-based-TC-BPF-API/20210604-143611
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: i386-randconfig-s001-20210603 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/a8da2c7297ab4c27511723367a5679b51bd5af7c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kumar-Kartikeya-Dwivedi/Add-bpf_link-based-TC-BPF-API/20210604-143611
        git checkout a8da2c7297ab4c27511723367a5679b51bd5af7c
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   net/sched/cls_api.c:270:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be16 [usertype] protocol @@     got unsigned int [usertype] protocol @@
   net/sched/cls_api.c:270:22: sparse:     expected restricted __be16 [usertype] protocol
   net/sched/cls_api.c:270:22: sparse:     got unsigned int [usertype] protocol
   net/sched/cls_api.c:1675:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/sched/cls_api.c:1675:16: sparse:    struct tcf_proto *
   net/sched/cls_api.c:1675:16: sparse:    struct tcf_proto [noderef] __rcu *
   net/sched/cls_api.c:1776:20: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/sched/cls_api.c:1776:20: sparse:    struct tcf_proto [noderef] __rcu *
   net/sched/cls_api.c:1776:20: sparse:    struct tcf_proto *
   net/sched/cls_api.c:1737:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/sched/cls_api.c:1737:25: sparse:    struct tcf_proto [noderef] __rcu *
   net/sched/cls_api.c:1737:25: sparse:    struct tcf_proto *
   net/sched/cls_api.c:1757:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/sched/cls_api.c:1757:16: sparse:    struct tcf_proto *
   net/sched/cls_api.c:1757:16: sparse:    struct tcf_proto [noderef] __rcu *
   net/sched/cls_api.c:1823:25: sparse: sparse: restricted __be16 degrades to integer
   net/sched/cls_api.c:2497:50: sparse: sparse: restricted __be16 degrades to integer
>> net/sched/cls_api.c:3976:52: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned int [usertype] protocol @@     got restricted __be16 [assigned] [usertype] protocol @@
   net/sched/cls_api.c:3976:52: sparse:     expected unsigned int [usertype] protocol
   net/sched/cls_api.c:3976:52: sparse:     got restricted __be16 [assigned] [usertype] protocol
   net/sched/cls_api.c:3998:50: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned int [usertype] protocol @@     got restricted __be16 [assigned] [usertype] protocol @@
   net/sched/cls_api.c:3998:50: sparse:     expected unsigned int [usertype] protocol
   net/sched/cls_api.c:3998:50: sparse:     got restricted __be16 [assigned] [usertype] protocol
   net/sched/cls_api.c:4006:64: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned int [usertype] protocol @@     got restricted __be16 [assigned] [usertype] protocol @@
   net/sched/cls_api.c:4006:64: sparse:     expected unsigned int [usertype] protocol
   net/sched/cls_api.c:4006:64: sparse:     got restricted __be16 [assigned] [usertype] protocol

vim +3976 net/sched/cls_api.c

  3924	
  3925	int bpf_tc_link_attach(union bpf_attr *attr, struct bpf_prog *prog)
  3926	{
  3927		struct net *net = current->nsproxy->net_ns;
  3928		struct tcf_chain_info chain_info;
  3929		u32 chain_index, prio, parent;
  3930		struct tcf_block *block;
  3931		struct tcf_chain *chain;
  3932		struct tcf_proto *tp;
  3933		int err, tp_created;
  3934		unsigned long cl;
  3935		struct Qdisc *q;
  3936		__be16 protocol;
  3937		void *fh;
  3938	
  3939		/* Caller already checks bpf_capable */
  3940		if (!ns_capable(current->nsproxy->net_ns->user_ns, CAP_NET_ADMIN))
  3941			return -EPERM;
  3942	
  3943		if (attr->link_create.flags ||
  3944		    !attr->link_create.target_ifindex ||
  3945		    !tc_flags_valid(attr->link_create.tc.gen_flags))
  3946			return -EINVAL;
  3947	
  3948	replay:
  3949		parent = attr->link_create.tc.parent;
  3950		prio = attr->link_create.tc.priority;
  3951		protocol = htons(ETH_P_ALL);
  3952		chain_index = 0;
  3953		tp_created = 0;
  3954		prio <<= 16;
  3955		cl = 0;
  3956	
  3957		/* Address this when cls_bpf switches to RTNL_FLAG_DOIT_UNLOCKED */
  3958		rtnl_lock();
  3959	
  3960		block = tcf_block_find(net, &q, &parent, &cl,
  3961				       attr->link_create.target_ifindex, parent, NULL);
  3962		if (IS_ERR(block)) {
  3963			err = PTR_ERR(block);
  3964			goto out_unlock;
  3965		}
  3966		block->classid = parent;
  3967	
  3968		chain = tcf_chain_get(block, chain_index, true);
  3969		if (!chain) {
  3970			err = -ENOMEM;
  3971			goto out_block;
  3972		}
  3973	
  3974		mutex_lock(&chain->filter_chain_lock);
  3975	
> 3976		tp = tcf_chain_tp_find(chain, &chain_info, protocol,
  3977				       prio ?: TC_H_MAKE(0x80000000U, 0U),
  3978				       !prio);
  3979		if (IS_ERR(tp)) {
  3980			err = PTR_ERR(tp);
  3981			goto out_chain_unlock;
  3982		}
  3983	
  3984		if (!tp) {
  3985			struct tcf_proto *tp_new = NULL;
  3986	
  3987			if (chain->flushing) {
  3988				err = -EAGAIN;
  3989				goto out_chain_unlock;
  3990			}
  3991	
  3992			if (!prio)
  3993				prio = tcf_auto_prio(tcf_chain_tp_prev(chain,
  3994								       &chain_info));
  3995	
  3996			mutex_unlock(&chain->filter_chain_lock);
  3997	
  3998			tp_new = tcf_proto_create("bpf", protocol, prio, chain, true,
  3999						  NULL);
  4000			if (IS_ERR(tp_new)) {
  4001				err = PTR_ERR(tp_new);
  4002				goto out_chain;
  4003			}
  4004	
  4005			tp_created = 1;
  4006			tp = tcf_chain_tp_insert_unique(chain, tp_new, protocol, prio,
  4007							true);
  4008			if (IS_ERR(tp)) {
  4009				err = PTR_ERR(tp);
  4010				goto out_chain;
  4011			}
  4012		} else {
  4013			mutex_unlock(&chain->filter_chain_lock);
  4014		}
  4015	
  4016		fh = tp->ops->get(tp, attr->link_create.tc.handle);
  4017	
  4018		if (!tp->ops->bpf_link_change)
  4019			err = -EDEADLK;
  4020		else
  4021			err = tp->ops->bpf_link_change(net, tp, prog, &fh,
  4022						       attr->link_create.tc.handle,
  4023						       attr->link_create.tc.gen_flags);
  4024		if (err >= 0 && q)
  4025			q->flags &= ~TCQ_F_CAN_BYPASS;
  4026	
  4027	out:
  4028		if (err < 0 && tp_created)
  4029			tcf_chain_tp_delete_empty(chain, tp, true, NULL);
  4030	out_chain:
  4031		if (chain) {
  4032			if (!IS_ERR_OR_NULL(tp))
  4033				tcf_proto_put(tp, true, NULL);
  4034			/* Chain reference only kept for tp creation
  4035			 * to pair with tcf_chain_put from tcf_proto_destroy
  4036			 */
  4037			if (!tp_created)
  4038				tcf_chain_put(chain);
  4039		}
  4040	out_block:
  4041		tcf_block_release(q, block, true);
  4042	out_unlock:
  4043		rtnl_unlock();
  4044		if (err == -EAGAIN)
  4045			goto replay;
  4046		return err;
  4047	out_chain_unlock:
  4048		mutex_unlock(&chain->filter_chain_lock);
  4049		goto out;
  4050	}
  4051	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 51346 bytes --]

  reply	other threads:[~2021-06-04 11:33 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04  6:31 [PATCH bpf-next v2 0/7] Add bpf_link based TC-BPF API Kumar Kartikeya Dwivedi
2021-06-04  6:31 ` [PATCH bpf-next v2 1/7] net: sched: refactor cls_bpf creation code Kumar Kartikeya Dwivedi
2021-06-04  6:31 ` [PATCH bpf-next v2 2/7] bpf: export bpf_link functions for modules Kumar Kartikeya Dwivedi
2021-06-04  6:31 ` [PATCH bpf-next v2 3/7] net: sched: add bpf_link API for bpf classifier Kumar Kartikeya Dwivedi
2021-06-04 11:32   ` kernel test robot [this message]
2021-06-05  3:08   ` Yonghong Song
2021-06-05  4:52     ` Kumar Kartikeya Dwivedi
2021-06-07 23:23   ` Andrii Nakryiko
2021-06-04  6:31 ` [PATCH bpf-next v2 4/7] net: sched: add lightweight update path for cls_bpf Kumar Kartikeya Dwivedi
2021-06-04 17:54   ` Alexei Starovoitov
2021-06-05  4:42     ` Kumar Kartikeya Dwivedi
2021-06-07 23:32   ` Andrii Nakryiko
2021-06-10 14:14     ` Kumar Kartikeya Dwivedi
2021-06-04  6:31 ` [PATCH bpf-next v2 5/7] tools: bpf.h: sync with kernel sources Kumar Kartikeya Dwivedi
2021-06-04  6:31 ` [PATCH bpf-next v2 6/7] libbpf: add bpf_link based TC-BPF management API Kumar Kartikeya Dwivedi
2021-06-04 18:01   ` Alexei Starovoitov
2021-06-05  4:51     ` Kumar Kartikeya Dwivedi
2021-06-07 23:37       ` Andrii Nakryiko
2021-06-05 17:09   ` Yonghong Song
2021-06-07 23:41   ` Andrii Nakryiko
2021-06-04  6:31 ` [PATCH bpf-next v2 7/7] libbpf: add selftest for " Kumar Kartikeya Dwivedi
2021-06-05 17:26   ` Yonghong Song
2021-06-07 23:57   ` Andrii Nakryiko
2022-06-10  0:24 ` [PATCH bpf-next v2 0/7] Add bpf_link based TC-BPF API Joanne Koong
2022-06-10 12:58   ` Kumar Kartikeya Dwivedi
2022-06-10 17:23     ` Joanne Koong
2022-06-10 19:07       ` Joanne Koong
2022-06-10 19:34         ` Kumar Kartikeya Dwivedi
2022-06-10 20:04           ` Daniel Borkmann
2022-06-10 22:01             ` Joanne Koong
2022-06-10 20:16           ` Toke Høiland-Jørgensen
2022-06-10 20:35             ` Daniel Borkmann
2022-06-10 20:41               ` Toke Høiland-Jørgensen
2022-06-10 21:52                 ` Alexei Starovoitov
2022-06-10 22:02                   ` Daniel Borkmann
2022-06-11 10:54                     ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202106041949.dHY7EvgX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=jhs@mojatatu.com \
    --cc=kbuild-all@lists.01.org \
    --cc=memxor@gmail.com \
    --cc=toke@redhat.com \
    --cc=vladbu@nvidia.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).