From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
David Hildenbrand <david@redhat.com>,
Brendan Higgins <brendanhiggins@google.com>,
David Gow <davidgow@google.com>,
damon@lists.linux.dev, linux-mm@kvack.org,
kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/damon/tests/vaddr-kunit: don't use mas_lock for MM_MT_FLAGS-initialized maple tree
Date: Tue, 3 Sep 2024 22:46:22 -0400 [thread overview]
Message-ID: <zi5ahfi3pwwmirkbxcipl7jjx56qsgopvgjb2pnrj6yz6dxb6p@fhjivxhiiweg> (raw)
In-Reply-To: <e83dedb2-89a3-4327-9a2f-610d3199f0e1@roeck-us.net>
* Guenter Roeck <linux@roeck-us.net> [240903 22:38]:
> On 9/3/24 19:31, Liam R. Howlett wrote:
> > * SeongJae Park <sj@kernel.org> [240903 21:18]:
> > > On Tue, 3 Sep 2024 17:58:15 -0700 SeongJae Park <sj@kernel.org> wrote:
> > >
> > > > On Tue, 3 Sep 2024 20:48:53 -0400 "Liam R. Howlett" <Liam.Howlett@oracle.com> wrote:
> > > >
> > > > > * SeongJae Park <sj@kernel.org> [240903 20:45]:
> > > > > > damon_test_three_regions_in_vmas() initializes a maple tree with
> > > > > > MM_MT_FLAGS. The flags contains MT_FLAGS_LOCK_EXTERN, which means
> > > > > > mt_lock of the maple tree will not be used. And therefore the maple
> > > > > > tree initialization code skips initialization of the mt_lock. However,
> > > > > > __link_vmas(), which adds vmas for test to the maple tree, uses the
> > > > > > mt_lock. In other words, the uninitialized spinlock is used. The
> > > > > > problem becomes celar when spinlock debugging is turned on, since it
> > > > > > reports spinlock bad magic bug. Fix the issue by not using the mt_lock
> > > > > > as promised.
> > > > >
> > > > > You can't do this, lockdep will tell you this is wrong.
> > > >
> > > > Hmm, but lockdep was silence on my setup?
> > > >
> > > > > We need a lock and to use the lock for writes.
> > > >
> > > > This code is executed by a single-thread test code. Do we still need the lock?
> > > >
> > > > >
> > > > > I'd suggest using different flags so the spinlock is used.
> > > >
> > > > The reporter mentioned simply dropping MT_FLAGS_LOCK_EXTERN from the flags
> > > > causes suspicious RCU usage message. May I ask if you have a suggestion of
> > > > better flags?
> >
> > That would be the lockdep complaining, so that's good.
> >
> > >
> > > I was actually thinking replacing the mt_init_flags() with mt_init(), which
> > > same to mt_init_flags() with zero flag, like below.
> >
> > Yes. This will use the spinlock which should fix your issue, but it
> > will use a different style of maple tree.
> >
> > Perhaps use MT_FLAGS_ALLOC_RANGE to use the same type of maple tree, if
> > you ever add threading you will want the rcu flag as well
> > (MT_FLAGS_USE_RCU).
> >
> > I would recommend those two and just use the spinlock.
> >
>
> I tried that (MT_FLAGS_ALLOC_RANGE | MT_FLAGS_USE_RCU). it also triggers
> the suspicious RCU usage message.
Just to be clear, you changed the init flags and kept the mas_lock() and
mas_unlock() ?
Thanks,
Liam
next prev parent reply other threads:[~2024-09-04 2:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 0:45 SeongJae Park
2024-09-04 0:48 ` Liam R. Howlett
2024-09-04 0:58 ` SeongJae Park
2024-09-04 1:18 ` SeongJae Park
2024-09-04 1:54 ` Guenter Roeck
2024-09-04 2:43 ` Liam R. Howlett
2024-09-04 17:36 ` SeongJae Park
2024-09-04 2:31 ` Liam R. Howlett
2024-09-04 2:38 ` Guenter Roeck
2024-09-04 2:46 ` Liam R. Howlett [this message]
2024-09-04 3:36 ` Liam R. Howlett
2024-09-04 4:27 ` Guenter Roeck
2024-09-04 19:26 ` Liam R. Howlett
2024-09-04 19:56 ` Guenter Roeck
2024-09-05 0:19 ` SeongJae Park
2024-09-04 16:58 ` Guenter Roeck
2024-09-04 1:28 ` Guenter Roeck
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=zi5ahfi3pwwmirkbxcipl7jjx56qsgopvgjb2pnrj6yz6dxb6p@fhjivxhiiweg \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=brendanhiggins@google.com \
--cc=damon@lists.linux.dev \
--cc=david@redhat.com \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--cc=sj@kernel.org \
--cc=willy@infradead.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