Hi Jay,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on vfio/next]
[also build test ERROR on linux/master linus/master v5.8-rc6 next-20200720]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/0day-ci/linux/commits/Jay-Zhou/vfio-dma_map-unmap-optimized-for-hugetlbfs-pages/20200720-163157
base:   https://github.com/awilliam/linux-vfio.git next
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-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=arm 

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

All error/warnings (new ones prefixed by >>):

>> drivers/vfio/vfio_iommu_type1.c:522:52: error: 'HUGE_MAX_HSTATE' undeclared 
>> here (not in a function)
     522 | struct vfio_hupetlbpage_info vfio_hugetlbpage_info[HUGE_MAX_HSTATE] 
= {
         |                                                    ^~~~~~~~~~~~~~~
   In file included from include/linux/mm.h:679,
                    from include/linux/scatterlist.h:8,
                    from include/linux/iommu.h:10,
                    from drivers/vfio/vfio_iommu_type1.c:27:
   include/linux/huge_mm.h:319:25: error: braced-group within expression 
allowed only inside a function
     319 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
         |                         ^
   drivers/vfio/vfio_iommu_type1.c:523:45: note: in expansion of macro 
'HPAGE_PMD_SHIFT'
     523 |  {vfio_hugetlbpage_2M, PMD_SIZE, ~((1ULL << HPAGE_PMD_SHIFT) - 1)},
         |                                             ^~~~~~~~~~~~~~~
   include/linux/huge_mm.h:323:25: error: braced-group within expression 
allowed only inside a function
     323 | #define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; })
         |                         ^
   drivers/vfio/vfio_iommu_type1.c:524:45: note: in expansion of macro 
'HPAGE_PUD_SHIFT'
     524 |  {vfio_hugetlbpage_1G, PUD_SIZE, ~((1ULL << HPAGE_PUD_SHIFT) - 1)},
         |                                             ^~~~~~~~~~~~~~~
   drivers/vfio/vfio_iommu_type1.c: In function 'hugetlb_is_last_page':
>> drivers/vfio/vfio_iommu_type1.c:554:81: warning: parameter 'type' set but 
>> not used [-Wunused-but-set-parameter]
     554 | static bool hugetlb_is_last_page(unsigned long addr, enum 
vfio_hugetlbpage_type type)
         |                                                      
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~

vim +/HUGE_MAX_HSTATE +522 drivers/vfio/vfio_iommu_type1.c

   521  
 > 522  struct vfio_hupetlbpage_info vfio_hugetlbpage_info[HUGE_MAX_HSTATE] = {
   523          {vfio_hugetlbpage_2M, PMD_SIZE, ~((1ULL << HPAGE_PMD_SHIFT) - 
1)},
   524          {vfio_hugetlbpage_1G, PUD_SIZE, ~((1ULL << HPAGE_PUD_SHIFT) - 
1)},
   525  };
   526  
   527  static bool is_hugetlbpage(unsigned long pfn, enum 
vfio_hugetlbpage_type *type)
   528  {
   529          struct page *page = NULL;
   530  
   531          if (!pfn_valid(pfn) || !type)
   532                  return false;
   533  
   534          page = pfn_to_page(pfn);
   535          /* only check for hugetlbfs pages */
   536          if (!page || !PageHuge(page))
   537                  return false;
   538  
   539          switch (compound_order(compound_head(page))) {
   540          case PMD_ORDER:
   541                  *type = vfio_hugetlbpage_2M;
   542                  break;
   543          case PUD_ORDER:
   544                  *type = vfio_hugetlbpage_1G;
   545                  break;
   546          default:
   547                  return false;
   548          }
   549  
   550          return true;
   551  }
   552  
   553  /* Is the addr in the last page in hugetlbfs pages? */
 > 554  static bool hugetlb_is_last_page(unsigned long addr, enum 
 > vfio_hugetlbpage_type type)
   555  {
   556          unsigned int num = 0;
   557  
   558          num = hugetlb_get_resdual_pages(addr & ~(PAGE_SIZE - 1), type);
   559  
   560          if (num == 1)
   561                  return true;
   562          else
   563                  return false;
   564  }
   565  

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