Re: [bpf-next:master 5/7] kernel/bpf/core.c:900:5: warning: '__pte_index_size' is not defined, evaluates to 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Puranjay,

Looks like I have to drop this patch for now,
since PMD_SIZE is not a constant on all archs
that can be evaluated by a preprocessor.

We need to find a different way.


On Sat, Mar 9, 2024 at 7:04 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> head:   d0d131e3b655fd267d14bb1bed49e3f990a1465e
> commit: 643714ff18301f41bded2489e8f1f9d1b4782094 [5/7] bpf: cap BPF_PROG_PACK_SIZE to 2MB * num_possible_nodes()
> config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20240309/202403092219.dhgcuz2G-lkp@xxxxxxxxx/config)
> compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 503c55e17037436dcd45ac69dea8967e67e3f5e8)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240309/202403092219.dhgcuz2G-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202403092219.dhgcuz2G-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):
>
>    In file included from kernel/bpf/core.c:21:
>    In file included from include/linux/filter.h:9:
>    In file included from include/linux/bpf.h:21:
>    In file included from include/linux/kallsyms.h:13:
>    In file included from include/linux/mm.h:2188:
>    include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>      508 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      509 |                            item];
>          |                            ~~~~
>    include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>      515 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      516 |                            NR_VM_NUMA_EVENT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>      522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
>          |                               ~~~~~~~~~~~ ^ ~~~
>    include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>      527 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      528 |                            NR_VM_NUMA_EVENT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>      536 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      537 |                            NR_VM_NUMA_EVENT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~~
>    In file included from kernel/bpf/core.c:21:
>    In file included from include/linux/filter.h:9:
>    include/linux/bpf.h:739:48: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      739 |         ARG_PTR_TO_MAP_VALUE_OR_NULL    = PTR_MAYBE_NULL | ARG_PTR_TO_MAP_VALUE,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:740:43: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      740 |         ARG_PTR_TO_MEM_OR_NULL          = PTR_MAYBE_NULL | ARG_PTR_TO_MEM,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>    include/linux/bpf.h:741:43: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      741 |         ARG_PTR_TO_CTX_OR_NULL          = PTR_MAYBE_NULL | ARG_PTR_TO_CTX,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>    include/linux/bpf.h:742:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      742 |         ARG_PTR_TO_SOCKET_OR_NULL       = PTR_MAYBE_NULL | ARG_PTR_TO_SOCKET,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:743:44: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      743 |         ARG_PTR_TO_STACK_OR_NULL        = PTR_MAYBE_NULL | ARG_PTR_TO_STACK,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:744:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      744 |         ARG_PTR_TO_BTF_ID_OR_NULL       = PTR_MAYBE_NULL | ARG_PTR_TO_BTF_ID,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:748:38: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      748 |         ARG_PTR_TO_UNINIT_MEM           = MEM_UNINIT | ARG_PTR_TO_MEM,
>          |                                           ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>    include/linux/bpf.h:750:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_arg_type') [-Wenum-enum-conversion]
>      750 |         ARG_PTR_TO_FIXED_SIZE_MEM       = MEM_FIXED_SIZE | ARG_PTR_TO_MEM,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>    include/linux/bpf.h:773:48: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
>      773 |         RET_PTR_TO_MAP_VALUE_OR_NULL    = PTR_MAYBE_NULL | RET_PTR_TO_MAP_VALUE,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:774:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
>      774 |         RET_PTR_TO_SOCKET_OR_NULL       = PTR_MAYBE_NULL | RET_PTR_TO_SOCKET,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:775:47: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
>      775 |         RET_PTR_TO_TCP_SOCK_OR_NULL     = PTR_MAYBE_NULL | RET_PTR_TO_TCP_SOCK,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:776:50: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
>      776 |         RET_PTR_TO_SOCK_COMMON_OR_NULL  = PTR_MAYBE_NULL | RET_PTR_TO_SOCK_COMMON,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:778:49: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
>      778 |         RET_PTR_TO_DYNPTR_MEM_OR_NULL   = PTR_MAYBE_NULL | RET_PTR_TO_MEM,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
>    include/linux/bpf.h:779:45: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
>      779 |         RET_PTR_TO_BTF_ID_OR_NULL       = PTR_MAYBE_NULL | RET_PTR_TO_BTF_ID,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:780:43: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_return_type') [-Wenum-enum-conversion]
>      780 |         RET_PTR_TO_BTF_ID_TRUSTED       = PTR_TRUSTED    | RET_PTR_TO_BTF_ID,
>          |                                           ~~~~~~~~~~~    ^ ~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:891:44: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
>      891 |         PTR_TO_MAP_VALUE_OR_NULL        = PTR_MAYBE_NULL | PTR_TO_MAP_VALUE,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:892:42: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
>      892 |         PTR_TO_SOCKET_OR_NULL           = PTR_MAYBE_NULL | PTR_TO_SOCKET,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
>    include/linux/bpf.h:893:46: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
>      893 |         PTR_TO_SOCK_COMMON_OR_NULL      = PTR_MAYBE_NULL | PTR_TO_SOCK_COMMON,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
>    include/linux/bpf.h:894:44: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
>      894 |         PTR_TO_TCP_SOCK_OR_NULL         = PTR_MAYBE_NULL | PTR_TO_TCP_SOCK,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>    include/linux/bpf.h:895:42: warning: bitwise operation between different enumeration types ('enum bpf_type_flag' and 'enum bpf_reg_type') [-Wenum-enum-conversion]
>      895 |         PTR_TO_BTF_ID_OR_NULL           = PTR_MAYBE_NULL | PTR_TO_BTF_ID,
>          |                                           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
> >> kernel/bpf/core.c:900:5: warning: '__pte_index_size' is not defined, evaluates to 0 [-Wundef]
>      900 | #if PMD_SIZE <= (1 << 21)
>          |     ^
>    arch/powerpc/include/asm/book3s/64/pgtable.h:208:26: note: expanded from macro 'PMD_SIZE'
>      208 | #define PMD_SIZE        (1UL << PMD_SHIFT)
>          |                                 ^
>    arch/powerpc/include/asm/book3s/64/pgtable.h:207:33: note: expanded from macro 'PMD_SHIFT'
>      207 | #define PMD_SHIFT       (PAGE_SHIFT + PTE_INDEX_SIZE)
>          |                                       ^
>    arch/powerpc/include/asm/book3s/64/pgtable.h:156:25: note: expanded from macro 'PTE_INDEX_SIZE'
>      156 | #define PTE_INDEX_SIZE  __pte_index_size
>          |                         ^
>    26 warnings generated.
> --
> >> kernel/bpf/core.c:900:5: warning: '__pte_index_size' is not defined, evaluates to 0 [-Wundef]
>      900 | #if PMD_SIZE <= (1 << 21)
>          |     ^
>    arch/powerpc/include/asm/book3s/64/pgtable.h:208:26: note: expanded from macro 'PMD_SIZE'
>      208 | #define PMD_SIZE        (1UL << PMD_SHIFT)
>          |                                 ^
>    arch/powerpc/include/asm/book3s/64/pgtable.h:207:33: note: expanded from macro 'PMD_SHIFT'
>      207 | #define PMD_SHIFT       (PAGE_SHIFT + PTE_INDEX_SIZE)
>          |                                       ^
>    arch/powerpc/include/asm/book3s/64/pgtable.h:156:25: note: expanded from macro 'PTE_INDEX_SIZE'
>      156 | #define PTE_INDEX_SIZE  __pte_index_size
>          |                         ^
>    1 warning generated.
>
>
> vim +/__pte_index_size +900 kernel/bpf/core.c
>
>    891
>    892  /* PMD_SIZE is not available in some special config, e.g. ARCH=arm with
>    893   * CONFIG_MMU=n. Use PAGE_SIZE in these cases.
>    894   */
>    895  #ifdef PMD_SIZE
>    896  /* PMD_SIZE is really big for some archs. It doesn't make sense to
>    897   * reserve too much memory in one allocation. Cap BPF_PROG_PACK_SIZE to
>    898   * 2MiB * num_possible_nodes().
>    899   */
>  > 900  #if PMD_SIZE <= (1 << 21)
>    901  #define BPF_PROG_PACK_SIZE (PMD_SIZE * num_possible_nodes())
>    902  #else
>    903  #define BPF_PROG_PACK_SIZE ((1 << 21) * num_possible_nodes())
>    904  #endif
>    905  #else
>    906  #define BPF_PROG_PACK_SIZE PAGE_SIZE
>    907  #endif
>    908
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux