[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1M0fgbedbjP6h7e@iweiny-desk3>
Date: Fri, 21 Oct 2022 17:08:30 -0700
From: Ira Weiny <ira.weiny@...el.com>
To: Randy Dunlap <rdunlap@...radead.org>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>,
kernel test robot <yujie.liu@...el.com>,
"Fabio M. De Francesco" <fmdefrancesco@...il.com>,
<lkp@...ts.01.org>, <lkp@...el.com>,
<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
Peter Xu <peterx@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [shmem] 7a7256d5f5: WARNING:possible_recursive_locking_detected
On Fri, Oct 21, 2022 at 05:02:57PM -0700, Randy Dunlap wrote:
>
>
> 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@...hat.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@...ux-foundation.org: delete weird BUILD_BUG_ON()]
> > Signed-off-by: Andrea Arcangeli <aarcange@...hat.com>
> > Acked-by: Pavel Emelyanov <xemul@...allels.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.
Indeed! I will actually compile it prior to sending an actual patch. I guess
I should have done that below. :-/ Sorry.
Thanks!
Ira
>
> > 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
>
Powered by blists - more mailing lists