[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201912242100.dN5ncLYq%lkp@intel.com>
Date: Tue, 24 Dec 2019 21:06:30 +0800
From: kbuild test robot <lkp@...el.com>
To: Martin KaFai Lau <kafai@...com>
Cc: kbuild-all@...ts.01.org, bpf@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>, kernel-team@...com,
netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 07/11] bpf: tcp: Support tcp_congestion_ops
in bpf
Hi Martin,
I love your patch! Yet something to improve:
[auto build test ERROR on bpf-next/master]
[cannot apply to bpf/master net/master v5.5-rc3 next-20191219]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Martin-KaFai-Lau/Introduce-BPF-STRUCT_OPS/20191224-085617
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
kernel/bpf/bpf_struct_ops.c: In function 'bpf_struct_ops_init':
kernel/bpf/bpf_struct_ops.c:176:8: error: implicit declaration of function 'btf_distill_func_proto'; did you mean 'btf_type_is_func_proto'? [-Werror=implicit-function-declaration]
btf_distill_func_proto(&log, _btf_vmlinux,
^~~~~~~~~~~~~~~~~~~~~~
btf_type_is_func_proto
kernel/bpf/bpf_struct_ops.c: In function 'bpf_struct_ops_map_update_elem':
kernel/bpf/bpf_struct_ops.c:408:2: error: implicit declaration of function 'bpf_map_inc'; did you mean 'bpf_map_put'? [-Werror=implicit-function-declaration]
bpf_map_inc(map);
^~~~~~~~~~~
bpf_map_put
kernel/bpf/bpf_struct_ops.c: In function 'bpf_struct_ops_map_free':
kernel/bpf/bpf_struct_ops.c:468:2: error: implicit declaration of function 'bpf_map_area_free'; did you mean 'bpf_prog_free'? [-Werror=implicit-function-declaration]
bpf_map_area_free(st_map->progs);
^~~~~~~~~~~~~~~~~
bpf_prog_free
kernel/bpf/bpf_struct_ops.c: In function 'bpf_struct_ops_map_alloc':
>> kernel/bpf/bpf_struct_ops.c:515:8: error: implicit declaration of function 'bpf_map_charge_init'; did you mean 'ip_misc_proc_init'? [-Werror=implicit-function-declaration]
err = bpf_map_charge_init(&mem, map_total_size);
^~~~~~~~~~~~~~~~~~~
ip_misc_proc_init
kernel/bpf/bpf_struct_ops.c:519:11: error: implicit declaration of function 'bpf_map_area_alloc'; did you mean 'bpf_prog_alloc'? [-Werror=implicit-function-declaration]
st_map = bpf_map_area_alloc(st_map_size, NUMA_NO_NODE);
^~~~~~~~~~~~~~~~~~
bpf_prog_alloc
kernel/bpf/bpf_struct_ops.c:519:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
st_map = bpf_map_area_alloc(st_map_size, NUMA_NO_NODE);
^
kernel/bpf/bpf_struct_ops.c:521:3: error: implicit declaration of function 'bpf_map_charge_finish'; did you mean 'bpf_map_flags_to_cap'? [-Werror=implicit-function-declaration]
bpf_map_charge_finish(&mem);
^~~~~~~~~~~~~~~~~~~~~
bpf_map_flags_to_cap
kernel/bpf/bpf_struct_ops.c:527:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
st_map->uvalue = bpf_map_area_alloc(vt->size, NUMA_NO_NODE);
^
kernel/bpf/bpf_struct_ops.c:528:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
st_map->progs =
^
>> kernel/bpf/bpf_struct_ops.c:545:2: error: implicit declaration of function 'bpf_map_init_from_attr'; did you mean 'bioset_init_from_src'? [-Werror=implicit-function-declaration]
bpf_map_init_from_attr(map, attr);
^~~~~~~~~~~~~~~~~~~~~~
bioset_init_from_src
>> kernel/bpf/bpf_struct_ops.c:546:2: error: implicit declaration of function 'bpf_map_charge_move'; did you mean 'bio_map_user_iov'? [-Werror=implicit-function-declaration]
bpf_map_charge_move(&map->memory, &mem);
^~~~~~~~~~~~~~~~~~~
bio_map_user_iov
cc1: some warnings being treated as errors
vim +515 kernel/bpf/bpf_struct_ops.c
d69ac27055a81d Martin KaFai Lau 2019-12-20 461
d69ac27055a81d Martin KaFai Lau 2019-12-20 462 static void bpf_struct_ops_map_free(struct bpf_map *map)
d69ac27055a81d Martin KaFai Lau 2019-12-20 463 {
d69ac27055a81d Martin KaFai Lau 2019-12-20 464 struct bpf_struct_ops_map *st_map = (struct bpf_struct_ops_map *)map;
d69ac27055a81d Martin KaFai Lau 2019-12-20 465
d69ac27055a81d Martin KaFai Lau 2019-12-20 466 if (st_map->progs)
d69ac27055a81d Martin KaFai Lau 2019-12-20 467 bpf_struct_ops_map_put_progs(st_map);
d69ac27055a81d Martin KaFai Lau 2019-12-20 @468 bpf_map_area_free(st_map->progs);
d69ac27055a81d Martin KaFai Lau 2019-12-20 469 bpf_jit_free_exec(st_map->image);
d69ac27055a81d Martin KaFai Lau 2019-12-20 470 bpf_map_area_free(st_map->uvalue);
d69ac27055a81d Martin KaFai Lau 2019-12-20 471 bpf_map_area_free(st_map);
d69ac27055a81d Martin KaFai Lau 2019-12-20 472 }
d69ac27055a81d Martin KaFai Lau 2019-12-20 473
d69ac27055a81d Martin KaFai Lau 2019-12-20 474 static int bpf_struct_ops_map_alloc_check(union bpf_attr *attr)
d69ac27055a81d Martin KaFai Lau 2019-12-20 475 {
d69ac27055a81d Martin KaFai Lau 2019-12-20 476 if (attr->key_size != sizeof(unsigned int) || attr->max_entries != 1 ||
d69ac27055a81d Martin KaFai Lau 2019-12-20 477 attr->map_flags || !attr->btf_vmlinux_value_type_id)
d69ac27055a81d Martin KaFai Lau 2019-12-20 478 return -EINVAL;
d69ac27055a81d Martin KaFai Lau 2019-12-20 479 return 0;
d69ac27055a81d Martin KaFai Lau 2019-12-20 480 }
d69ac27055a81d Martin KaFai Lau 2019-12-20 481
d69ac27055a81d Martin KaFai Lau 2019-12-20 482 static struct bpf_map *bpf_struct_ops_map_alloc(union bpf_attr *attr)
d69ac27055a81d Martin KaFai Lau 2019-12-20 483 {
d69ac27055a81d Martin KaFai Lau 2019-12-20 484 const struct bpf_struct_ops *st_ops;
d69ac27055a81d Martin KaFai Lau 2019-12-20 485 size_t map_total_size, st_map_size;
d69ac27055a81d Martin KaFai Lau 2019-12-20 486 struct bpf_struct_ops_map *st_map;
d69ac27055a81d Martin KaFai Lau 2019-12-20 487 const struct btf_type *t, *vt;
d69ac27055a81d Martin KaFai Lau 2019-12-20 488 struct bpf_map_memory mem;
d69ac27055a81d Martin KaFai Lau 2019-12-20 489 struct bpf_map *map;
d69ac27055a81d Martin KaFai Lau 2019-12-20 490 int err;
d69ac27055a81d Martin KaFai Lau 2019-12-20 491
d69ac27055a81d Martin KaFai Lau 2019-12-20 492 if (!capable(CAP_SYS_ADMIN))
d69ac27055a81d Martin KaFai Lau 2019-12-20 493 return ERR_PTR(-EPERM);
d69ac27055a81d Martin KaFai Lau 2019-12-20 494
d69ac27055a81d Martin KaFai Lau 2019-12-20 495 st_ops = bpf_struct_ops_find_value(attr->btf_vmlinux_value_type_id);
d69ac27055a81d Martin KaFai Lau 2019-12-20 496 if (!st_ops)
d69ac27055a81d Martin KaFai Lau 2019-12-20 497 return ERR_PTR(-ENOTSUPP);
d69ac27055a81d Martin KaFai Lau 2019-12-20 498
d69ac27055a81d Martin KaFai Lau 2019-12-20 499 vt = st_ops->value_type;
d69ac27055a81d Martin KaFai Lau 2019-12-20 500 if (attr->value_size != vt->size)
d69ac27055a81d Martin KaFai Lau 2019-12-20 501 return ERR_PTR(-EINVAL);
d69ac27055a81d Martin KaFai Lau 2019-12-20 502
d69ac27055a81d Martin KaFai Lau 2019-12-20 503 t = st_ops->type;
d69ac27055a81d Martin KaFai Lau 2019-12-20 504
d69ac27055a81d Martin KaFai Lau 2019-12-20 505 st_map_size = sizeof(*st_map) +
d69ac27055a81d Martin KaFai Lau 2019-12-20 506 /* kvalue stores the
d69ac27055a81d Martin KaFai Lau 2019-12-20 507 * struct bpf_struct_ops_tcp_congestions_ops
d69ac27055a81d Martin KaFai Lau 2019-12-20 508 */
d69ac27055a81d Martin KaFai Lau 2019-12-20 509 (vt->size - sizeof(struct bpf_struct_ops_value));
d69ac27055a81d Martin KaFai Lau 2019-12-20 510 map_total_size = st_map_size +
d69ac27055a81d Martin KaFai Lau 2019-12-20 511 /* uvalue */
d69ac27055a81d Martin KaFai Lau 2019-12-20 512 sizeof(vt->size) +
d69ac27055a81d Martin KaFai Lau 2019-12-20 513 /* struct bpf_progs **progs */
d69ac27055a81d Martin KaFai Lau 2019-12-20 514 btf_type_vlen(t) * sizeof(struct bpf_prog *);
d69ac27055a81d Martin KaFai Lau 2019-12-20 @515 err = bpf_map_charge_init(&mem, map_total_size);
d69ac27055a81d Martin KaFai Lau 2019-12-20 516 if (err < 0)
d69ac27055a81d Martin KaFai Lau 2019-12-20 517 return ERR_PTR(err);
d69ac27055a81d Martin KaFai Lau 2019-12-20 518
d69ac27055a81d Martin KaFai Lau 2019-12-20 519 st_map = bpf_map_area_alloc(st_map_size, NUMA_NO_NODE);
d69ac27055a81d Martin KaFai Lau 2019-12-20 520 if (!st_map) {
d69ac27055a81d Martin KaFai Lau 2019-12-20 521 bpf_map_charge_finish(&mem);
d69ac27055a81d Martin KaFai Lau 2019-12-20 522 return ERR_PTR(-ENOMEM);
d69ac27055a81d Martin KaFai Lau 2019-12-20 523 }
d69ac27055a81d Martin KaFai Lau 2019-12-20 524 st_map->st_ops = st_ops;
d69ac27055a81d Martin KaFai Lau 2019-12-20 525 map = &st_map->map;
d69ac27055a81d Martin KaFai Lau 2019-12-20 526
d69ac27055a81d Martin KaFai Lau 2019-12-20 @527 st_map->uvalue = bpf_map_area_alloc(vt->size, NUMA_NO_NODE);
d69ac27055a81d Martin KaFai Lau 2019-12-20 @528 st_map->progs =
d69ac27055a81d Martin KaFai Lau 2019-12-20 529 bpf_map_area_alloc(btf_type_vlen(t) * sizeof(struct bpf_prog *),
d69ac27055a81d Martin KaFai Lau 2019-12-20 530 NUMA_NO_NODE);
d69ac27055a81d Martin KaFai Lau 2019-12-20 531 /* Each trampoline costs < 64 bytes. Ensure one page
d69ac27055a81d Martin KaFai Lau 2019-12-20 532 * is enough for max number of func ptrs.
d69ac27055a81d Martin KaFai Lau 2019-12-20 533 */
d69ac27055a81d Martin KaFai Lau 2019-12-20 534 BUILD_BUG_ON(PAGE_SIZE / 64 < BPF_STRUCT_OPS_MAX_NR_MEMBERS);
d69ac27055a81d Martin KaFai Lau 2019-12-20 535 st_map->image = bpf_jit_alloc_exec(PAGE_SIZE);
d69ac27055a81d Martin KaFai Lau 2019-12-20 536 if (!st_map->uvalue || !st_map->progs || !st_map->image) {
d69ac27055a81d Martin KaFai Lau 2019-12-20 537 bpf_struct_ops_map_free(map);
d69ac27055a81d Martin KaFai Lau 2019-12-20 538 bpf_map_charge_finish(&mem);
d69ac27055a81d Martin KaFai Lau 2019-12-20 539 return ERR_PTR(-ENOMEM);
d69ac27055a81d Martin KaFai Lau 2019-12-20 540 }
d69ac27055a81d Martin KaFai Lau 2019-12-20 541
d69ac27055a81d Martin KaFai Lau 2019-12-20 542 spin_lock_init(&st_map->lock);
d69ac27055a81d Martin KaFai Lau 2019-12-20 543 set_vm_flush_reset_perms(st_map->image);
d69ac27055a81d Martin KaFai Lau 2019-12-20 544 set_memory_x((long)st_map->image, 1);
d69ac27055a81d Martin KaFai Lau 2019-12-20 @545 bpf_map_init_from_attr(map, attr);
d69ac27055a81d Martin KaFai Lau 2019-12-20 @546 bpf_map_charge_move(&map->memory, &mem);
d69ac27055a81d Martin KaFai Lau 2019-12-20 547
d69ac27055a81d Martin KaFai Lau 2019-12-20 548 return map;
d69ac27055a81d Martin KaFai Lau 2019-12-20 549 }
d69ac27055a81d Martin KaFai Lau 2019-12-20 550
:::::: The code at line 515 was first introduced by commit
:::::: d69ac27055a81d26ee1bfe54b9655cf81ebd5ac9 bpf: Introduce BPF_MAP_TYPE_STRUCT_OPS
:::::: TO: Martin KaFai Lau <kafai@...com>
:::::: CC: 0day robot <lkp@...el.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (46481 bytes)
Powered by blists - more mailing lists