DAMON development mailing list
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: SeongJae Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: Problems running DAMON kunit tests with spinlock debugging enabled
Date: Tue,  3 Sep 2024 18:00:16 -0700	[thread overview]
Message-ID: <20240904010016.1451-1-sj@kernel.org> (raw)
In-Reply-To: <1453b2b2-6119-4082-ad9e-f3c5239bf87e@roeck-us.net>

Hi Guenter,

On Tue, 3 Sep 2024 12:23:50 -0700 Guenter Roeck <linux@roeck-us.net> wrote:

> Hi,
> 
> when trying to run DAMON kunit tests with spinlock debugging enabled,
> I get the following error messages.
> 
>     BUG: spinlock bad magic on CPU#0, kunit_try_catch/209
>      lock: mm.13+0x40/0x840, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
>     CPU: 0 UID: 0 PID: 209 Comm: kunit_try_catch Tainted: G                 N 6.11.0-rc6-00148-g178297ec52d6 #1
>     Tainted: [N]=TEST
>     Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
>     Call Trace:
>      <TASK>
>      dump_stack_lvl+0x9e/0xe0
>      do_raw_spin_lock+0x63/0xb0
>      damon_test_three_regions_in_vmas+0x121/0x450S
>      ...
> 
> This happens because damon_test_three_regions_in_vmas() calls
> mt_init_flags() with MM_MT_FLAGS, which sets MT_FLAGS_LOCK_EXTERN.
> Because of this, the spinlock is not initialized, which then results
> in the error message when mas_lock() is called during the test.
> 
> Unfortunately, replacing MM_MT_FLAGS with MT_FLAGS_ALLOC_RANGE |
> MT_FLAGS_USE_RCU or just with MT_FLAGS_ALLOC_RANGE doesn't help;
> it results in various "suspicious RCU usage" messages.

Thank you very much for this report with the grateful detailed investigation!
I was able to make and send a fix[1], thanks to the investigation.  Seems it
may need some more revisions[2], though.  I'll continue discussion on the
thread.

[1] https://lore.kernel.org/20240904004534.1189-1-sj@kernel.org
[2] https://lore.kernel.org/jy6263g6em4jsdhp6tknmh2cljpuvq652kvcet4ko3z2xt7pym@ltc5h5twsszu/


Thanks,
SJ

> 
> Thanks,
> Guenter

  reply	other threads:[~2024-09-04  1:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 19:23 Problems running DAMON kunit tests with spinlock debugging enabled Guenter Roeck
2024-09-04  1:00 ` SeongJae Park [this message]
2024-09-04  2:24   ` Guenter Roeck
2024-09-04  2:46     ` Guenter Roeck
2024-09-04 17:53       ` SeongJae Park
2024-09-04 19:06         ` Guenter Roeck
2024-09-05 16:30           ` SeongJae Park
2024-09-04 21:04         ` Guenter Roeck
2024-09-05 17:35           ` SeongJae Park
2024-09-05 18:04             ` Guenter Roeck
2024-09-05 18:08               ` SeongJae Park
2024-09-05  6:14         ` SeongJae Park

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=20240904010016.1451-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=linux@roeck-us.net \
    /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