From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <yujie.liu@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
lkp@lists.01.org, lkp@intel.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Peter Xu <peterx@redhat.com>
Subject: Re: [shmem] 7a7256d5f5: WARNING:possible_recursive_locking_detected
Date: Fri, 21 Oct 2022 23:36:02 +0100 [thread overview]
Message-ID: <Y1Me0pmC5LrzPAaY@casper.infradead.org> (raw)
In-Reply-To: <20221021133041.5811e1fb291eb6aaf122a59c@linux-foundation.org>
On Fri, Oct 21, 2022 at 01:30:41PM -0700, Andrew Morton wrote:
> On Fri, 21 Oct 2022 14:09:16 +0100 Matthew Wilcox <willy@infradead.org> wrote:
>
> > On Fri, Oct 21, 2022 at 12:10:17PM +0800, kernel test robot wrote:
> > > FYI, we noticed WARNING:possible_recursive_locking_detected due to commit (built with gcc-11):
> > >
> > > commit: 7a7256d5f512b6c17957df7f59cf5e281b3ddba3 ("shmem: convert shmem_mfill_atomic_pte() to use a folio")
> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
> >
> > Ummm. Looks to me like this now occurs because of this part of the
> > change:
> >
> > if (!zeropage) { /* COPY */
> > - page_kaddr = kmap_atomic(page);
> > + page_kaddr = kmap_local_folio(folio, 0);
> > ret = copy_from_user(page_kaddr,
> > (const void __user *)src_addr,
> > PAGE_SIZE);
> > - kunmap_atomic(page_kaddr);
> > + kunmap_local(page_kaddr);
> >
> > Should I be using __copy_from_user_inatomic() here?
>
> Caller __mcopy_atomic() is holding mmap_read_lock(dst_mm) and this
> copy_from_user() calls
> might_fault()->might_lock_read(current->mm->mmap_lock).
>
> And I guess might_lock_read() gets upset because we're holding another
> mm's mmap_lock. Which sounds OK to me, unless a concurrent
> mmap_write_lock() could jam things up.
Well, are we sure that dst_mm and current->mm are necessarily different?
If so, we could tell lockdep that.
> But I cannot see why your patch would suddenly trigger this warning -
> kmap_local_folio() and kmap_atomic() are basically the same thing.
Except for the important call in kmap_atomic_prot() to
pagefault_disable(). I mean, we could open-code that in the uffd code?
next prev parent reply other threads:[~2022-10-21 22:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 4:10 [shmem] 7a7256d5f5: WARNING:possible_recursive_locking_detected kernel test robot
2022-10-21 13:09 ` Matthew Wilcox
2022-10-21 20:30 ` Andrew Morton
2022-10-21 22:36 ` Matthew Wilcox [this message]
2022-10-21 22:48 ` Ira Weiny
2022-10-22 0:00 ` Ira Weiny
2022-10-22 0:02 ` Randy Dunlap
2022-10-22 0:08 ` Ira Weiny
2022-10-22 0:17 ` Peter Xu
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=Y1Me0pmC5LrzPAaY@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=fmdefrancesco@gmail.com \
--cc=ira.weiny@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=lkp@lists.01.org \
--cc=peterx@redhat.com \
--cc=yujie.liu@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).