All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 7146/7700] mm/rmap.c:2097:17: sparse: sparse: context imbalance in 'page_make_device_exclusive_one' - different lock contexts for basic block
Date: Tue, 08 Jun 2021 10:39:00 +0800	[thread overview]
Message-ID: <202106081056.aeklcKFD-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Alistair Popple <apopple@nvidia.com>
CC: Christoph Hellwig <hch@lst.de>
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/next/linux-next.git master
head:   7f09e895a7f3e0af63bf9ec6c7c22893ec7e6c8e
commit: f5f527a1d5a54729468ddd11b589e95e4ba55f3d [7146/7700] mm: device exclusive memory access
:::::: branch date: 17 hours ago
:::::: commit date: 2 days ago
config: parisc-randconfig-s032-20210607 (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/next/linux-next.git/commit/?id=f5f527a1d5a54729468ddd11b589e95e4ba55f3d
        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 f5f527a1d5a54729468ddd11b589e95e4ba55f3d
        # 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__' W=1 ARCH=parisc 

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/ksm.h):
   include/linux/rmap.h:221:28: sparse: sparse: context imbalance in 'page_referenced_one' - unexpected unlock
   mm/rmap.c:970:25: sparse: sparse: context imbalance in 'page_mkclean_one' - different lock contexts for basic block
   include/linux/rmap.h:221:28: sparse: sparse: context imbalance in 'try_to_unmap_one' - unexpected unlock
   mm/rmap.c:1899:17: sparse: sparse: context imbalance in 'try_to_migrate_one' - different lock contexts for basic block
   include/linux/rmap.h:221:28: sparse: sparse: context imbalance in 'page_mlock_one' - unexpected unlock
>> mm/rmap.c:2097:17: sparse: sparse: context imbalance in 'page_make_device_exclusive_one' - different lock contexts for basic block

vim +/page_make_device_exclusive_one +2097 mm/rmap.c

f5f527a1d5a547 Alistair Popple 2021-06-04  2017  
f5f527a1d5a547 Alistair Popple 2021-06-04  2018  static bool page_make_device_exclusive_one(struct page *page,
f5f527a1d5a547 Alistair Popple 2021-06-04  2019  		struct vm_area_struct *vma, unsigned long address, void *priv)
f5f527a1d5a547 Alistair Popple 2021-06-04  2020  {
f5f527a1d5a547 Alistair Popple 2021-06-04  2021  	struct mm_struct *mm = vma->vm_mm;
f5f527a1d5a547 Alistair Popple 2021-06-04  2022  	struct page_vma_mapped_walk pvmw = {
f5f527a1d5a547 Alistair Popple 2021-06-04  2023  		.page = page,
f5f527a1d5a547 Alistair Popple 2021-06-04  2024  		.vma = vma,
f5f527a1d5a547 Alistair Popple 2021-06-04  2025  		.address = address,
f5f527a1d5a547 Alistair Popple 2021-06-04  2026  	};
f5f527a1d5a547 Alistair Popple 2021-06-04  2027  	struct make_exclusive_args *args = priv;
f5f527a1d5a547 Alistair Popple 2021-06-04  2028  	pte_t pteval;
f5f527a1d5a547 Alistair Popple 2021-06-04  2029  	struct page *subpage;
f5f527a1d5a547 Alistair Popple 2021-06-04  2030  	bool ret = true;
f5f527a1d5a547 Alistair Popple 2021-06-04  2031  	struct mmu_notifier_range range;
f5f527a1d5a547 Alistair Popple 2021-06-04  2032  	swp_entry_t entry;
f5f527a1d5a547 Alistair Popple 2021-06-04  2033  	pte_t swp_pte;
f5f527a1d5a547 Alistair Popple 2021-06-04  2034  
f5f527a1d5a547 Alistair Popple 2021-06-04  2035  	mmu_notifier_range_init_owner(&range, MMU_NOTIFY_EXCLUSIVE, 0, vma,
f5f527a1d5a547 Alistair Popple 2021-06-04  2036  				      vma->vm_mm, address, min(vma->vm_end,
f5f527a1d5a547 Alistair Popple 2021-06-04  2037  				      address + page_size(page)), args->owner);
f5f527a1d5a547 Alistair Popple 2021-06-04  2038  	mmu_notifier_invalidate_range_start(&range);
f5f527a1d5a547 Alistair Popple 2021-06-04  2039  
f5f527a1d5a547 Alistair Popple 2021-06-04  2040  	while (page_vma_mapped_walk(&pvmw)) {
f5f527a1d5a547 Alistair Popple 2021-06-04  2041  		/* Unexpected PMD-mapped THP? */
f5f527a1d5a547 Alistair Popple 2021-06-04  2042  		VM_BUG_ON_PAGE(!pvmw.pte, page);
f5f527a1d5a547 Alistair Popple 2021-06-04  2043  
f5f527a1d5a547 Alistair Popple 2021-06-04  2044  		if (!pte_present(*pvmw.pte)) {
f5f527a1d5a547 Alistair Popple 2021-06-04  2045  			ret = false;
f5f527a1d5a547 Alistair Popple 2021-06-04  2046  			page_vma_mapped_walk_done(&pvmw);
f5f527a1d5a547 Alistair Popple 2021-06-04  2047  			break;
f5f527a1d5a547 Alistair Popple 2021-06-04  2048  		}
f5f527a1d5a547 Alistair Popple 2021-06-04  2049  
f5f527a1d5a547 Alistair Popple 2021-06-04  2050  		subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
f5f527a1d5a547 Alistair Popple 2021-06-04  2051  		address = pvmw.address;
f5f527a1d5a547 Alistair Popple 2021-06-04  2052  
f5f527a1d5a547 Alistair Popple 2021-06-04  2053  		/* Nuke the page table entry. */
f5f527a1d5a547 Alistair Popple 2021-06-04  2054  		flush_cache_page(vma, address, pte_pfn(*pvmw.pte));
f5f527a1d5a547 Alistair Popple 2021-06-04  2055  		pteval = ptep_clear_flush(vma, address, pvmw.pte);
f5f527a1d5a547 Alistair Popple 2021-06-04  2056  
f5f527a1d5a547 Alistair Popple 2021-06-04  2057  		/* Move the dirty bit to the page. Now the pte is gone. */
f5f527a1d5a547 Alistair Popple 2021-06-04  2058  		if (pte_dirty(pteval))
f5f527a1d5a547 Alistair Popple 2021-06-04  2059  			set_page_dirty(page);
f5f527a1d5a547 Alistair Popple 2021-06-04  2060  
f5f527a1d5a547 Alistair Popple 2021-06-04  2061  		if (arch_unmap_one(mm, vma, address, pteval) < 0) {
f5f527a1d5a547 Alistair Popple 2021-06-04  2062  			set_pte_at(mm, address, pvmw.pte, pteval);
f5f527a1d5a547 Alistair Popple 2021-06-04  2063  			ret = false;
f5f527a1d5a547 Alistair Popple 2021-06-04  2064  			page_vma_mapped_walk_done(&pvmw);
f5f527a1d5a547 Alistair Popple 2021-06-04  2065  			break;
f5f527a1d5a547 Alistair Popple 2021-06-04  2066  		}
f5f527a1d5a547 Alistair Popple 2021-06-04  2067  
f5f527a1d5a547 Alistair Popple 2021-06-04  2068  		/*
f5f527a1d5a547 Alistair Popple 2021-06-04  2069  		 * Check that our target page is still mapped@the expected
f5f527a1d5a547 Alistair Popple 2021-06-04  2070  		 * address.
f5f527a1d5a547 Alistair Popple 2021-06-04  2071  		 */
f5f527a1d5a547 Alistair Popple 2021-06-04  2072  		if (args->mm == mm && args->address == address &&
f5f527a1d5a547 Alistair Popple 2021-06-04  2073  		    pte_write(pteval))
f5f527a1d5a547 Alistair Popple 2021-06-04  2074  			args->valid = true;
f5f527a1d5a547 Alistair Popple 2021-06-04  2075  
f5f527a1d5a547 Alistair Popple 2021-06-04  2076  		/*
f5f527a1d5a547 Alistair Popple 2021-06-04  2077  		 * Store the pfn of the page in a special migration
f5f527a1d5a547 Alistair Popple 2021-06-04  2078  		 * pte. do_swap_page() will wait until the migration
f5f527a1d5a547 Alistair Popple 2021-06-04  2079  		 * pte is removed and then restart fault handling.
f5f527a1d5a547 Alistair Popple 2021-06-04  2080  		 */
f5f527a1d5a547 Alistair Popple 2021-06-04  2081  		if (pte_write(pteval))
f5f527a1d5a547 Alistair Popple 2021-06-04  2082  			entry = make_writable_device_exclusive_entry(
f5f527a1d5a547 Alistair Popple 2021-06-04  2083  							page_to_pfn(subpage));
f5f527a1d5a547 Alistair Popple 2021-06-04  2084  		else
f5f527a1d5a547 Alistair Popple 2021-06-04  2085  			entry = make_readable_device_exclusive_entry(
f5f527a1d5a547 Alistair Popple 2021-06-04  2086  							page_to_pfn(subpage));
f5f527a1d5a547 Alistair Popple 2021-06-04  2087  		swp_pte = swp_entry_to_pte(entry);
f5f527a1d5a547 Alistair Popple 2021-06-04  2088  		if (pte_soft_dirty(pteval))
f5f527a1d5a547 Alistair Popple 2021-06-04  2089  			swp_pte = pte_swp_mksoft_dirty(swp_pte);
f5f527a1d5a547 Alistair Popple 2021-06-04  2090  		if (pte_uffd_wp(pteval))
f5f527a1d5a547 Alistair Popple 2021-06-04  2091  			swp_pte = pte_swp_mkuffd_wp(swp_pte);
f5f527a1d5a547 Alistair Popple 2021-06-04  2092  
f5f527a1d5a547 Alistair Popple 2021-06-04  2093  		/* Take a reference for the swap entry */
f5f527a1d5a547 Alistair Popple 2021-06-04  2094  		get_page(page);
f5f527a1d5a547 Alistair Popple 2021-06-04  2095  		set_pte_at(mm, address, pvmw.pte, swp_pte);
f5f527a1d5a547 Alistair Popple 2021-06-04  2096  
f5f527a1d5a547 Alistair Popple 2021-06-04 @2097  		page_remove_rmap(subpage, PageHuge(page));
f5f527a1d5a547 Alistair Popple 2021-06-04  2098  		put_page(page);
f5f527a1d5a547 Alistair Popple 2021-06-04  2099  	}
f5f527a1d5a547 Alistair Popple 2021-06-04  2100  
f5f527a1d5a547 Alistair Popple 2021-06-04  2101  	mmu_notifier_invalidate_range_end(&range);
f5f527a1d5a547 Alistair Popple 2021-06-04  2102  
f5f527a1d5a547 Alistair Popple 2021-06-04  2103  	return ret;
f5f527a1d5a547 Alistair Popple 2021-06-04  2104  }
f5f527a1d5a547 Alistair Popple 2021-06-04  2105  

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

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

                 reply	other threads:[~2021-06-08  2:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202106081056.aeklcKFD-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.