tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: c97e430ab5539993ab2afc6e80deea80aef9d799 commit: afbef99a0e4dfb0eda864ae9d3c78c9d9ed750ba [3841/3955] mm/hugetlb: only drop uffd-wp special pte if required config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220414/202204140108.DeRAhWEn-lkp@xxxxxxxxx/config) compiler: gcc-11 (Debian 11.2.0-19) 11.2.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=afbef99a0e4dfb0eda864ae9d3c78c9d9ed750ba git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout afbef99a0e4dfb0eda864ae9d3c78c9d9ed750ba # save the config file to linux build tree mkdir build_dir make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash fs/hugetlbfs/ mm/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> sparse warnings: (new ones prefixed by >>) mm/memory.c:1238:1: sparse: sparse: symbol 'vma_needs_copy' was not declared. Should it be static? >> mm/memory.c:1678:67: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned long zap_flags @@ got restricted zap_flags_t @@ mm/memory.c:1678:67: sparse: expected unsigned long zap_flags mm/memory.c:1678:67: sparse: got restricted zap_flags_t mm/memory.c:1031:17: sparse: sparse: context imbalance in 'copy_pte_range' - different lock contexts for basic block mm/memory.c:1830:16: sparse: sparse: context imbalance in '__get_locked_pte' - different lock contexts for basic block mm/memory.c:1878:9: sparse: sparse: context imbalance in 'insert_page' - different lock contexts for basic block mm/memory.c:2380:17: sparse: sparse: context imbalance in 'remap_pte_range' - different lock contexts for basic block mm/memory.c:2636:17: sparse: sparse: context imbalance in 'apply_to_pte_range' - unexpected unlock mm/memory.c:2925:9: sparse: sparse: context imbalance in 'wp_page_copy' - different lock contexts for basic block mm/memory.c:3277:17: sparse: sparse: context imbalance in 'wp_pfn_shared' - unexpected unlock mm/memory.c:3344:19: sparse: sparse: context imbalance in 'do_wp_page' - different lock contexts for basic block mm/memory.c:5214:5: sparse: sparse: context imbalance in 'follow_invalidate_pte' - wrong count at exit mm/memory.c:5335:23: sparse: sparse: context imbalance in 'follow_pfn' - unexpected unlock mm/memory.c:5365:9: sparse: sparse: context imbalance in 'follow_phys' - unexpected unlock mm/memory.c:5399:9: sparse: sparse: context imbalance in 'generic_access_phys' - unexpected unlock -- >> mm/hugetlb.c:5013:43: sparse: sparse: restricted zap_flags_t degrades to integer mm/hugetlb.c:5047:35: sparse: sparse: restricted zap_flags_t degrades to integer mm/hugetlb.c:460:12: sparse: sparse: context imbalance in 'allocate_file_region_entries' - wrong count at exit mm/hugetlb.c:533:13: sparse: sparse: context imbalance in 'region_add' - wrong count at exit mm/hugetlb.c:600:13: sparse: sparse: context imbalance in 'region_chg' - wrong count at exit mm/hugetlb.c: note: in included file: include/linux/mm.h:1304:17: sparse: sparse: context imbalance in 'demote_free_huge_page' - unexpected unlock mm/hugetlb.c:4896:20: sparse: sparse: context imbalance in 'move_huge_pte' - different lock contexts for basic block include/linux/mm.h:1165:22: sparse: sparse: context imbalance in 'hugetlb_wp' - unexpected unlock mm/hugetlb.c:6127:25: sparse: sparse: context imbalance in 'follow_hugetlb_page' - different lock contexts for basic block -- >> fs/hugetlbfs/inode.c:521:41: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected unsigned long zap_flags @@ got restricted zap_flags_t [usertype] @@ fs/hugetlbfs/inode.c:521:41: sparse: expected unsigned long zap_flags fs/hugetlbfs/inode.c:521:41: sparse: got restricted zap_flags_t [usertype] fs/hugetlbfs/inode.c:588:39: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected unsigned long zap_flags @@ got restricted zap_flags_t [usertype] @@ fs/hugetlbfs/inode.c:588:39: sparse: expected unsigned long zap_flags fs/hugetlbfs/inode.c:588:39: sparse: got restricted zap_flags_t [usertype] vim +1678 mm/memory.c 1642 1643 1644 static void unmap_single_vma(struct mmu_gather *tlb, 1645 struct vm_area_struct *vma, unsigned long start_addr, 1646 unsigned long end_addr, 1647 struct zap_details *details) 1648 { 1649 unsigned long start = max(vma->vm_start, start_addr); 1650 unsigned long end; 1651 1652 if (start >= vma->vm_end) 1653 return; 1654 end = min(vma->vm_end, end_addr); 1655 if (end <= vma->vm_start) 1656 return; 1657 1658 if (vma->vm_file) 1659 uprobe_munmap(vma, start, end); 1660 1661 if (unlikely(vma->vm_flags & VM_PFNMAP)) 1662 untrack_pfn(vma, 0, 0); 1663 1664 if (start != end) { 1665 if (unlikely(is_vm_hugetlb_page(vma))) { 1666 /* 1667 * It is undesirable to test vma->vm_file as it 1668 * should be non-null for valid hugetlb area. 1669 * However, vm_file will be NULL in the error 1670 * cleanup path of mmap_region. When 1671 * hugetlbfs ->mmap method fails, 1672 * mmap_region() nullifies vma->vm_file 1673 * before calling this function to clean up. 1674 * Since no pte has actually been setup, it is 1675 * safe to do nothing in this case. 1676 */ 1677 if (vma->vm_file) { > 1678 unsigned long zap_flags = details ? 1679 details->zap_flags : 0; 1680 i_mmap_lock_write(vma->vm_file->f_mapping); 1681 __unmap_hugepage_range_final(tlb, vma, start, end, 1682 NULL, zap_flags); 1683 i_mmap_unlock_write(vma->vm_file->f_mapping); 1684 } 1685 } else 1686 unmap_page_range(tlb, vma, start, end, details); 1687 } 1688 } 1689 -- 0-DAY CI Kernel Test Service https://01.org/lkp