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 <l...@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-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

Reply via email to