All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for BPF XDP link
  2020-07-14  4:06 [PATCH v2 bpf-next 0/8] " Andrii Nakryiko
@ 2020-07-14  4:06 ` Andrii Nakryiko
  2020-07-14  5:42     ` kernel test robot
  2020-07-14  5:48     ` kernel test robot
  0 siblings, 2 replies; 6+ messages in thread
From: Andrii Nakryiko @ 2020-07-14  4:06 UTC (permalink / raw
  To: bpf, netdev, ast, daniel, dsahern
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko, Andrey Ignatov,
	Takshak Chahande

Add support for LINK_UPDATE command for BPF XDP link to enable reliable
replacement of underlying BPF program.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 net/core/dev.c | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 4a9a9d53d844..7c2935d567c4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8989,9 +8989,52 @@ static void bpf_xdp_link_dealloc(struct bpf_link *link)
 	kfree(xdp_link);
 }
 
+static int bpf_xdp_link_update(struct bpf_link *link, struct bpf_prog *new_prog,
+			       struct bpf_prog *old_prog)
+{
+	struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
+	enum bpf_xdp_mode mode;
+	bpf_op_t bpf_op;
+	int err = 0;
+
+	rtnl_lock();
+
+	/* link might have been auto-released already, so fail */
+	if (!xdp_link->dev) {
+		err = -ENOLINK;
+		goto out_unlock;
+	}
+
+	if (old_prog && link->prog != old_prog) {
+		err = -EPERM;
+		goto out_unlock;
+	}
+	old_prog = link->prog;
+	if (old_prog == new_prog) {
+		/* no-op, don't disturb drivers */
+		bpf_prog_put(new_prog);
+		goto out_unlock;
+	}
+
+	mode = dev_xdp_mode(xdp_link->flags);
+	bpf_op = dev_xdp_bpf_op(xdp_link->dev, mode);
+	err = dev_xdp_install(xdp_link->dev, mode, bpf_op, NULL,
+			      xdp_link->flags, new_prog);
+	if (err)
+		goto out_unlock;
+
+	old_prog = xchg(&link->prog, new_prog);
+	bpf_prog_put(old_prog);
+
+out_unlock:
+	rtnl_unlock();
+	return err;
+}
+
 static const struct bpf_link_ops bpf_xdp_link_lops = {
 	.release = bpf_xdp_link_release,
 	.dealloc = bpf_xdp_link_dealloc,
+	.update_prog = bpf_xdp_link_update,
 };
 
 int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for BPF XDP link
  2020-07-14  4:06 ` [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for " Andrii Nakryiko
@ 2020-07-14  5:42     ` kernel test robot
  2020-07-14  5:48     ` kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-07-14  5:42 UTC (permalink / raw
  To: Andrii Nakryiko, bpf, netdev, ast, daniel, dsahern
  Cc: kbuild-all, andrii.nakryiko, kernel-team, Andrii Nakryiko,
	Andrey Ignatov, Takshak Chahande

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

Hi Andrii,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/BPF-XDP-link/20200714-120909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: parisc-defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

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

All warnings (new ones prefixed by >>):

   net/core/dev.c:8717:18: error: field 'link' has incomplete type
    8717 |  struct bpf_link link;
         |                  ^~~~
   In file included from include/linux/instrumented.h:10,
                    from include/linux/uaccess.h:5,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_release':
   include/linux/kernel.h:1003:32: error: dereferencing pointer to incomplete type 'struct bpf_link'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
   net/core/dev.c:8972:34: note: in expansion of macro 'container_of'
    8972 |  struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
         |                                  ^~~~~~~~~~~~
   In file included from arch/parisc/include/asm/atomic.h:10,
                    from include/linux/atomic.h:7,
                    from arch/parisc/include/asm/bitops.h:13,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from arch/parisc/include/asm/bug.h:5,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/parisc/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/uaccess.h:6,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_update':
>> arch/parisc/include/asm/cmpxchg.h:50:27: warning: initialization of 'int' from 'struct bpf_prog *' makes integer from pointer without a cast [-Wint-conversion]
      50 |  __typeof__(*(ptr)) _x_ = (x);     \
         |                           ^
   net/core/dev.c:9026:13: note: in expansion of macro 'xchg'
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |             ^~~~
   net/core/dev.c:9026:11: warning: assignment to 'struct bpf_prog *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |           ^
   net/core/dev.c: At top level:
   net/core/dev.c:9034:21: error: variable 'bpf_xdp_link_lops' has initializer but incomplete type
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                     ^~~~~~~~~~~~
   net/core/dev.c:9035:3: error: 'const struct bpf_link_ops' has no member named 'release'
    9035 |  .release = bpf_xdp_link_release,
         |   ^~~~~~~
   net/core/dev.c:9035:13: warning: excess elements in struct initializer
    9035 |  .release = bpf_xdp_link_release,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9035:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9036:3: error: 'const struct bpf_link_ops' has no member named 'dealloc'
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |   ^~~~~~~
   net/core/dev.c:9036:13: warning: excess elements in struct initializer
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9036:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9037:3: error: 'const struct bpf_link_ops' has no member named 'update_prog'
    9037 |  .update_prog = bpf_xdp_link_update,
         |   ^~~~~~~~~~~
   net/core/dev.c:9037:17: warning: excess elements in struct initializer
    9037 |  .update_prog = bpf_xdp_link_update,
         |                 ^~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9037:17: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c: In function 'bpf_xdp_link_attach':
   net/core/dev.c:9043:25: error: storage size of 'link_primer' isn't known
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c:9058:2: error: implicit declaration of function 'bpf_link_init'; did you mean 'bio_list_init'? [-Werror=implicit-function-declaration]
    9058 |  bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog);
         |  ^~~~~~~~~~~~~
         |  bio_list_init
   net/core/dev.c:9062:8: error: implicit declaration of function 'bpf_link_prime' [-Werror=implicit-function-declaration]
    9062 |  err = bpf_link_prime(&link->link, &link_primer);
         |        ^~~~~~~~~~~~~~
   net/core/dev.c:9073:3: error: implicit declaration of function 'bpf_link_cleanup' [-Werror=implicit-function-declaration]
    9073 |   bpf_link_cleanup(&link_primer);
         |   ^~~~~~~~~~~~~~~~
   net/core/dev.c:9077:7: error: implicit declaration of function 'bpf_link_settle' [-Werror=implicit-function-declaration]
    9077 |  fd = bpf_link_settle(&link_primer);
         |       ^~~~~~~~~~~~~~~
   net/core/dev.c:9043:25: warning: unused variable 'link_primer' [-Wunused-variable]
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c: At top level:
   net/core/dev.c:9034:34: error: storage size of 'bpf_xdp_link_lops' isn't known
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                                  ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +50 arch/parisc/include/asm/cmpxchg.h

9e5228ce0b9619 Paul Gortmaker 2012-04-01  37  
9e5228ce0b9619 Paul Gortmaker 2012-04-01  38  /*
9e5228ce0b9619 Paul Gortmaker 2012-04-01  39  ** REVISIT - Abandoned use of LDCW in xchg() for now:
9e5228ce0b9619 Paul Gortmaker 2012-04-01  40  ** o need to test sizeof(*ptr) to avoid clearing adjacent bytes
9e5228ce0b9619 Paul Gortmaker 2012-04-01  41  ** o and while we are at it, could CONFIG_64BIT code use LDCD too?
9e5228ce0b9619 Paul Gortmaker 2012-04-01  42  **
9e5228ce0b9619 Paul Gortmaker 2012-04-01  43  **	if (__builtin_constant_p(x) && (x == NULL))
9e5228ce0b9619 Paul Gortmaker 2012-04-01  44  **		if (((unsigned long)p & 0xf) == 0)
9e5228ce0b9619 Paul Gortmaker 2012-04-01  45  **			return __ldcw(p);
9e5228ce0b9619 Paul Gortmaker 2012-04-01  46  */
9e5228ce0b9619 Paul Gortmaker 2012-04-01  47  #define xchg(ptr, x)							\
75cf9797006a3a Helge Deller   2019-12-20  48  ({									\
75cf9797006a3a Helge Deller   2019-12-20  49  	__typeof__(*(ptr)) __ret;					\
75cf9797006a3a Helge Deller   2019-12-20 @50  	__typeof__(*(ptr)) _x_ = (x);					\
75cf9797006a3a Helge Deller   2019-12-20  51  	__ret = (__typeof__(*(ptr)))					\
75cf9797006a3a Helge Deller   2019-12-20  52  		__xchg((unsigned long)_x_, (ptr), sizeof(*(ptr)));	\
75cf9797006a3a Helge Deller   2019-12-20  53  	__ret;								\
75cf9797006a3a Helge Deller   2019-12-20  54  })
9e5228ce0b9619 Paul Gortmaker 2012-04-01  55  

---
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: 18584 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for BPF XDP link
@ 2020-07-14  5:42     ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-07-14  5:42 UTC (permalink / raw
  To: kbuild-all

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

Hi Andrii,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/BPF-XDP-link/20200714-120909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: parisc-defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

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

All warnings (new ones prefixed by >>):

   net/core/dev.c:8717:18: error: field 'link' has incomplete type
    8717 |  struct bpf_link link;
         |                  ^~~~
   In file included from include/linux/instrumented.h:10,
                    from include/linux/uaccess.h:5,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_release':
   include/linux/kernel.h:1003:32: error: dereferencing pointer to incomplete type 'struct bpf_link'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
   net/core/dev.c:8972:34: note: in expansion of macro 'container_of'
    8972 |  struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
         |                                  ^~~~~~~~~~~~
   In file included from arch/parisc/include/asm/atomic.h:10,
                    from include/linux/atomic.h:7,
                    from arch/parisc/include/asm/bitops.h:13,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from arch/parisc/include/asm/bug.h:5,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/parisc/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/uaccess.h:6,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_update':
>> arch/parisc/include/asm/cmpxchg.h:50:27: warning: initialization of 'int' from 'struct bpf_prog *' makes integer from pointer without a cast [-Wint-conversion]
      50 |  __typeof__(*(ptr)) _x_ = (x);     \
         |                           ^
   net/core/dev.c:9026:13: note: in expansion of macro 'xchg'
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |             ^~~~
   net/core/dev.c:9026:11: warning: assignment to 'struct bpf_prog *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |           ^
   net/core/dev.c: At top level:
   net/core/dev.c:9034:21: error: variable 'bpf_xdp_link_lops' has initializer but incomplete type
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                     ^~~~~~~~~~~~
   net/core/dev.c:9035:3: error: 'const struct bpf_link_ops' has no member named 'release'
    9035 |  .release = bpf_xdp_link_release,
         |   ^~~~~~~
   net/core/dev.c:9035:13: warning: excess elements in struct initializer
    9035 |  .release = bpf_xdp_link_release,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9035:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9036:3: error: 'const struct bpf_link_ops' has no member named 'dealloc'
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |   ^~~~~~~
   net/core/dev.c:9036:13: warning: excess elements in struct initializer
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9036:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9037:3: error: 'const struct bpf_link_ops' has no member named 'update_prog'
    9037 |  .update_prog = bpf_xdp_link_update,
         |   ^~~~~~~~~~~
   net/core/dev.c:9037:17: warning: excess elements in struct initializer
    9037 |  .update_prog = bpf_xdp_link_update,
         |                 ^~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9037:17: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c: In function 'bpf_xdp_link_attach':
   net/core/dev.c:9043:25: error: storage size of 'link_primer' isn't known
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c:9058:2: error: implicit declaration of function 'bpf_link_init'; did you mean 'bio_list_init'? [-Werror=implicit-function-declaration]
    9058 |  bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog);
         |  ^~~~~~~~~~~~~
         |  bio_list_init
   net/core/dev.c:9062:8: error: implicit declaration of function 'bpf_link_prime' [-Werror=implicit-function-declaration]
    9062 |  err = bpf_link_prime(&link->link, &link_primer);
         |        ^~~~~~~~~~~~~~
   net/core/dev.c:9073:3: error: implicit declaration of function 'bpf_link_cleanup' [-Werror=implicit-function-declaration]
    9073 |   bpf_link_cleanup(&link_primer);
         |   ^~~~~~~~~~~~~~~~
   net/core/dev.c:9077:7: error: implicit declaration of function 'bpf_link_settle' [-Werror=implicit-function-declaration]
    9077 |  fd = bpf_link_settle(&link_primer);
         |       ^~~~~~~~~~~~~~~
   net/core/dev.c:9043:25: warning: unused variable 'link_primer' [-Wunused-variable]
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c: At top level:
   net/core/dev.c:9034:34: error: storage size of 'bpf_xdp_link_lops' isn't known
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                                  ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +50 arch/parisc/include/asm/cmpxchg.h

9e5228ce0b9619 Paul Gortmaker 2012-04-01  37  
9e5228ce0b9619 Paul Gortmaker 2012-04-01  38  /*
9e5228ce0b9619 Paul Gortmaker 2012-04-01  39  ** REVISIT - Abandoned use of LDCW in xchg() for now:
9e5228ce0b9619 Paul Gortmaker 2012-04-01  40  ** o need to test sizeof(*ptr) to avoid clearing adjacent bytes
9e5228ce0b9619 Paul Gortmaker 2012-04-01  41  ** o and while we are at it, could CONFIG_64BIT code use LDCD too?
9e5228ce0b9619 Paul Gortmaker 2012-04-01  42  **
9e5228ce0b9619 Paul Gortmaker 2012-04-01  43  **	if (__builtin_constant_p(x) && (x == NULL))
9e5228ce0b9619 Paul Gortmaker 2012-04-01  44  **		if (((unsigned long)p & 0xf) == 0)
9e5228ce0b9619 Paul Gortmaker 2012-04-01  45  **			return __ldcw(p);
9e5228ce0b9619 Paul Gortmaker 2012-04-01  46  */
9e5228ce0b9619 Paul Gortmaker 2012-04-01  47  #define xchg(ptr, x)							\
75cf9797006a3a Helge Deller   2019-12-20  48  ({									\
75cf9797006a3a Helge Deller   2019-12-20  49  	__typeof__(*(ptr)) __ret;					\
75cf9797006a3a Helge Deller   2019-12-20 @50  	__typeof__(*(ptr)) _x_ = (x);					\
75cf9797006a3a Helge Deller   2019-12-20  51  	__ret = (__typeof__(*(ptr)))					\
75cf9797006a3a Helge Deller   2019-12-20  52  		__xchg((unsigned long)_x_, (ptr), sizeof(*(ptr)));	\
75cf9797006a3a Helge Deller   2019-12-20  53  	__ret;								\
75cf9797006a3a Helge Deller   2019-12-20  54  })
9e5228ce0b9619 Paul Gortmaker 2012-04-01  55  

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for BPF XDP link
  2020-07-14  4:06 ` [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for " Andrii Nakryiko
@ 2020-07-14  5:48     ` kernel test robot
  2020-07-14  5:48     ` kernel test robot
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-07-14  5:48 UTC (permalink / raw
  To: Andrii Nakryiko, bpf, netdev, ast, daniel, dsahern
  Cc: kbuild-all, andrii.nakryiko, kernel-team, Andrii Nakryiko,
	Andrey Ignatov, Takshak Chahande

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

Hi Andrii,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/BPF-XDP-link/20200714-120909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: alpha-defconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha 

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

All warnings (new ones prefixed by >>):

   net/core/dev.c:8717:18: error: field 'link' has incomplete type
    8717 |  struct bpf_link link;
         |                  ^~~~
   In file included from include/linux/instrumented.h:10,
                    from include/linux/uaccess.h:5,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_release':
   include/linux/kernel.h:1003:32: error: dereferencing pointer to incomplete type 'struct bpf_link'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
   net/core/dev.c:8972:34: note: in expansion of macro 'container_of'
    8972 |  struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
         |                                  ^~~~~~~~~~~~
   In file included from arch/alpha/include/asm/atomic.h:7,
                    from include/linux/atomic.h:7,
                    from include/linux/rcupdate.h:25,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/uaccess.h:6,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_update':
>> arch/alpha/include/asm/cmpxchg.h:48:27: warning: initialization of 'int' from 'struct bpf_prog *' makes integer from pointer without a cast [-Wint-conversion]
      48 |  __typeof__(*(ptr)) _x_ = (x);     \
         |                           ^
   net/core/dev.c:9026:13: note: in expansion of macro 'xchg'
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |             ^~~~
   net/core/dev.c:9026:11: warning: assignment to 'struct bpf_prog *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |           ^
   net/core/dev.c: At top level:
   net/core/dev.c:9034:21: error: variable 'bpf_xdp_link_lops' has initializer but incomplete type
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                     ^~~~~~~~~~~~
   net/core/dev.c:9035:3: error: 'const struct bpf_link_ops' has no member named 'release'
    9035 |  .release = bpf_xdp_link_release,
         |   ^~~~~~~
   net/core/dev.c:9035:13: warning: excess elements in struct initializer
    9035 |  .release = bpf_xdp_link_release,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9035:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9036:3: error: 'const struct bpf_link_ops' has no member named 'dealloc'
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |   ^~~~~~~
   net/core/dev.c:9036:13: warning: excess elements in struct initializer
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9036:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9037:3: error: 'const struct bpf_link_ops' has no member named 'update_prog'
    9037 |  .update_prog = bpf_xdp_link_update,
         |   ^~~~~~~~~~~
   net/core/dev.c:9037:17: warning: excess elements in struct initializer
    9037 |  .update_prog = bpf_xdp_link_update,
         |                 ^~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9037:17: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c: In function 'bpf_xdp_link_attach':
   net/core/dev.c:9043:25: error: storage size of 'link_primer' isn't known
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c:9058:2: error: implicit declaration of function 'bpf_link_init'; did you mean 'bio_list_init'? [-Werror=implicit-function-declaration]
    9058 |  bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog);
         |  ^~~~~~~~~~~~~
         |  bio_list_init
   net/core/dev.c:9062:8: error: implicit declaration of function 'bpf_link_prime' [-Werror=implicit-function-declaration]
    9062 |  err = bpf_link_prime(&link->link, &link_primer);
         |        ^~~~~~~~~~~~~~
   net/core/dev.c:9073:3: error: implicit declaration of function 'bpf_link_cleanup' [-Werror=implicit-function-declaration]
    9073 |   bpf_link_cleanup(&link_primer);
         |   ^~~~~~~~~~~~~~~~
   net/core/dev.c:9077:7: error: implicit declaration of function 'bpf_link_settle' [-Werror=implicit-function-declaration]
    9077 |  fd = bpf_link_settle(&link_primer);
         |       ^~~~~~~~~~~~~~~
   net/core/dev.c:9043:25: warning: unused variable 'link_primer' [-Wunused-variable]
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c: At top level:
   net/core/dev.c:9034:34: error: storage size of 'bpf_xdp_link_lops' isn't known
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                                  ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +48 arch/alpha/include/asm/cmpxchg.h

5ba840f9da1ff9 Paul Gortmaker 2012-04-02  40  
fbfcd019917098 Andrea Parri   2018-02-27  41  /*
fbfcd019917098 Andrea Parri   2018-02-27  42   * The leading and the trailing memory barriers guarantee that these
fbfcd019917098 Andrea Parri   2018-02-27  43   * operations are fully ordered.
fbfcd019917098 Andrea Parri   2018-02-27  44   */
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  45  #define xchg(ptr, x)							\
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  46  ({									\
fbfcd019917098 Andrea Parri   2018-02-27  47  	__typeof__(*(ptr)) __ret;					\
5ba840f9da1ff9 Paul Gortmaker 2012-04-02 @48  	__typeof__(*(ptr)) _x_ = (x);					\
fbfcd019917098 Andrea Parri   2018-02-27  49  	smp_mb();							\
fbfcd019917098 Andrea Parri   2018-02-27  50  	__ret = (__typeof__(*(ptr)))					\
fbfcd019917098 Andrea Parri   2018-02-27  51  		__xchg((ptr), (unsigned long)_x_, sizeof(*(ptr)));	\
fbfcd019917098 Andrea Parri   2018-02-27  52  	smp_mb();							\
fbfcd019917098 Andrea Parri   2018-02-27  53  	__ret;								\
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  54  })
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  55  

---
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: 13790 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for BPF XDP link
@ 2020-07-14  5:48     ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-07-14  5:48 UTC (permalink / raw
  To: kbuild-all

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

Hi Andrii,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/BPF-XDP-link/20200714-120909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: alpha-defconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha 

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

All warnings (new ones prefixed by >>):

   net/core/dev.c:8717:18: error: field 'link' has incomplete type
    8717 |  struct bpf_link link;
         |                  ^~~~
   In file included from include/linux/instrumented.h:10,
                    from include/linux/uaccess.h:5,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_release':
   include/linux/kernel.h:1003:32: error: dereferencing pointer to incomplete type 'struct bpf_link'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
   net/core/dev.c:8972:34: note: in expansion of macro 'container_of'
    8972 |  struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
         |                                  ^~~~~~~~~~~~
   In file included from arch/alpha/include/asm/atomic.h:7,
                    from include/linux/atomic.h:7,
                    from include/linux/rcupdate.h:25,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/uaccess.h:6,
                    from net/core/dev.c:71:
   net/core/dev.c: In function 'bpf_xdp_link_update':
>> arch/alpha/include/asm/cmpxchg.h:48:27: warning: initialization of 'int' from 'struct bpf_prog *' makes integer from pointer without a cast [-Wint-conversion]
      48 |  __typeof__(*(ptr)) _x_ = (x);     \
         |                           ^
   net/core/dev.c:9026:13: note: in expansion of macro 'xchg'
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |             ^~~~
   net/core/dev.c:9026:11: warning: assignment to 'struct bpf_prog *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9026 |  old_prog = xchg(&link->prog, new_prog);
         |           ^
   net/core/dev.c: At top level:
   net/core/dev.c:9034:21: error: variable 'bpf_xdp_link_lops' has initializer but incomplete type
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                     ^~~~~~~~~~~~
   net/core/dev.c:9035:3: error: 'const struct bpf_link_ops' has no member named 'release'
    9035 |  .release = bpf_xdp_link_release,
         |   ^~~~~~~
   net/core/dev.c:9035:13: warning: excess elements in struct initializer
    9035 |  .release = bpf_xdp_link_release,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9035:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9036:3: error: 'const struct bpf_link_ops' has no member named 'dealloc'
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |   ^~~~~~~
   net/core/dev.c:9036:13: warning: excess elements in struct initializer
    9036 |  .dealloc = bpf_xdp_link_dealloc,
         |             ^~~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9036:13: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c:9037:3: error: 'const struct bpf_link_ops' has no member named 'update_prog'
    9037 |  .update_prog = bpf_xdp_link_update,
         |   ^~~~~~~~~~~
   net/core/dev.c:9037:17: warning: excess elements in struct initializer
    9037 |  .update_prog = bpf_xdp_link_update,
         |                 ^~~~~~~~~~~~~~~~~~~
   net/core/dev.c:9037:17: note: (near initialization for 'bpf_xdp_link_lops')
   net/core/dev.c: In function 'bpf_xdp_link_attach':
   net/core/dev.c:9043:25: error: storage size of 'link_primer' isn't known
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c:9058:2: error: implicit declaration of function 'bpf_link_init'; did you mean 'bio_list_init'? [-Werror=implicit-function-declaration]
    9058 |  bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog);
         |  ^~~~~~~~~~~~~
         |  bio_list_init
   net/core/dev.c:9062:8: error: implicit declaration of function 'bpf_link_prime' [-Werror=implicit-function-declaration]
    9062 |  err = bpf_link_prime(&link->link, &link_primer);
         |        ^~~~~~~~~~~~~~
   net/core/dev.c:9073:3: error: implicit declaration of function 'bpf_link_cleanup' [-Werror=implicit-function-declaration]
    9073 |   bpf_link_cleanup(&link_primer);
         |   ^~~~~~~~~~~~~~~~
   net/core/dev.c:9077:7: error: implicit declaration of function 'bpf_link_settle' [-Werror=implicit-function-declaration]
    9077 |  fd = bpf_link_settle(&link_primer);
         |       ^~~~~~~~~~~~~~~
   net/core/dev.c:9043:25: warning: unused variable 'link_primer' [-Wunused-variable]
    9043 |  struct bpf_link_primer link_primer;
         |                         ^~~~~~~~~~~
   net/core/dev.c: At top level:
   net/core/dev.c:9034:34: error: storage size of 'bpf_xdp_link_lops' isn't known
    9034 | static const struct bpf_link_ops bpf_xdp_link_lops = {
         |                                  ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +48 arch/alpha/include/asm/cmpxchg.h

5ba840f9da1ff9 Paul Gortmaker 2012-04-02  40  
fbfcd019917098 Andrea Parri   2018-02-27  41  /*
fbfcd019917098 Andrea Parri   2018-02-27  42   * The leading and the trailing memory barriers guarantee that these
fbfcd019917098 Andrea Parri   2018-02-27  43   * operations are fully ordered.
fbfcd019917098 Andrea Parri   2018-02-27  44   */
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  45  #define xchg(ptr, x)							\
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  46  ({									\
fbfcd019917098 Andrea Parri   2018-02-27  47  	__typeof__(*(ptr)) __ret;					\
5ba840f9da1ff9 Paul Gortmaker 2012-04-02 @48  	__typeof__(*(ptr)) _x_ = (x);					\
fbfcd019917098 Andrea Parri   2018-02-27  49  	smp_mb();							\
fbfcd019917098 Andrea Parri   2018-02-27  50  	__ret = (__typeof__(*(ptr)))					\
fbfcd019917098 Andrea Parri   2018-02-27  51  		__xchg((ptr), (unsigned long)_x_, sizeof(*(ptr)));	\
fbfcd019917098 Andrea Parri   2018-02-27  52  	smp_mb();							\
fbfcd019917098 Andrea Parri   2018-02-27  53  	__ret;								\
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  54  })
5ba840f9da1ff9 Paul Gortmaker 2012-04-02  55  

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for BPF XDP link
@ 2020-07-14 14:03 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-07-14 14:03 UTC (permalink / raw
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200714040643.1135876-5-andriin@fb.com>
References: <20200714040643.1135876-5-andriin@fb.com>
TO: Andrii Nakryiko <andriin@fb.com>
TO: bpf(a)vger.kernel.org
TO: netdev(a)vger.kernel.org
TO: ast(a)fb.com
TO: daniel(a)iogearbox.net
TO: dsahern(a)gmail.com
CC: andrii.nakryiko(a)gmail.com
CC: kernel-team(a)fb.com
CC: Andrii Nakryiko <andriin@fb.com>
CC: Andrey Ignatov <rdna@fb.com>
CC: Takshak Chahande <ctakshak@fb.com>

Hi Andrii,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/BPF-XDP-link/20200714-120909
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: openrisc-randconfig-s032-20200714 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-41-g14e84ffc-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc 

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/core/dev.c:3270:23: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected restricted __wsum [usertype] csum @@     got unsigned int @@
   net/core/dev.c:3270:23: sparse:     expected restricted __wsum [usertype] csum
   net/core/dev.c:3270:23: sparse:     got unsigned int
   net/core/dev.c:3270:23: sparse: sparse: cast from restricted __wsum
   net/core/dev.c:3270:23: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected restricted __wsum [usertype] csum @@     got unsigned int @@
   net/core/dev.c:3270:23: sparse:     expected restricted __wsum [usertype] csum
   net/core/dev.c:3270:23: sparse:     got unsigned int
   net/core/dev.c:3270:23: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] val @@     got restricted __wsum @@
   net/core/dev.c:3270:23: sparse:     expected unsigned int [usertype] val
   net/core/dev.c:3270:23: sparse:     got restricted __wsum
   net/core/dev.c:3270:23: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected restricted __wsum [usertype] csum @@     got unsigned int @@
   net/core/dev.c:3270:23: sparse:     expected restricted __wsum [usertype] csum
   net/core/dev.c:3270:23: sparse:     got unsigned int
   net/core/dev.c:3270:23: sparse: sparse: cast from restricted __wsum
   net/core/dev.c:3270:23: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected restricted __wsum [usertype] csum @@     got unsigned int @@
   net/core/dev.c:3270:23: sparse:     expected restricted __wsum [usertype] csum
   net/core/dev.c:3270:23: sparse:     got unsigned int
   net/core/dev.c:3270:23: sparse: sparse: cast from restricted __wsum
   net/core/dev.c:3270:23: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected restricted __wsum [usertype] csum @@     got unsigned int @@
   net/core/dev.c:3270:23: sparse:     expected restricted __wsum [usertype] csum
   net/core/dev.c:3270:23: sparse:     got unsigned int
   net/core/dev.c:3270:23: sparse: sparse: cast from restricted __wsum
   net/core/dev.c:3270:23: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected restricted __wsum [usertype] csum @@     got unsigned int @@
   net/core/dev.c:3270:23: sparse:     expected restricted __wsum [usertype] csum
   net/core/dev.c:3270:23: sparse:     got unsigned int
   net/core/dev.c:3270:23: sparse: sparse: cast from restricted __wsum
   net/core/dev.c:8756:34: sparse: sparse: using member 'prog' in incomplete struct bpf_link
   net/core/dev.c:8900:38: sparse: sparse: using member 'prog' in incomplete struct bpf_link
   net/core/dev.c:9008:29: sparse: sparse: using member 'prog' in incomplete struct bpf_link
   net/core/dev.c:9012:24: sparse: sparse: using member 'prog' in incomplete struct bpf_link
   net/core/dev.c:9026:20: sparse: sparse: using member 'prog' in incomplete struct bpf_link
   net/core/dev.c:9026:20: sparse: sparse: using member 'prog' in incomplete struct bpf_link
>> net/core/dev.c:9026:20: sparse: sparse: cast from unknown type
   net/core/dev.c:9035:10: sparse: sparse: unknown field name in initializer
   net/core/dev.c:9036:10: sparse: sparse: unknown field name in initializer
   net/core/dev.c:9037:10: sparse: sparse: unknown field name in initializer
   net/core/dev.c:9058:9: sparse: sparse: undefined identifier 'bpf_link_init'
   net/core/dev.c:9062:15: sparse: sparse: undefined identifier 'bpf_link_prime'
   net/core/dev.c:9073:17: sparse: sparse: undefined identifier 'bpf_link_cleanup'
   net/core/dev.c:9077:14: sparse: sparse: undefined identifier 'bpf_link_settle'
   net/core/dev.c:3753:26: sparse: sparse: context imbalance in '__dev_queue_xmit' - different lock contexts for basic block
   net/core/dev.c:4902:44: sparse: sparse: context imbalance in 'net_tx_action' - unexpected unlock
   arch/openrisc/include/asm/cmpxchg.h:69:29: sparse: sparse: shift too big (32) for type int
   arch/openrisc/include/asm/cmpxchg.h:69:29: sparse: sparse: shift too big (32) for type int
   arch/openrisc/include/asm/cmpxchg.h:69:29: sparse: sparse: shift too big (32) for type int

# https://github.com/0day-ci/linux/commit/178cbca5e507b463132ea2d14a40239080139381
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 178cbca5e507b463132ea2d14a40239080139381
vim +9026 net/core/dev.c

e34835d800321e Andrii Nakryiko 2020-07-13  8991  
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8992  static int bpf_xdp_link_update(struct bpf_link *link, struct bpf_prog *new_prog,
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8993  			       struct bpf_prog *old_prog)
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8994  {
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8995  	struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8996  	enum bpf_xdp_mode mode;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8997  	bpf_op_t bpf_op;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8998  	int err = 0;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  8999  
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9000  	rtnl_lock();
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9001  
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9002  	/* link might have been auto-released already, so fail */
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9003  	if (!xdp_link->dev) {
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9004  		err = -ENOLINK;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9005  		goto out_unlock;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9006  	}
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9007  
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9008  	if (old_prog && link->prog != old_prog) {
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9009  		err = -EPERM;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9010  		goto out_unlock;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9011  	}
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9012  	old_prog = link->prog;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9013  	if (old_prog == new_prog) {
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9014  		/* no-op, don't disturb drivers */
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9015  		bpf_prog_put(new_prog);
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9016  		goto out_unlock;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9017  	}
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9018  
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9019  	mode = dev_xdp_mode(xdp_link->flags);
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9020  	bpf_op = dev_xdp_bpf_op(xdp_link->dev, mode);
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9021  	err = dev_xdp_install(xdp_link->dev, mode, bpf_op, NULL,
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9022  			      xdp_link->flags, new_prog);
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9023  	if (err)
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9024  		goto out_unlock;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9025  
178cbca5e507b4 Andrii Nakryiko 2020-07-13 @9026  	old_prog = xchg(&link->prog, new_prog);
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9027  	bpf_prog_put(old_prog);
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9028  
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9029  out_unlock:
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9030  	rtnl_unlock();
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9031  	return err;
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9032  }
178cbca5e507b4 Andrii Nakryiko 2020-07-13  9033  

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-14 14:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14 14:03 [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for BPF XDP link kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2020-07-14  4:06 [PATCH v2 bpf-next 0/8] " Andrii Nakryiko
2020-07-14  4:06 ` [PATCH v2 bpf-next 4/8] bpf, xdp: implement LINK_UPDATE for " Andrii Nakryiko
2020-07-14  5:42   ` kernel test robot
2020-07-14  5:42     ` kernel test robot
2020-07-14  5:48   ` kernel test robot
2020-07-14  5:48     ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.