From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH 16/29] mm: add pte_map_lock() and pte_spinlock()
Date: Sat, 01 May 2021 10:15:25 +0800 [thread overview]
Message-ID: <202105011022.GPrgDyOA-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 9143 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210430195232.30491-17-michel@lespinasse.org>
References: <20210430195232.30491-17-michel@lespinasse.org>
TO: Michel Lespinasse <michel@lespinasse.org>
TO: "Linux-MM" <linux-mm@kvack.org>
TO: "Linux-Kernel" <linux-kernel@vger.kernel.org>
CC: Laurent Dufour <ldufour@linux.ibm.com>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Michal Hocko <mhocko@suse.com>
CC: Matthew Wilcox <willy@infradead.org>
CC: Rik van Riel <riel@surriel.com>
CC: Paul McKenney <paulmck@kernel.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Suren Baghdasaryan <surenb@google.com>
Hi Michel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tip/x86/mm]
[also build test WARNING on arm64/for-next/core v5.12]
[cannot apply to hnaz-linux-mm/master linus/master next-20210430]
[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/Michel-Lespinasse/Speculative-page-faults-anon-vmas-only/20210501-035602
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git a500fc918f7b8dc3dff2e6c74f3e73e856c18248
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: x86_64-randconfig-s022-20210430 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/284898f9c11d755d2b231794fc7529d562f8e918
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Michel-Lespinasse/Speculative-page-faults-anon-vmas-only/20210501-035602
git checkout 284898f9c11d755d2b231794fc7529d562f8e918
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64
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/memory.c:5326:22: sparse: sparse: cast removes address space '__user' of expression
mm/memory.c:955:17: sparse: sparse: context imbalance in 'copy_pte_range' - different lock contexts for basic block
mm/memory.c:1635:16: sparse: sparse: context imbalance in '__get_locked_pte' - different lock contexts for basic block
mm/memory.c:1684:9: sparse: sparse: context imbalance in 'insert_page' - different lock contexts for basic block
mm/memory.c:2186:17: sparse: sparse: context imbalance in 'remap_pte_range' - different lock contexts for basic block
mm/memory.c:2431:17: sparse: sparse: context imbalance in 'apply_to_pte_range' - unexpected unlock
>> mm/memory.c:2595:6: sparse: sparse: context imbalance in '__pte_map_lock' - wrong count at exit
mm/memory.c:2776:9: sparse: sparse: context imbalance in 'wp_page_copy' - different lock contexts for basic block
mm/memory.c:3121:17: sparse: sparse: context imbalance in 'wp_pfn_shared' - unexpected unlock
mm/memory.c:3184:19: sparse: sparse: context imbalance in 'do_wp_page' - different lock contexts for basic block
mm/memory.c:4795:5: sparse: sparse: context imbalance in 'follow_invalidate_pte' - different lock contexts for basic block
mm/memory.c:4916:23: sparse: sparse: context imbalance in 'follow_pfn' - unexpected unlock
mm/memory.c:4946:9: sparse: sparse: context imbalance in 'follow_phys' - unexpected unlock
mm/memory.c:4980:9: sparse: sparse: context imbalance in 'generic_access_phys' - unexpected unlock
vim +/__pte_map_lock +2595 mm/memory.c
3ac00c32199b7c Michel Lespinasse 2021-04-30 2594
284898f9c11d75 Michel Lespinasse 2021-04-30 @2595 bool __pte_map_lock(struct vm_fault *vmf)
284898f9c11d75 Michel Lespinasse 2021-04-30 2596 {
284898f9c11d75 Michel Lespinasse 2021-04-30 2597 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
284898f9c11d75 Michel Lespinasse 2021-04-30 2598 pmd_t pmdval;
284898f9c11d75 Michel Lespinasse 2021-04-30 2599 #endif
284898f9c11d75 Michel Lespinasse 2021-04-30 2600 pte_t *pte = vmf->pte;
284898f9c11d75 Michel Lespinasse 2021-04-30 2601 spinlock_t *ptl;
284898f9c11d75 Michel Lespinasse 2021-04-30 2602
284898f9c11d75 Michel Lespinasse 2021-04-30 2603 if (!(vmf->flags & FAULT_FLAG_SPECULATIVE)) {
284898f9c11d75 Michel Lespinasse 2021-04-30 2604 vmf->ptl = pte_lockptr(vmf->vma->vm_mm, vmf->pmd);
284898f9c11d75 Michel Lespinasse 2021-04-30 2605 if (!pte)
284898f9c11d75 Michel Lespinasse 2021-04-30 2606 vmf->pte = pte_offset_map(vmf->pmd, vmf->address);
284898f9c11d75 Michel Lespinasse 2021-04-30 2607 spin_lock(vmf->ptl);
284898f9c11d75 Michel Lespinasse 2021-04-30 2608 return true;
284898f9c11d75 Michel Lespinasse 2021-04-30 2609 }
284898f9c11d75 Michel Lespinasse 2021-04-30 2610
284898f9c11d75 Michel Lespinasse 2021-04-30 2611 speculative_page_walk_begin();
284898f9c11d75 Michel Lespinasse 2021-04-30 2612 if (!mmap_seq_read_check(vmf->vma->vm_mm, vmf->seq))
284898f9c11d75 Michel Lespinasse 2021-04-30 2613 goto fail;
284898f9c11d75 Michel Lespinasse 2021-04-30 2614 /*
284898f9c11d75 Michel Lespinasse 2021-04-30 2615 * The mmap sequence count check guarantees that the page
284898f9c11d75 Michel Lespinasse 2021-04-30 2616 * tables are still valid at that point, and
284898f9c11d75 Michel Lespinasse 2021-04-30 2617 * speculative_page_walk_begin() ensures that they stay around.
284898f9c11d75 Michel Lespinasse 2021-04-30 2618 */
284898f9c11d75 Michel Lespinasse 2021-04-30 2619 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
284898f9c11d75 Michel Lespinasse 2021-04-30 2620 /*
284898f9c11d75 Michel Lespinasse 2021-04-30 2621 * We check if the pmd value is still the same to ensure that there
284898f9c11d75 Michel Lespinasse 2021-04-30 2622 * is not a huge collapse operation in progress in our back.
284898f9c11d75 Michel Lespinasse 2021-04-30 2623 */
284898f9c11d75 Michel Lespinasse 2021-04-30 2624 pmdval = READ_ONCE(*vmf->pmd);
284898f9c11d75 Michel Lespinasse 2021-04-30 2625 if (!pmd_same(pmdval, vmf->orig_pmd))
284898f9c11d75 Michel Lespinasse 2021-04-30 2626 goto fail;
284898f9c11d75 Michel Lespinasse 2021-04-30 2627 #endif
284898f9c11d75 Michel Lespinasse 2021-04-30 2628 ptl = pte_lockptr(vmf->vma->vm_mm, vmf->pmd);
284898f9c11d75 Michel Lespinasse 2021-04-30 2629 if (!pte)
284898f9c11d75 Michel Lespinasse 2021-04-30 2630 pte = pte_offset_map(vmf->pmd, vmf->address);
284898f9c11d75 Michel Lespinasse 2021-04-30 2631 /*
284898f9c11d75 Michel Lespinasse 2021-04-30 2632 * Try locking the page table.
284898f9c11d75 Michel Lespinasse 2021-04-30 2633 *
284898f9c11d75 Michel Lespinasse 2021-04-30 2634 * Note that we might race against zap_pte_range() which
284898f9c11d75 Michel Lespinasse 2021-04-30 2635 * invalidates TLBs while holding the page table lock.
284898f9c11d75 Michel Lespinasse 2021-04-30 2636 * We are still under the speculative_page_walk_begin() section,
284898f9c11d75 Michel Lespinasse 2021-04-30 2637 * and zap_pte_range() could thus deadlock with us if we tried
284898f9c11d75 Michel Lespinasse 2021-04-30 2638 * using spin_lock() here.
284898f9c11d75 Michel Lespinasse 2021-04-30 2639 *
284898f9c11d75 Michel Lespinasse 2021-04-30 2640 * We also don't want to retry until spin_trylock() succeeds,
284898f9c11d75 Michel Lespinasse 2021-04-30 2641 * because of the starvation potential against a stream of lockers.
284898f9c11d75 Michel Lespinasse 2021-04-30 2642 */
284898f9c11d75 Michel Lespinasse 2021-04-30 2643 if (unlikely(!spin_trylock(ptl)))
284898f9c11d75 Michel Lespinasse 2021-04-30 2644 goto fail;
284898f9c11d75 Michel Lespinasse 2021-04-30 2645 if (!mmap_seq_read_check(vmf->vma->vm_mm, vmf->seq))
284898f9c11d75 Michel Lespinasse 2021-04-30 2646 goto unlock_fail;
284898f9c11d75 Michel Lespinasse 2021-04-30 2647 speculative_page_walk_end();
284898f9c11d75 Michel Lespinasse 2021-04-30 2648 vmf->pte = pte;
284898f9c11d75 Michel Lespinasse 2021-04-30 2649 vmf->ptl = ptl;
284898f9c11d75 Michel Lespinasse 2021-04-30 2650 return true;
284898f9c11d75 Michel Lespinasse 2021-04-30 2651
284898f9c11d75 Michel Lespinasse 2021-04-30 2652 unlock_fail:
284898f9c11d75 Michel Lespinasse 2021-04-30 2653 spin_unlock(ptl);
284898f9c11d75 Michel Lespinasse 2021-04-30 2654 fail:
284898f9c11d75 Michel Lespinasse 2021-04-30 2655 if (pte)
284898f9c11d75 Michel Lespinasse 2021-04-30 2656 pte_unmap(pte);
284898f9c11d75 Michel Lespinasse 2021-04-30 2657 speculative_page_walk_end();
284898f9c11d75 Michel Lespinasse 2021-04-30 2658 return false;
284898f9c11d75 Michel Lespinasse 2021-04-30 2659 }
284898f9c11d75 Michel Lespinasse 2021-04-30 2660
---
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: 35680 bytes --]
next reply other threads:[~2021-05-01 2:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-01 2:15 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-04-30 19:52 [PATCH 00/29] Speculative page faults (anon vmas only) Michel Lespinasse
2021-04-30 19:52 ` [PATCH 16/29] mm: add pte_map_lock() and pte_spinlock() Michel Lespinasse
2021-04-30 23:33 ` kernel test robot
2021-04-30 23:33 ` kernel test robot
2021-04-30 23:45 ` kernel test robot
2021-04-30 23:45 ` kernel test robot
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=202105011022.GPrgDyOA-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.