All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Ira Weiny <ira.weiny@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>,
	kernel test robot <yujie.liu@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>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [shmem] 7a7256d5f5: WARNING:possible_recursive_locking_detected
Date: Fri, 21 Oct 2022 17:02:57 -0700	[thread overview]
Message-ID: <a0e2af81-39de-8c25-e7bd-f2234a0d7f8b@infradead.org> (raw)
In-Reply-To: <Y1MymJ/INb45AdaY@iweiny-desk3>



On 10/21/22 17:00, Ira Weiny wrote:

> 
> I was about to get this patch ready to send when I found this:
> 
> commit b6ebaedb4cb1a18220ae626c3a9e184ee39dd248
> Author: Andrea Arcangeli <aarcange@redhat.com>
> Date:   Fri Sep 4 15:47:08 2015 -0700
> 
>     userfaultfd: avoid mmap_sem read recursion in mcopy_atomic
> 
>     If the rwsem starves writers it wasn't strictly a bug but lockdep
>     doesn't like it and this avoids depending on lowlevel implementation  
>     details of the lock.
>     
>     [akpm@linux-foundation.org: delete weird BUILD_BUG_ON()]
>     Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
>     Acked-by: Pavel Emelyanov <xemul@parallels.com>
> ...
> 
> So I wonder if the true fix is something to lockdep?
> 
> Regardless I'll send the below patch because it will restore things to a
> working order.


with ; added to each + line.

> But I'm CC'ing Andrea for comments.
> 
> Ira
> 
>>
>> Ira
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 8280a5cb48df..6c8e99bf5983 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -2424,9 +2424,11 @@ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
>>
>>                 if (!zeropage) {        /* COPY */
>>                         page_kaddr = kmap_local_folio(folio, 0);
>> +                       pagefault_disable()
>>                         ret = copy_from_user(page_kaddr,
>>                                              (const void __user *)src_addr,
>>                                              PAGE_SIZE);
>> +                       pagefault_enable()
>>                         kunmap_local(page_kaddr);
>>
>>                         /* fallback to copy_from_user outside mmap_lock */
>>
>>

-- 
~Randy

  reply	other threads:[~2022-10-22  0:06 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
2022-10-21 22:48     ` Ira Weiny
2022-10-22  0:00       ` Ira Weiny
2022-10-22  0:02         ` Randy Dunlap [this message]
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=a0e2af81-39de-8c25-e7bd-f2234a0d7f8b@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=aarcange@redhat.com \
    --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=willy@infradead.org \
    --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 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.