Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305686

Re: mm: possible deadlock in mm_take_all_locks

From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: mm: possible deadlock in mm_take_all_locks
Date 2016-01-10 21:40 +0100
Message-ID <qPuWo-F7-47@gated-at.bofh.it> (permalink)
References <qOIym-YW-9@gated-at.bofh.it> <qOODM-5p4-11@gated-at.bofh.it> <qPjey-1yl-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Jan 10, 2016 at 09:05:32AM +0100, Dmitry Vyukov wrote:
> On Sat, Jan 9, 2016 at 12:23 AM, Kirill A. Shutemov
> <kirill@shutemov.name> wrote:
> > On Fri, Jan 08, 2016 at 05:58:33PM +0100, Dmitry Vyukov wrote:
> >> Hello,
> >>
> >> I've hit the following deadlock warning while running syzkaller fuzzer
> >> on commit b06f3a168cdcd80026276898fd1fee443ef25743. As far as I
> >> understand this is a false positive, because both call stacks are
> >> protected by mm_all_locks_mutex.
> >
> > +Michal
> >
> > I don't think it's false positive.
> >
> > The reason we don't care about order of taking i_mmap_rwsem is that we
> > never takes i_mmap_rwsem under other i_mmap_rwsem, but that's not true for
> > i_mmap_rwsem vs. hugetlbfs_i_mmap_rwsem_key. That's why we have the
> > annotation in the first place.
> >
> > See commit b610ded71918 ("hugetlb: fix lockdep splat caused by pmd
> > sharing").
> 
> Description of b610ded71918 suggests that that code takes hugetlb
> mutex first and them normal page mutex. In this patch you take them in
> the opposite order: normal mutex, then hugetlb mutex. Won't this patch
> only increase probability of deadlocks? Shouldn't you take them in the
> opposite order?

You are right. I got it wrong. Conditions should be reversed.

The comment around hugetlbfs_i_mmap_rwsem_key definition is somewhat
confusing:

"This needs an annotation because huge_pmd_share() does an allocation
under i_mmap_rwsem."

I read this as we do hugetlb allocation when i_mmap_rwsem already taken
and made locking order respectively. I guess i_mmap_rwsem should be
replaced with hugetlbfs_i_mmap_rwsem_key in the comment.

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

mm: possible deadlock in mm_take_all_locks Dmitry Vyukov <dvyukov@google.com> - 2016-01-08 18:00 +0100
  Re: mm: possible deadlock in mm_take_all_locks "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-01-09 00:30 +0100
    Re: mm: possible deadlock in mm_take_all_locks Dmitry Vyukov <dvyukov@google.com> - 2016-01-10 09:10 +0100
      Re: mm: possible deadlock in mm_take_all_locks "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-01-10 21:40 +0100
        Re: mm: possible deadlock in mm_take_all_locks Dmitry Vyukov <dvyukov@google.com> - 2016-01-11 10:10 +0100

csiph-web