The patch titled Subject: mm/damon/tests/vaddr-kunit: init maple tree without MT_FLAGS_LOCK_EXTERN has been added to the -mm mm-unstable branch. Its filename is mm-damon-tests-vaddr-kunit-init-maple-tree-without-mt_flags_lock_extern.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-tests-vaddr-kunit-init-maple-tree-without-mt_flags_lock_extern.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: SeongJae Park <sj@xxxxxxxxxx> Subject: mm/damon/tests/vaddr-kunit: init maple tree without MT_FLAGS_LOCK_EXTERN Date: Wed, 4 Sep 2024 10:29:31 -0700 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 clear when spinlock debugging is turned on, since it reports spinlock bad magic bug. Fix the issue by excluding MT_FLAGS_LOCK_EXTERN from the maple tree initialization flags. Note that we don't use empty flags to make it further similar to the usage of mm maple tree, and to be prepared for possible future changes, as suggested by Liam. Link: https://lkml.kernel.org/r/20240904172931.1284-1-sj@xxxxxxxxxx Fixes: d0cf3dd47f0d ("damon: convert __damon_va_three_regions to use the VMA iterator") Signed-off-by: SeongJae Park <sj@xxxxxxxxxx> Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx> Closes: https://lore.kernel.org/1453b2b2-6119-4082-ad9e-f3c5239bf87e@xxxxxxxxxxxx Suggested-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/damon/tests/vaddr-kunit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/damon/tests/vaddr-kunit.h~mm-damon-tests-vaddr-kunit-init-maple-tree-without-mt_flags_lock_extern +++ a/mm/damon/tests/vaddr-kunit.h @@ -77,7 +77,7 @@ static void damon_test_three_regions_in_ (struct vm_area_struct) {.vm_start = 307, .vm_end = 330}, }; - mt_init_flags(&mm.mm_mt, MM_MT_FLAGS); + mt_init_flags(&mm.mm_mt, MT_FLAGS_ALLOC_RANGE | MT_FLAGS_USE_RCU); if (__link_vmas(&mm.mm_mt, vmas, ARRAY_SIZE(vmas))) kunit_skip(test, "Failed to create VMA tree"); _ Patches currently in -mm which might be from sj@xxxxxxxxxx are mm-damon-core-intorduce-per-context-region-priorities-histogram-buffer.patch mm-damon-core-replace-per-quota-regions-priority-histogram-buffer-usage-with-per-context-one.patch mm-damon-core-remove-per-scheme-region-priority-histogram-buffer.patch revert-mm-damon-lru_sort-adjust-local-variable-to-dynamic-allocation.patch docs-damon-use-damonitor-github-organization-instead-of-awslabs.patch docs-damon-maintainer-profile-add-links-in-place.patch docs-damon-maintainer-profile-document-google-calendar-for-bi-weekly-meetups.patch mm-damon-tests-vaddr-kunit-init-maple-tree-without-mt_flags_lock_extern.patch