All of lore.kernel.org
 help / color / mirror / Atom feed
* mm/rmap.c:1915:17: sparse: sparse: context imbalance in 'try_to_migrate_one' - different lock contexts for basic block
@ 2021-07-09 20:14 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-07-09 20:14 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17019 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Alistair Popple <apopple@nvidia.com>
CC: Christoph Hellwig <hch@lst.de>
CC: Ralph Campbell <rcampbell@nvidia.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   f55966571d5eb2876a11e48e798b4592fa1ffbb7
commit: a98a2f0c8ce1b2138cb8e3ae410444dedcc14809 mm/rmap: split migration into its own function
date:   8 days ago
:::::: branch date: 25 hours ago
:::::: commit date: 8 days ago
config: parisc-randconfig-s032-20210709 (attached as .config)
compiler: hppa64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a98a2f0c8ce1b2138cb8e3ae410444dedcc14809
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout a98a2f0c8ce1b2138cb8e3ae410444dedcc14809
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
   mm/rmap.c: note: in included file (through include/linux/export.h, include/linux/linkage.h, include/linux/kernel.h, ...):
   ./include/generated/autoksyms.h:5:16: sparse: sparse: no whitespace before object-like macro body
   ./include/generated/autoksyms.h:6:16: sparse: sparse: no whitespace before object-like macro body
   ./include/generated/autoksyms.h:6:9: sparse: sparse: preprocessor token __KSYM_ redefined
   ./include/generated/autoksyms.h:5:9: sparse: this was the original definition
   ./include/generated/autoksyms.h:7:16: sparse: sparse: no whitespace before object-like macro body
   ./include/generated/autoksyms.h:7:9: sparse: sparse: preprocessor token __KSYM_ redefined
   ./include/generated/autoksyms.h:5:9: sparse: this was the original definition
   ./include/generated/autoksyms.h:8:16: sparse: sparse: no whitespace before object-like macro body
   ./include/generated/autoksyms.h:8:9: sparse: sparse: preprocessor token __KSYM_ redefined
   ./include/generated/autoksyms.h:5:9: sparse: this was the original definition
   ./include/generated/autoksyms.h:9:16: sparse: sparse: no whitespace before object-like macro body
   ./include/generated/autoksyms.h:9:9: sparse: sparse: preprocessor token __KSYM_ redefined
   ./include/generated/autoksyms.h:5:9: sparse: this was the original definition
   mm/rmap.c: note: in included file (through include/linux/ksm.h):
   include/linux/rmap.h:218:28: sparse: sparse: context imbalance in 'page_referenced_one' - unexpected unlock
   mm/rmap.c:967:25: sparse: sparse: context imbalance in 'page_mkclean_one' - different lock contexts for basic block
   include/linux/rmap.h:218:28: sparse: sparse: context imbalance in 'try_to_unmap_one' - unexpected unlock
>> mm/rmap.c:1915:17: sparse: sparse: context imbalance in 'try_to_migrate_one' - different lock contexts for basic block
   include/linux/rmap.h:218:28: sparse: sparse: context imbalance in 'page_mlock_one' - unexpected unlock

vim +/try_to_migrate_one +1915 mm/rmap.c

a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1760  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1761  		/* Unexpected PMD-mapped THP? */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1762  		VM_BUG_ON_PAGE(!pvmw.pte, page);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1763  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1764  		subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1765  		address = pvmw.address;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1766  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1767  		if (PageHuge(page) && !PageAnon(page)) {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1768  			/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1769  			 * To call huge_pmd_unshare, i_mmap_rwsem must be
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1770  			 * held in write mode.  Caller needs to explicitly
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1771  			 * do this outside rmap routines.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1772  			 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1773  			VM_BUG_ON(!(flags & TTU_RMAP_LOCKED));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1774  			if (huge_pmd_unshare(mm, vma, &address, pvmw.pte)) {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1775  				/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1776  				 * huge_pmd_unshare unmapped an entire PMD
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1777  				 * page.  There is no way of knowing exactly
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1778  				 * which PMDs may be cached for this mm, so
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1779  				 * we must flush them all.  start/end were
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1780  				 * already adjusted above to cover this range.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1781  				 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1782  				flush_cache_range(vma, range.start, range.end);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1783  				flush_tlb_range(vma, range.start, range.end);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1784  				mmu_notifier_invalidate_range(mm, range.start,
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1785  							      range.end);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1786  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1787  				/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1788  				 * The ref count of the PMD page was dropped
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1789  				 * which is part of the way map counting
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1790  				 * is done for shared PMDs.  Return 'true'
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1791  				 * here.  When there is no other sharing,
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1792  				 * huge_pmd_unshare returns false and we will
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1793  				 * unmap the actual page and drop map count
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1794  				 * to zero.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1795  				 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1796  				page_vma_mapped_walk_done(&pvmw);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1797  				break;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1798  			}
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1799  		}
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1800  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1801  		/* Nuke the page table entry. */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1802  		flush_cache_page(vma, address, pte_pfn(*pvmw.pte));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1803  		pteval = ptep_clear_flush(vma, address, pvmw.pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1804  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1805  		/* Move the dirty bit to the page. Now the pte is gone. */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1806  		if (pte_dirty(pteval))
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1807  			set_page_dirty(page);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1808  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1809  		/* Update high watermark before we lower rss */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1810  		update_hiwater_rss(mm);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1811  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1812  		if (is_zone_device_page(page)) {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1813  			swp_entry_t entry;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1814  			pte_t swp_pte;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1815  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1816  			/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1817  			 * Store the pfn of the page in a special migration
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1818  			 * pte. do_swap_page() will wait until the migration
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1819  			 * pte is removed and then restart fault handling.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1820  			 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1821  			entry = make_readable_migration_entry(
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1822  							page_to_pfn(page));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1823  			swp_pte = swp_entry_to_pte(entry);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1824  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1825  			/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1826  			 * pteval maps a zone device page and is therefore
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1827  			 * a swap pte.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1828  			 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1829  			if (pte_swp_soft_dirty(pteval))
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1830  				swp_pte = pte_swp_mksoft_dirty(swp_pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1831  			if (pte_swp_uffd_wp(pteval))
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1832  				swp_pte = pte_swp_mkuffd_wp(swp_pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1833  			set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1834  			/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1835  			 * No need to invalidate here it will synchronize on
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1836  			 * against the special swap migration pte.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1837  			 *
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1838  			 * The assignment to subpage above was computed from a
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1839  			 * swap PTE which results in an invalid pointer.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1840  			 * Since only PAGE_SIZE pages can currently be
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1841  			 * migrated, just set it to page. This will need to be
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1842  			 * changed when hugepage migrations to device private
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1843  			 * memory are supported.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1844  			 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1845  			subpage = page;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1846  		} else if (PageHWPoison(page)) {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1847  			pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1848  			if (PageHuge(page)) {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1849  				hugetlb_count_sub(compound_nr(page), mm);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1850  				set_huge_swap_pte_at(mm, address,
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1851  						     pvmw.pte, pteval,
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1852  						     vma_mmu_pagesize(vma));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1853  			} else {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1854  				dec_mm_counter(mm, mm_counter(page));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1855  				set_pte_at(mm, address, pvmw.pte, pteval);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1856  			}
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1857  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1858  		} else if (pte_unused(pteval) && !userfaultfd_armed(vma)) {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1859  			/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1860  			 * The guest indicated that the page content is of no
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1861  			 * interest anymore. Simply discard the pte, vmscan
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1862  			 * will take care of the rest.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1863  			 * A future reference will then fault in a new zero
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1864  			 * page. When userfaultfd is active, we must not drop
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1865  			 * this page though, as its main user (postcopy
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1866  			 * migration) will not expect userfaults on already
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1867  			 * copied pages.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1868  			 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1869  			dec_mm_counter(mm, mm_counter(page));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1870  			/* We have to invalidate as we cleared the pte */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1871  			mmu_notifier_invalidate_range(mm, address,
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1872  						      address + PAGE_SIZE);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1873  		} else {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1874  			swp_entry_t entry;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1875  			pte_t swp_pte;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1876  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1877  			if (arch_unmap_one(mm, vma, address, pteval) < 0) {
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1878  				set_pte_at(mm, address, pvmw.pte, pteval);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1879  				ret = false;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1880  				page_vma_mapped_walk_done(&pvmw);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1881  				break;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1882  			}
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1883  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1884  			/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1885  			 * Store the pfn of the page in a special migration
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1886  			 * pte. do_swap_page() will wait until the migration
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1887  			 * pte is removed and then restart fault handling.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1888  			 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1889  			if (pte_write(pteval))
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1890  				entry = make_writable_migration_entry(
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1891  							page_to_pfn(subpage));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1892  			else
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1893  				entry = make_readable_migration_entry(
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1894  							page_to_pfn(subpage));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1895  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1896  			swp_pte = swp_entry_to_pte(entry);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1897  			if (pte_soft_dirty(pteval))
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1898  				swp_pte = pte_swp_mksoft_dirty(swp_pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1899  			if (pte_uffd_wp(pteval))
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1900  				swp_pte = pte_swp_mkuffd_wp(swp_pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1901  			set_pte_at(mm, address, pvmw.pte, swp_pte);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1902  			/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1903  			 * No need to invalidate here it will synchronize on
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1904  			 * against the special swap migration pte.
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1905  			 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1906  		}
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1907  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1908  		/*
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1909  		 * No need to call mmu_notifier_invalidate_range() it has be
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1910  		 * done above for all cases requiring it to happen under page
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1911  		 * table lock before mmu_notifier_invalidate_range_end()
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1912  		 *
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1913  		 * See Documentation/vm/mmu_notifier.rst
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1914  		 */
a98a2f0c8ce1b2 Alistair Popple 2021-06-30 @1915  		page_remove_rmap(subpage, PageHuge(page));
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1916  		put_page(page);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1917  	}
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1918  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1919  	mmu_notifier_invalidate_range_end(&range);
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1920  
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1921  	return ret;
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1922  }
a98a2f0c8ce1b2 Alistair Popple 2021-06-30  1923  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 23757 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-09 20:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 20:14 mm/rmap.c:1915:17: sparse: sparse: context imbalance in 'try_to_migrate_one' - different lock contexts for basic block kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.