From: Souptick Joarder <jrdr.linux@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Jérôme Glisse" <jglisse@redhat.com>,
Linux-MM <linux-mm@kvack.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/hmm.c : Remove additional check for lockdep_assert_held()
Date: Fri, 13 Mar 2020 09:52:32 +0530 [thread overview]
Message-ID: <CAFqt6zbh8pQ+UpPLLhQjpr+e=j-RUET7uX=XkG7AQqH9qysQaQ@mail.gmail.com> (raw)
In-Reply-To: <20200312205741.e97a201037103bbf51e1df40@linux-foundation.org>
On Fri, Mar 13, 2020 at 9:27 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Fri, 13 Mar 2020 09:17:22 +0530 Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> > On Fri, Mar 13, 2020 at 8:28 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> > >
> > > On Fri, 13 Mar 2020 07:41:00 +0530 Souptick Joarder <jrdr.linux@gmail.com> wrote:
> > >
> > > > walk_page_range() already has a check for lockdep_assert_held().
> > > > So additional check for lockdep_assert_held() can be removed from
> > > > hmm_range_fault().
> > > >
> > > > ...
> > > >
> > > > --- a/mm/hmm.c
> > > > +++ b/mm/hmm.c
> > > > @@ -681,7 +681,6 @@ long hmm_range_fault(struct hmm_range *range, unsigned int flags)
> > > > struct mm_struct *mm = range->notifier->mm;
> > > > int ret;
> > > >
> > > > - lockdep_assert_held(&mm->mmap_sem);
> > > >
> > > > do {
> > > > /* If range is no longer valid force retry. */
> > >
> > > It isn't very obvious that hmm_range_fault() is and will only be called
> > > from walk_page_range() (is it?)
> > >
> >
> > Sorry Andrew, didn't get this part ?
> > * hmm_range_fault() is and will only be called
> > from walk_page_range() (is it?) *
>
> The patch assumes that hmm_range_fault() will only ever be called via
> walk_page_range(). How do we know this is the case? And that it
> always will be the case?
>
Ahh, Sorry, I think change log creates confusion.
The patch assumes that walk_page_range() is called from hmm_range_fault().
currently there are two caller for hmm_range_fault().
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c, line 859
drivers/gpu/drm/nouveau/nouveau_svm.c, line 544
in both case, * &mm->mmap_sem * lock is taken before calling hmm_range_fault().
Now inside hmm_range_fault() there is a check for
lockdep_assert_held(&mm->mmap_sem)
and again inside loop walk_page_range() is called which cross check
same lockdep_assert_held().
So the idea is to remove the first check
lockdep_assert_held(&mm->mmap_sem) in hmm_range_fault().
next prev parent reply other threads:[~2020-03-13 4:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 2:11 Souptick Joarder
2020-03-13 2:58 ` Andrew Morton
2020-03-13 3:47 ` Souptick Joarder
2020-03-13 3:57 ` Andrew Morton
2020-03-13 4:22 ` Souptick Joarder [this message]
2020-03-13 12:22 ` Jason Gunthorpe
2020-03-22 15:16 ` Souptick Joarder
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='CAFqt6zbh8pQ+UpPLLhQjpr+e=j-RUET7uX=XkG7AQqH9qysQaQ@mail.gmail.com' \
--to=jrdr.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox