Hi Yonghong,

I love your patch! Perhaps something to improve:

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

url:    
https://github.com/0day-ci/linux/commits/Yonghong-Song/bpf-implement-bpf-iterator-for-map-elements/20200714-002048
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arc-allyesconfig (attached as .config)
compiler: arc-elf-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=arc 

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 >>):

   kernel/bpf/arraymap.c: In function '__bpf_array_map_seq_show':
>> kernel/bpf/arraymap.c:540:20: warning: variable 'array' set but not used 
>> [-Wunused-but-set-variable]
     540 |  struct bpf_array *array;
         |                    ^~~~~
   In file included from include/linux/perf_event.h:25,
                    from kernel/bpf/arraymap.c:11:
   At top level:
   arch/arc/include/asm/perf_event.h:126:23: warning: 'arc_pmu_cache_map' 
defined but not used [-Wunused-const-variable=]
     126 | static const unsigned 
arc_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
         |                       ^~~~~~~~~~~~~~~~~
   arch/arc/include/asm/perf_event.h:91:27: warning: 'arc_pmu_ev_hw_map' 
defined but not used [-Wunused-const-variable=]
      91 | static const char * const arc_pmu_ev_hw_map[] = {
         |                           ^~~~~~~~~~~~~~~~~

vim +/array +540 kernel/bpf/arraymap.c

   533  
   534  static int __bpf_array_map_seq_show(struct seq_file *seq, void *v)
   535  {
   536          struct bpf_iter_seq_array_map_info *info = seq->private;
   537          struct bpf_iter__bpf_map_elem ctx = {};
   538          struct bpf_map *map = info->map;
   539          struct bpf_iter_meta meta;
 > 540          struct bpf_array *array;
   541          struct bpf_prog *prog;
   542          int off = 0, cpu = 0;
   543          void __percpu **pptr;
   544          u32 size;
   545  
   546          meta.seq = seq;
   547          prog = bpf_iter_get_info(&meta, v == NULL);
   548          if (!prog)
   549                  return 0;
   550  
   551          ctx.meta = &meta;
   552          ctx.map = info->map;
   553          if (v) {
   554                  ctx.key = &info->index;
   555  
   556                  array = container_of(map, struct bpf_array, map);
   557                  if (!info->percpu_value_buf) {
   558                          ctx.value = v;
   559                  } else {
   560                          pptr = v;
   561                          size = round_up(map->value_size, 8);
   562                          for_each_possible_cpu(cpu) {
   563                                  bpf_long_memcpy(info->percpu_value_buf 
+ off,
   564                                                  per_cpu_ptr(pptr, cpu),
   565                                                  size);
   566                                  off += size;
   567                          }
   568                          ctx.value = info->percpu_value_buf;
   569                  }
   570          }
   571  
   572          return bpf_iter_run_prog(prog, &ctx);
   573  }
   574  

---
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