Hi Ivan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    
https://github.com/0day-ci/linux/commits/Ivan-Khoronzhuk/xdp-xdp_umem-fix-umem-pages-mapping-for-32bits-systems/20190627-135949
config: i386-randconfig-x073-201925 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-9) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <l...@intel.com>

All errors (new ones prefixed by >>):

   net//xdp/xdp_umem.c: In function 'xdp_umem_unmap_pages':
   net//xdp/xdp_umem.c:177:3: error: implicit declaration of function 'kunmap'; 
did you mean 'vunmap'? [-Werror=implicit-function-declaration]
      kunmap(umem->pgs[i]);
      ^~~~~~
      vunmap
   net//xdp/xdp_umem.c: In function 'xdp_umem_reg':
>> net//xdp/xdp_umem.c:384:25: error: implicit declaration of function 'kmap'; 
>> did you mean 'vmap'? [-Werror=implicit-function-declaration]
      umem->pages[i].addr = kmap(umem->pgs[i]);
                            ^~~~
                            vmap
   net//xdp/xdp_umem.c:384:23: warning: assignment makes pointer from integer 
without a cast [-Wint-conversion]
      umem->pages[i].addr = kmap(umem->pgs[i]);
                          ^
   cc1: some warnings being treated as errors

vim +384 net//xdp/xdp_umem.c

   311  
   312  static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
   313  {
   314          u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
   315          unsigned int chunks, chunks_per_page;
   316          u64 addr = mr->addr, size = mr->len;
   317          int size_chk, err, i;
   318  
   319          if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > 
PAGE_SIZE) {
   320                  /* Strictly speaking we could support this, if:
   321                   * - huge pages, or*
   322                   * - using an IOMMU, or
   323                   * - making sure the memory area is consecutive
   324                   * but for now, we simply say "computer says no".
   325                   */
   326                  return -EINVAL;
   327          }
   328  
   329          if (!is_power_of_2(chunk_size))
   330                  return -EINVAL;
   331  
   332          if (!PAGE_ALIGNED(addr)) {
   333                  /* Memory area has to be page size aligned. For
   334                   * simplicity, this might change.
   335                   */
   336                  return -EINVAL;
   337          }
   338  
   339          if ((addr + size) < addr)
   340                  return -EINVAL;
   341  
   342          chunks = (unsigned int)div_u64(size, chunk_size);
   343          if (chunks == 0)
   344                  return -EINVAL;
   345  
   346          chunks_per_page = PAGE_SIZE / chunk_size;
   347          if (chunks < chunks_per_page || chunks % chunks_per_page)
   348                  return -EINVAL;
   349  
   350          headroom = ALIGN(headroom, 64);
   351  
   352          size_chk = chunk_size - headroom - XDP_PACKET_HEADROOM;
   353          if (size_chk < 0)
   354                  return -EINVAL;
   355  
   356          umem->address = (unsigned long)addr;
   357          umem->chunk_mask = ~((u64)chunk_size - 1);
   358          umem->size = size;
   359          umem->headroom = headroom;
   360          umem->chunk_size_nohr = chunk_size - headroom;
   361          umem->npgs = size / PAGE_SIZE;
   362          umem->pgs = NULL;
   363          umem->user = NULL;
   364          INIT_LIST_HEAD(&umem->xsk_list);
   365          spin_lock_init(&umem->xsk_list_lock);
   366  
   367          refcount_set(&umem->users, 1);
   368  
   369          err = xdp_umem_account_pages(umem);
   370          if (err)
   371                  return err;
   372  
   373          err = xdp_umem_pin_pages(umem);
   374          if (err)
   375                  goto out_account;
   376  
   377          umem->pages = kcalloc(umem->npgs, sizeof(*umem->pages), 
GFP_KERNEL);
   378          if (!umem->pages) {
   379                  err = -ENOMEM;
   380                  goto out_account;
   381          }
   382  
   383          for (i = 0; i < umem->npgs; i++)
 > 384                  umem->pages[i].addr = kmap(umem->pgs[i]);
   385  
   386          return 0;
   387  
   388  out_account:
   389          xdp_umem_unaccount_pages(umem);
   390          return err;
   391  }
   392  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to