[mmotm:master 122/211] mm/hmm.c:1129:15: note: in expansion of macro 'MIGRATE_PFN_ERROR'

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

 



tree:   git://git.cmpxchg.org/linux-mmotm.git master
head:   8276ddb3c638602509386f1a05f75326dbf5ce09
commit: 025037cced8bcc78327e8920df22c815e6d4d626 [122/211] mm/hmm/devmem: device memory hotplug using ZONE_DEVICE
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 025037cced8bcc78327e8920df22c815e6d4d626
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All warnings (new ones prefixed by >>):

      pmd = pmd_read_atomic(pmdp);
            ^~~~~~~~~~~~~~~
   mm/hmm.c:417:7: error: incompatible types when assigning to type 'pmd_t {aka struct <anonymous>}' from type 'int'
      pmd = pmd_read_atomic(pmdp);
          ^
   mm/hmm.c:439:7: error: implicit declaration of function 'pmd_trans_huge' [-Werror=implicit-function-declaration]
      if (pmd_trans_huge(pmd) || pmd_devmap(pmd)) {
          ^~~~~~~~~~~~~~
   mm/hmm.c:440:24: error: implicit declaration of function 'pmd_pfn' [-Werror=implicit-function-declaration]
       unsigned long pfn = pmd_pfn(pmd) + pte_index(addr);
                           ^~~~~~~
   mm/hmm.c:440:39: error: implicit declaration of function 'pte_index' [-Werror=implicit-function-declaration]
       unsigned long pfn = pmd_pfn(pmd) + pte_index(addr);
                                          ^~~~~~~~~
   mm/hmm.c:443:8: error: implicit declaration of function 'pmd_protnone' [-Werror=implicit-function-declaration]
       if (pmd_protnone(pmd)) {
           ^~~~~~~~~~~~
   mm/hmm.c:449:13: error: implicit declaration of function 'pmd_write' [-Werror=implicit-function-declaration]
       flags |= pmd_write(*pmdp) ? HMM_PFN_WRITE : 0;
                ^~~~~~~~~
   mm/hmm.c:458:10: error: implicit declaration of function 'pte_offset_map' [-Werror=implicit-function-declaration]
      ptep = pte_offset_map(pmdp, addr);
             ^~~~~~~~~~~~~~
   mm/hmm.c:458:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      ptep = pte_offset_map(pmdp, addr);
           ^
   mm/hmm.c:463:8: error: implicit declaration of function 'pte_none' [-Werror=implicit-function-declaration]
       if (pte_none(pte)) {
           ^~~~~~~~
   mm/hmm.c:465:6: error: implicit declaration of function 'pte_unmap' [-Werror=implicit-function-declaration]
         pte_unmap(ptep);
         ^~~~~~~~~
   mm/hmm.c:473:9: error: implicit declaration of function 'pte_present' [-Werror=implicit-function-declaration]
       if (!pte_present(pte) && !non_swap_entry(entry)) {
            ^~~~~~~~~~~
   mm/hmm.c:483:32: error: implicit declaration of function 'pte_pfn' [-Werror=implicit-function-declaration]
        pfns[i] = hmm_pfn_from_pfn(pte_pfn(pte))|flag;
                                   ^~~~~~~
   mm/hmm.c:484:16: error: implicit declaration of function 'pte_write' [-Werror=implicit-function-declaration]
        pfns[i] |= pte_write(pte) ? HMM_PFN_WRITE : 0;
                   ^~~~~~~~~
   mm/hmm.c: In function 'hmm_devmem_radix_release':
   mm/hmm.c:809:30: error: 'PA_SECTION_SHIFT' undeclared (first use in this function)
    #define SECTION_SIZE (1UL << PA_SECTION_SHIFT)
                                 ^
   mm/hmm.c:815:36: note: in expansion of macro 'SECTION_SIZE'
     align_start = resource->start & ~(SECTION_SIZE - 1);
                                       ^~~~~~~~~~~~
   mm/hmm.c: In function 'hmm_devmem_release':
   mm/hmm.c:809:30: error: 'PA_SECTION_SHIFT' undeclared (first use in this function)
    #define SECTION_SIZE (1UL << PA_SECTION_SHIFT)
                                 ^
   mm/hmm.c:837:36: note: in expansion of macro 'SECTION_SIZE'
     align_start = resource->start & ~(SECTION_SIZE - 1);
                                       ^~~~~~~~~~~~
   mm/hmm.c:839:2: error: implicit declaration of function 'arch_remove_memory' [-Werror=implicit-function-declaration]
     arch_remove_memory(align_start, align_size, devmem->pagemap.flags);
     ^~~~~~~~~~~~~~~~~~
   mm/hmm.c: In function 'hmm_devmem_find':
   mm/hmm.c:848:54: error: 'PA_SECTION_SHIFT' undeclared (first use in this function)
     return radix_tree_lookup(&hmm_devmem_radix, phys >> PA_SECTION_SHIFT);
                                                         ^~~~~~~~~~~~~~~~
   mm/hmm.c: In function 'hmm_devmem_pages_create':
   mm/hmm.c:809:30: error: 'PA_SECTION_SHIFT' undeclared (first use in this function)
    #define SECTION_SIZE (1UL << PA_SECTION_SHIFT)
                                 ^
   mm/hmm.c:859:44: note: in expansion of macro 'SECTION_SIZE'
     align_start = devmem->resource->start & ~(SECTION_SIZE - 1);
                                               ^~~~~~~~~~~~
   In file included from include/linux/cache.h:4:0,
                    from include/linux/printk.h:8,
                    from include/linux/kernel.h:13,
                    from include/asm-generic/bug.h:13,
                    from arch/blackfin/include/asm/bug.h:71,
                    from include/linux/bug.h:4,
                    from include/linux/mmdebug.h:4,
                    from include/linux/mm.h:8,
                    from mm/hmm.c:20:
   mm/hmm.c: In function 'hmm_devmem_add':
   mm/hmm.c:809:30: error: 'PA_SECTION_SHIFT' undeclared (first use in this function)
    #define SECTION_SIZE (1UL << PA_SECTION_SHIFT)
                                 ^
   include/uapi/linux/kernel.h:10:47: note: in definition of macro '__ALIGN_KERNEL_MASK'
    #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
                                                  ^~~~
   include/linux/kernel.h:49:22: note: in expansion of macro '__ALIGN_KERNEL'
    #define ALIGN(x, a)  __ALIGN_KERNEL((x), (a))
                         ^~~~~~~~~~~~~~
   mm/hmm.c:1002:9: note: in expansion of macro 'ALIGN'
     size = ALIGN(size, SECTION_SIZE);
            ^~~~~
   mm/hmm.c:1002:21: note: in expansion of macro 'SECTION_SIZE'
     size = ALIGN(size, SECTION_SIZE);
                        ^~~~~~~~~~~~
   In file included from include/linux/hmm.h:82:0,
                    from mm/hmm.c:21:
   mm/hmm.c: In function 'hmm_devmem_fault_range':
   include/linux/migrate.h:134:32: warning: left shift count >= width of type [-Wshift-count-overflow]
    #define MIGRATE_PFN_ERROR (1UL << (BITS_PER_LONG_LONG - 7))
                                   ^
>> mm/hmm.c:1129:15: note: in expansion of macro 'MIGRATE_PFN_ERROR'
     if (dst[i] & MIGRATE_PFN_ERROR)
                  ^~~~~~~~~~~~~~~~~
   mm/hmm.c: In function 'hmm_devmem_find':
   mm/hmm.c:849:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
   In file included from include/linux/hmm.h:82:0,
                    from mm/hmm.c:21:
   include/linux/migrate.h: In function 'migrate_pfn_size':
>> include/linux/migrate.h:147:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
   cc1: some warnings being treated as errors

vim +/MIGRATE_PFN_ERROR +1129 mm/hmm.c

   996			goto error_percpu_ref;
   997	
   998		ret = devm_add_action(device, hmm_devmem_ref_exit, &devmem->ref);
   999		if (ret)
  1000			goto error_devm_add_action;
  1001	
> 1002		size = ALIGN(size, SECTION_SIZE);
  1003		addr = (iomem_resource.end + 1ULL) - size;
  1004	
  1005		/*
  1006		 * FIXME add a new helper to quickly walk resource tree and find free
  1007		 * range
  1008		 *
  1009		 * FIXME what about ioport_resource resource ?
  1010		 */
  1011		for (; addr > size && addr >= iomem_resource.start; addr -= size) {
  1012			ret = region_intersects(addr, size, 0, IORES_DESC_NONE);
  1013			if (ret != REGION_DISJOINT)
  1014				continue;
  1015	
  1016			devmem->resource = devm_request_mem_region(device, addr, size,
  1017								   dev_name(device));
  1018			if (!devmem->resource) {
  1019				ret = -ENOMEM;
  1020				goto error_no_resource;
  1021			}
  1022			devmem->resource->desc = IORES_DESC_UNADDRESSABLE_MEMORY;
  1023			break;
  1024		}
  1025		if (!devmem->resource) {
  1026			ret = -ERANGE;
  1027			goto error_no_resource;
  1028		}
  1029	
  1030		devmem->pfn_first = devmem->resource->start >> PAGE_SHIFT;
  1031		devmem->pfn_last = devmem->pfn_first +
  1032				   (resource_size(devmem->resource) >> PAGE_SHIFT);
  1033	
  1034		ret = hmm_devmem_pages_create(devmem);
  1035		if (ret)
  1036			goto error_pages;
  1037	
  1038		devres_add(device, devmem);
  1039	
  1040		ret = devm_add_action(device, hmm_devmem_ref_kill, &devmem->ref);
  1041		if (ret) {
  1042			hmm_devmem_remove(devmem);
  1043			return ERR_PTR(ret);
  1044		}
  1045	
  1046		return devmem;
  1047	
  1048	error_pages:
  1049		devm_release_mem_region(device, devmem->resource->start,
  1050					resource_size(devmem->resource));
  1051	error_no_resource:
  1052	error_devm_add_action:
  1053		hmm_devmem_ref_kill(&devmem->ref);
  1054		hmm_devmem_ref_exit(&devmem->ref);
  1055	error_percpu_ref:
  1056		devres_free(devmem);
  1057		return ERR_PTR(ret);
  1058	}
  1059	EXPORT_SYMBOL(hmm_devmem_add);
  1060	
  1061	/*
  1062	 * hmm_devmem_remove() - remove device memory (kill and free ZONE_DEVICE)
  1063	 *
  1064	 * @devmem: hmm_devmem struct use to track and manage the ZONE_DEVICE memory
  1065	 *
  1066	 * This will hot-unplug memory that was hotplugged by hmm_devmem_add on behalf
  1067	 * of the device driver. It will free struct page and remove the resource that
  1068	 * reserve the physical address range for this device memory.
  1069	 */
  1070	void hmm_devmem_remove(struct hmm_devmem *devmem)
  1071	{
  1072		resource_size_t start, size;
  1073		struct device *device;
  1074	
  1075		if (!devmem)
  1076			return;
  1077	
  1078		device = devmem->device;
  1079		start = devmem->resource->start;
  1080		size = resource_size(devmem->resource);
  1081	
  1082		hmm_devmem_ref_kill(&devmem->ref);
  1083		hmm_devmem_ref_exit(&devmem->ref);
  1084		hmm_devmem_pages_remove(devmem);
  1085	
  1086		devm_release_mem_region(device, start, size);
  1087	}
  1088	EXPORT_SYMBOL(hmm_devmem_remove);
  1089	
  1090	/*
  1091	 * hmm_devmem_fault_range() - migrate back a virtual range of memory
  1092	 *
  1093	 * @devmem: hmm_devmem struct use to track and manage the ZONE_DEVICE memory
  1094	 * @vma: virtual memory area containing the range to be migrated
  1095	 * @ops: migration callback for allocating destination memory and copying
  1096	 * @mentry: maximum number of entries in src or dst array
  1097	 * @src: array of unsigned long containing source pfns
  1098	 * @dst: array of unsigned long containing destination pfns
  1099	 * @start: start address of the range to migrate (inclusive)
  1100	 * @addr: fault address (must be inside the range)
  1101	 * @end: end address of the range to migrate (exclusive)
  1102	 * @private: pointer passed back to each of the callback
  1103	 * Returns: 0 on success, VM_FAULT_SIGBUS on error
  1104	 *
  1105	 * This is a wrapper around migrate_vma() which check the migration status
  1106	 * for a given fault address and return corresponding page fault handler status
  1107	 * ie 0 on success or VM_FAULT_SIGBUS if migration failed for fault address.
  1108	 *
  1109	 * This is a helper intendend to be used by ZONE_DEVICE fault handler.
  1110	 */
  1111	int hmm_devmem_fault_range(struct hmm_devmem *devmem,
  1112				   struct vm_area_struct *vma,
  1113				   const struct migrate_vma_ops *ops,
  1114				   unsigned long mentry,
  1115				   unsigned long *src,
  1116				   unsigned long *dst,
  1117				   unsigned long start,
  1118				   unsigned long addr,
  1119				   unsigned long end,
  1120				   void *private)
  1121	{
  1122		unsigned long i, size, tmp;
  1123		if (migrate_vma(ops, vma, mentry, start, end, src, dst, private))
  1124			return VM_FAULT_SIGBUS;
  1125	
  1126		for (i = 0, tmp = start; tmp < addr; i++, tmp += size) {
  1127			size = migrate_pfn_size(src[i]);
  1128		}
> 1129		if (dst[i] & MIGRATE_PFN_ERROR)
  1130			return VM_FAULT_SIGBUS;
  1131	
  1132		return 0;

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux