2021-07-27 14:17:37

by kernel test robot

[permalink] [raw]
Subject: [mm/page_alloc] 44042b4498: WARNING:possible_recursive_locking_detected



Greeting,

FYI, we noticed the following commit (built with gcc-9):

commit: 44042b4498728f4376e84bae1ac8016d146d850b ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master


in testcase: boot

on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):



If you fix the issue, kindly add following tag
Reported-by: kernel test robot <[email protected]>


[ 23.595577] BUG: sleeping function called from invalid context at mm/page_alloc.c:5167
[ 23.596494] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0
[ 23.597340] 1 lock held by swapper/0/1:
[ 23.597508] #0: ffff88839fe3fe00 (lock#2){..-.}-{2:2}, at: local_lock_acquire (kbuild/src/consumer/include/linux/local_lock_internal.h:41)
[ 23.597508] irq event stamp: 1564282
[ 23.597508] hardirqs last enabled at (1564281): _raw_spin_unlock_irqrestore (kbuild/src/consumer/include/linux/spinlock_api_smp.h:160 kbuild/src/consumer/kernel/locking/spinlock.c:191)
[ 23.597508] hardirqs last disabled at (1564282): __alloc_pages_bulk (kbuild/src/consumer/mm/page_alloc.c:3646 kbuild/src/consumer/mm/page_alloc.c:5291)
[ 23.597508] softirqs last enabled at (1564034): neigh_parms_alloc (kbuild/src/consumer/net/core/neighbour.c:1580)
[ 23.597508] softirqs last disabled at (1564032): neigh_parms_alloc (kbuild/src/consumer/include/linux/refcount.h:343 kbuild/src/consumer/include/linux/refcount.h:359 kbuild/src/consumer/include/linux/netdevice.h:4142 kbuild/src/consumer/net/core/neighbour.c:1634)
[ 23.597508] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.13.0+ #2
[ 23.597508] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[ 23.597508] Call Trace:
[ 23.597508] dump_stack_lvl (kbuild/src/consumer/arch/x86/include/asm/irqflags.h:29 (discriminator 3) kbuild/src/consumer/arch/x86/include/asm/irqflags.h:70 (discriminator 3) kbuild/src/consumer/arch/x86/include/asm/irqflags.h:132 (discriminator 3) kbuild/src/consumer/lib/dump_stack.c:125 (discriminator 3))
[ 23.597508] dump_stack (kbuild/src/consumer/lib/dump_stack.c:138)
[ 23.597508] ___might_sleep (kbuild/src/consumer/include/linux/perf_event.h:1163 (discriminator 11) kbuild/src/consumer/include/trace/events/sched.h:399 (discriminator 11))
[ 23.597508] __might_sleep (kbuild/src/consumer/include/linux/perf_event.h:1163 (discriminator 11) kbuild/src/consumer/include/trace/events/sched.h:399 (discriminator 11))
[ 23.597508] prepare_alloc_pages+0x1f0/0x35f
[ 23.597508] __alloc_pages (kbuild/src/consumer/mm/page_alloc.c:5340)
[ 23.597508] ? __alloc_pages_slowpath+0x1466/0x1466
[ 23.597508] ? ftrace_likely_update (kbuild/src/consumer/kernel/trace/trace_branch.c:279)
[ 23.597508] ? _find_next_bit (kbuild/src/consumer/lib/find_bit.c:140)
[ 23.597508] ? _find_first_bit (kbuild/src/consumer/lib/find_bit.c:97)
[ 23.597508] alloc_page_interleave (kbuild/src/consumer/mm/mempolicy.c:2147)
[ 23.597508] alloc_pages (kbuild/src/consumer/mm/mempolicy.c:2277)
[ 23.597508] stack_depot_save (kbuild/src/consumer/lib/stackdepot.c:308)
[ 23.597508] ? __lock_acquire (kbuild/src/consumer/kernel/locking/lockdep.c:5538)
[ 23.597508] save_stack (kbuild/src/consumer/mm/page_owner.c:339)
[ 23.597508] ? register_early_stack (kbuild/src/consumer/mm/page_owner.c:126)
[ 23.597508] ? post_alloc_hook (kbuild/src/consumer/include/linux/page_owner.h:31 kbuild/src/consumer/mm/page_alloc.c:2427)
[ 23.597508] ? __alloc_pages_bulk (kbuild/src/consumer/mm/page_alloc.c:5317 (discriminator 3))
[ 23.597508] ? __vmalloc_area_node+0x22f/0x4aa
[ 23.597508] ? __vmalloc_node_range (kbuild/src/consumer/mm/vmalloc.c:2944)
[ 23.597508] ? __vmalloc_node (kbuild/src/consumer/mm/vmalloc.c:3028)
[ 23.597508] ? vzalloc (kbuild/src/consumer/mm/vmalloc.c:3066)
[ 23.597508] ? pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] ? do_one_initcall (kbuild/src/consumer/init/main.c:1266)
[ 23.597508] ? kernel_init_freeable (kbuild/src/consumer/init/do_mounts.c:368 kbuild/src/consumer/init/do_mounts.c:420)
[ 23.597508] ? kernel_init (kbuild/src/consumer/init/main.c:1449)
[ 23.597508] ? ret_from_fork (kbuild/src/consumer/arch/x86/entry/entry_64.S:300)
[ 23.597508] ? rcu_read_unlock (kbuild/src/consumer/include/linux/rcupdate.h:74 (discriminator 7) kbuild/src/consumer/include/linux/rcupdate.h:710 (discriminator 7))
[ 23.597508] ? lock_is_held+0xc/0xe
[ 23.597508] ? __kasan_check_read+0x11/0x13
[ 23.597508] ? __nr_to_section+0x91/0x99
[ 23.597508] __set_page_owner (kbuild/src/consumer/mm/page_owner.c:181)
[ 23.597508] post_alloc_hook (kbuild/src/consumer/include/linux/page_owner.h:31 kbuild/src/consumer/mm/page_alloc.c:2427)
[ 23.597508] __alloc_pages_bulk (kbuild/src/consumer/mm/page_alloc.c:5317 (discriminator 3))
[ 23.597508] ? __alloc_pages (kbuild/src/consumer/include/linux/sched/mm.h:171 kbuild/src/consumer/mm/page_alloc.c:5361)
[ 23.597508] ? ____kasan_kmalloc+0x83/0x8f
[ 23.597508] ? __kasan_kmalloc+0x9/0xb
[ 23.597508] ? __kmalloc_node (kbuild/src/consumer/include/linux/percpu-refcount.h:338 kbuild/src/consumer/include/linux/memcontrol.h:797 kbuild/src/consumer/mm/slab.h:281 kbuild/src/consumer/mm/slab.h:490 kbuild/src/consumer/mm/slub.c:2891 kbuild/src/consumer/mm/slub.c:4154)
[ 23.597508] ? __vmalloc_area_node+0x12b/0x4aa
[ 23.597508] __vmalloc_area_node+0x22f/0x4aa
[ 23.597508] __vmalloc_node_range (kbuild/src/consumer/mm/vmalloc.c:2944)
[ 23.597508] ? pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] __vmalloc_node (kbuild/src/consumer/mm/vmalloc.c:3028)
[ 23.597508] ? pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] vzalloc (kbuild/src/consumer/mm/vmalloc.c:3066)
[ 23.597508] pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] ? pppoe_init_net (kbuild/src/consumer/drivers/net/ppp/pptp.c:640)
[ 23.597508] do_one_initcall (kbuild/src/consumer/init/main.c:1266)
[ 23.597508] ? cpu_online+0xb7/0xb7
[ 23.597508] ? rcu_read_lock_sched_held (kbuild/src/consumer/kernel/rcu/update.c:124 (discriminator 4))
[ 23.597508] ? trc_inspect_reader (kbuild/src/consumer/kernel/rcu/tasks.h:924 (discriminator 3))
[ 23.597508] ? ftrace_likely_update (kbuild/src/consumer/kernel/trace/trace_branch.c:279)
[ 23.597508] ? __kasan_check_read+0x11/0x13
[ 23.597508] ? cpu_online+0xa5/0xb7
[ 23.597508] kernel_init_freeable (kbuild/src/consumer/init/do_mounts.c:368 kbuild/src/consumer/init/do_mounts.c:420)
[ 23.597508] ? console_on_rootfs (kbuild/src/consumer/init/main.c:1526)
[ 23.597508] ? trace_hardirqs_on (kbuild/src/consumer/kernel/trace/trace_preemptirq.c:44)
[ 23.597508] ? rest_init (kbuild/src/consumer/init/main.c:713)
[ 23.597508] kernel_init (kbuild/src/consumer/init/main.c:1449)
[ 23.597508] ret_from_fork (kbuild/src/consumer/arch/x86/entry/entry_64.S:300)
[ 23.597508]
[ 23.597508] ============================================
[ 23.597508] WARNING: possible recursive locking detected
[ 23.597508] 5.13.0+ #2 Tainted: G W
[ 23.597508] --------------------------------------------
[ 23.597508] swapper/0/1 is trying to acquire lock:
[ 23.597508] ffff88839fe3fe00 (lock#2){..-.}-{2:2}, at: local_lock_acquire (kbuild/src/consumer/include/linux/local_lock_internal.h:41)
[ 23.597508]
[ 23.597508] but task is already holding lock:
[ 23.597508] ffff88839fe3fe00 (lock#2){..-.}-{2:2}, at: local_lock_acquire (kbuild/src/consumer/include/linux/local_lock_internal.h:41)
[ 23.597508]
[ 23.597508] other info that might help us debug this:
[ 23.597508] Possible unsafe locking scenario:
[ 23.597508]
[ 23.597508] CPU0
[ 23.597508] ----
[ 23.597508] lock(lock#2);
[ 23.597508]
[ 23.597508] *** DEADLOCK ***
[ 23.597508]
[ 23.597508] May be due to missing lock nesting notation
[ 23.597508]
[ 23.597508] 1 lock held by swapper/0/1:
[ 23.597508] #0: ffff88839fe3fe00 (lock#2){..-.}-{2:2}, at: local_lock_acquire (kbuild/src/consumer/include/linux/local_lock_internal.h:41)
[ 23.597508]
[ 23.597508] stack backtrace:
[ 23.597508] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 5.13.0+ #2
[ 23.597508] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[ 23.597508] Call Trace:
[ 23.597508] dump_stack_lvl (kbuild/src/consumer/arch/x86/include/asm/irqflags.h:29 (discriminator 3) kbuild/src/consumer/arch/x86/include/asm/irqflags.h:70 (discriminator 3) kbuild/src/consumer/arch/x86/include/asm/irqflags.h:132 (discriminator 3) kbuild/src/consumer/lib/dump_stack.c:125 (discriminator 3))
[ 23.597508] dump_stack (kbuild/src/consumer/lib/dump_stack.c:138)
[ 23.597508] validate_chain (kbuild/src/consumer/kernel/locking/lockdep.c:3231 kbuild/src/consumer/kernel/locking/lockdep.c:3325 kbuild/src/consumer/kernel/locking/lockdep.c:3538 kbuild/src/consumer/kernel/locking/lockdep.c:3625 kbuild/src/consumer/kernel/locking/lockdep.c:3646)
[ 23.597508] ? check_prev_add (kbuild/src/consumer/kernel/locking/lockdep.c:203 kbuild/src/consumer/kernel/locking/lockdep.c:2978)
[ 23.597508] ? test_bit+0x28/0x35
[ 23.597508] ? __kasan_check_read+0x11/0x13
[ 23.597508] __lock_acquire (kbuild/src/consumer/kernel/locking/lockdep.c:5538)
[ 23.597508] lock_acquire (kbuild/src/consumer/include/trace/events/lock.h:13 kbuild/src/consumer/kernel/locking/lockdep.c:5485)
[ 23.597508] ? static_key_enable (kbuild/src/consumer/arch/x86/kernel/cpu/bugs.c:1656 kbuild/src/consumer/arch/x86/kernel/cpu/bugs.c:1704)
[ 23.597508] ? freeze_kernel_threads (kbuild/src/consumer/kernel/power/suspend.c:330 (discriminator 13))
[ 23.597508] ? rcu_read_unlock (kbuild/src/consumer/include/linux/rcupdate.h:74 (discriminator 7) kbuild/src/consumer/include/linux/rcupdate.h:710 (discriminator 7))
[ 23.597508] ? __module_text_address (kbuild/src/consumer/kernel/module.c:4692)
[ 23.597508] ? is_module_text_address (kbuild/src/consumer/arch/x86/include/asm/preempt.h:85 kbuild/src/consumer/kernel/module.c:4677)
[ 23.597508] ? kernel_text_address (kbuild/src/consumer/kernel/extable.c:142)
[ 23.597508] ? __kernel_text_address (kbuild/src/consumer/kernel/extable.c:67 kbuild/src/consumer/kernel/extable.c:115)
[ 23.597508] ? show_trace_log_lvl (kbuild/src/consumer/arch/x86/kernel/dumpstack.c:256)
[ 23.597508] local_lock_acquire (kbuild/src/consumer/include/linux/local_lock_internal.h:42)
[ 23.597508] ? static_key_enable (kbuild/src/consumer/arch/x86/kernel/cpu/bugs.c:1656 kbuild/src/consumer/arch/x86/kernel/cpu/bugs.c:1704)
[ 23.597508] rmqueue (kbuild/src/consumer/mm/page_alloc.c:2389 (discriminator 9) kbuild/src/consumer/mm/page_alloc.c:3729 (discriminator 9))
[ 23.597508] ? __kasan_check_read+0x11/0x13
[ 23.597508] ? zone_page_state+0x36/0x68
[ 23.597508] ? ftrace_likely_update (kbuild/src/consumer/kernel/trace/trace_branch.c:279)
[ 23.597508] ? __rmqueue_pcplist+0x283/0x283
[ 23.597508] ? zone_watermark_fast+0x4c/0x166
[ 23.597508] get_page_from_freelist (kbuild/src/consumer/include/linux/mmzone.h:1148 kbuild/src/consumer/mm/page_alloc.c:4065)
[ 23.597508] __alloc_pages (kbuild/src/consumer/include/linux/mmzone.h:1146 kbuild/src/consumer/include/linux/mmzone.h:1172 kbuild/src/consumer/mm/page_alloc.c:5182 kbuild/src/consumer/mm/page_alloc.c:5363)
[ 23.597508] ? __alloc_pages_slowpath+0x1466/0x1466
[ 23.597508] ? ftrace_likely_update (kbuild/src/consumer/kernel/trace/trace_branch.c:279)
[ 23.597508] ? _find_next_bit (kbuild/src/consumer/lib/find_bit.c:140)
[ 23.597508] ? _find_first_bit (kbuild/src/consumer/lib/find_bit.c:97)
[ 23.597508] alloc_page_interleave (kbuild/src/consumer/mm/mempolicy.c:2147)
[ 23.597508] alloc_pages (kbuild/src/consumer/mm/mempolicy.c:2277)
[ 23.597508] stack_depot_save (kbuild/src/consumer/lib/stackdepot.c:308)
[ 23.597508] ? __lock_acquire (kbuild/src/consumer/kernel/locking/lockdep.c:5538)
[ 23.597508] save_stack (kbuild/src/consumer/mm/page_owner.c:339)
[ 23.597508] ? register_early_stack (kbuild/src/consumer/mm/page_owner.c:126)
[ 23.597508] ? post_alloc_hook (kbuild/src/consumer/include/linux/page_owner.h:31 kbuild/src/consumer/mm/page_alloc.c:2427)
[ 23.597508] ? __alloc_pages_bulk (kbuild/src/consumer/mm/page_alloc.c:5317 (discriminator 3))
[ 23.597508] ? __vmalloc_area_node+0x22f/0x4aa
[ 23.597508] ? __vmalloc_node_range (kbuild/src/consumer/mm/vmalloc.c:2944)
[ 23.597508] ? __vmalloc_node (kbuild/src/consumer/mm/vmalloc.c:3028)
[ 23.597508] ? vzalloc (kbuild/src/consumer/mm/vmalloc.c:3066)
[ 23.597508] ? pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] ? do_one_initcall (kbuild/src/consumer/init/main.c:1266)
[ 23.597508] ? kernel_init_freeable (kbuild/src/consumer/init/do_mounts.c:368 kbuild/src/consumer/init/do_mounts.c:420)
[ 23.597508] ? kernel_init (kbuild/src/consumer/init/main.c:1449)
[ 23.597508] ? ret_from_fork (kbuild/src/consumer/arch/x86/entry/entry_64.S:300)
[ 23.597508] ? rcu_read_unlock (kbuild/src/consumer/include/linux/rcupdate.h:74 (discriminator 7) kbuild/src/consumer/include/linux/rcupdate.h:710 (discriminator 7))
[ 23.597508] ? lock_is_held+0xc/0xe
[ 23.597508] ? __kasan_check_read+0x11/0x13
[ 23.597508] ? __nr_to_section+0x91/0x99
[ 23.597508] __set_page_owner (kbuild/src/consumer/mm/page_owner.c:181)
[ 23.597508] post_alloc_hook (kbuild/src/consumer/include/linux/page_owner.h:31 kbuild/src/consumer/mm/page_alloc.c:2427)
[ 23.597508] __alloc_pages_bulk (kbuild/src/consumer/mm/page_alloc.c:5317 (discriminator 3))
[ 23.597508] ? __alloc_pages (kbuild/src/consumer/include/linux/sched/mm.h:171 kbuild/src/consumer/mm/page_alloc.c:5361)
[ 23.597508] ? ____kasan_kmalloc+0x83/0x8f
[ 23.597508] ? __kasan_kmalloc+0x9/0xb
[ 23.597508] ? __kmalloc_node (kbuild/src/consumer/include/linux/percpu-refcount.h:338 kbuild/src/consumer/include/linux/memcontrol.h:797 kbuild/src/consumer/mm/slab.h:281 kbuild/src/consumer/mm/slab.h:490 kbuild/src/consumer/mm/slub.c:2891 kbuild/src/consumer/mm/slub.c:4154)
[ 23.597508] ? __vmalloc_area_node+0x12b/0x4aa
[ 23.597508] __vmalloc_area_node+0x22f/0x4aa
[ 23.597508] __vmalloc_node_range (kbuild/src/consumer/mm/vmalloc.c:2944)
[ 23.597508] ? pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] __vmalloc_node (kbuild/src/consumer/mm/vmalloc.c:3028)
[ 23.597508] ? pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] vzalloc (kbuild/src/consumer/mm/vmalloc.c:3066)
[ 23.597508] pptp_init_module (kbuild/src/consumer/drivers/net/ppp/pptp.c:642)
[ 23.597508] ? pppoe_init_net (kbuild/src/consumer/drivers/net/ppp/pptp.c:640)
[ 23.597508] do_one_initcall (kbuild/src/consumer/init/main.c:1266)
[ 23.597508] ? cpu_online+0xb7/0xb7
[ 23.597508] ? rcu_read_lock_sched_held (kbuild/src/consumer/kernel/rcu/update.c:124 (discriminator 4))
[ 23.597508] ? trc_inspect_reader (kbuild/src/consumer/kernel/rcu/tasks.h:924 (discriminator 3))
[ 23.597508] ? ftrace_likely_update (kbuild/src/consumer/kernel/trace/trace_branch.c:279)
[ 23.597508] ? __kasan_check_read+0x11/0x13
[ 23.597508] ? cpu_online+0xa5/0xb7


To reproduce:

# build kernel
cd linux
cp config-5.13.0-00188-g44042b449872 .config
make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage

git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
bin/lkp qemu -k <bzImage> job-script # job-script is attached in this email



---
0DAY/LKP+ Test Infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation

Thanks,
Oliver Sang


Attachments:
(No filename) (15.90 kB)
config-5.13.0-00188-g44042b449872 (144.04 kB)
job-script (4.42 kB)
dmesg.xz (19.47 kB)
Download all attachments

2021-07-27 14:37:02

by Mel Gorman

[permalink] [raw]
Subject: Re: [mm/page_alloc] 44042b4498: WARNING:possible_recursive_locking_detected

On Tue, Jul 27, 2021 at 10:31:36PM +0800, kernel test robot wrote:
>
>
> Greeting,
>
> FYI, we noticed the following commit (built with gcc-9):
>
> commit: 44042b4498728f4376e84bae1ac8016d146d850b ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
>

Does this warning happen after 187ad460b841 ("mm/page_alloc: avoid page
allocator recursion with pagesets.lock held")? I ask because I see the
stack_depot_save in the warning.

--
Mel Gorman
SUSE Labs

2021-07-28 04:57:27

by kernel test robot

[permalink] [raw]
Subject: Re: [mm/page_alloc] 44042b4498: WARNING:possible_recursive_locking_detected

hi Mel Gorman,

On Tue, Jul 27, 2021 at 03:35:38PM +0100, Mel Gorman wrote:
> On Tue, Jul 27, 2021 at 10:31:36PM +0800, kernel test robot wrote:
> >
> >
> > Greeting,
> >
> > FYI, we noticed the following commit (built with gcc-9):
> >
> > commit: 44042b4498728f4376e84bae1ac8016d146d850b ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists")
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
> >
>
> Does this warning happen after 187ad460b841 ("mm/page_alloc: avoid page
> allocator recursion with pagesets.lock held")? I ask because I see the
> stack_depot_save in the warning.

from our tests, this warning cannot be reproduced upon 187ad460b841.
Thanks for information!

>
> --
> Mel Gorman
> SUSE Labs