Re: [LKP] [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

From: Fengguang Wu
Date: Wed Nov 30 2016 - 01:27:39 EST


Hi Paul,

Attached is the new dmesg.

On Wed, Nov 30, 2016 at 05:39:50AM +0800, Ye Xiaolong wrote:
On 11/29, Paul E. McKenney wrote:
On Tue, Nov 29, 2016 at 05:21:19PM +0000, Sudeep Holla wrote:
On Sun, Nov 27, 2016 at 6:16 PM, kernel test robot
<xiaolong.ye@xxxxxxxxx> wrote:
>
> FYI, we noticed the following commit:
>
> commit e7c1db75fed821a961ce1ca2b602b08e75de0cd8 ("mm: Prevent __alloc_pages_nodemask() RCU CPU stall warnings")
> https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/next
>
> in testcase: boot
>
> on test machine: qemu-system-x86_64 -enable-kvm -cpu Nehalem -smp 2 -m 1G
>
> caused below changes:
>
[...]

> [ 8.953192] BUG: sleeping function called from invalid context at mm/page_alloc.c:3746
> [ 8.956353] in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0

I am observing similar BUG/backtrace even on ARM64 platform.

Does the (untested) patch below help?

Thanx, Paul

Hi, Paul

I applied your patch on top of 2d66ccc "mm:
Prevent__alloc_pages_nodemask() RCU CPU stall warnings"(e7c1db7 turns to
2d66ccc in rcu/next branch now), here is the comparison of 6 times
testing, seems the BUG persists.

b70fa84d2eeef5f6be25633a2b is the commit id of commit "rcu: Allow
boot-time useof cond_resched_rcu_qs()"

testcase/path_params/tbox_group/run: boot/1/vm-vp-1G

2d66cccd73436ac9 b70fa84d2eeef5f6be25633a2b
---------------- --------------------------
6:6 0% 6:6 dmesg.BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

The new dmesg looks like this:

[ 6.505611] Write protecting the kernel read-only data: 14336k
[ 6.507798] Freeing unused kernel memory: 544K (ffff880001978000 - ffff880001a00000)
[ 6.515634] Freeing unused kernel memory: 240K (ffff880001dc4000 - ffff880001e00000)
[ 6.524713] BUG: sleeping function called from invalid context at mm/page_alloc.c:3746
[ 6.527327] in_atomic(): 0, irqs_disabled(): 1, pid: 1, name: init
[ 6.528891] CPU: 1 PID: 1 Comm: init Not tainted 4.9.0-rc1-00048-gb70fa84 #1
[ 6.530604] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
[ 6.533255] ffffc90000197b48 ffffffff81472609 ffff8800296a0000 0000000002201200
[ 6.538069] ffffc90000197b60 ffffffff810a85a3 ffff8800364bc080 ffffc90000197bf0
[ 6.542821] ffffffff81190dce ffff8800296a0000 ffff8800296a0000 ffff8800296a0000
[ 6.548618] Call Trace:
[ 6.550675] [<ffffffff81472609>] dump_stack+0x63/0x8a
[ 6.554180] [<ffffffff810a85a3>] ___might_sleep+0xd3/0x120
[ 6.556720] [<ffffffff81190dce>] __alloc_pages_nodemask+0x23e/0x300
[ 6.560427] [<ffffffff811e53d5>] alloc_pages_current+0x95/0x140
[ 6.564063] [<ffffffff811efe10>] new_slab+0x3c0/0x5a0
[ 6.566516] [<ffffffff811f11b0>] ___slab_alloc+0x3a0/0x4b0
[ 6.570114] [<ffffffff811ce073>] ? anon_vma_clone+0x63/0x1c0
[ 6.572672] [<ffffffff811bf802>] ? alloc_set_pte+0x4f2/0x610
[ 6.576273] [<ffffffff811ce073>] ? anon_vma_clone+0x63/0x1c0
[ 6.578824] [<ffffffff811f12e0>] __slab_alloc+0x20/0x40
[ 6.582348] [<ffffffff811f26ef>] kmem_cache_alloc+0x17f/0x1c0
[ 6.585971] [<ffffffff811ce073>] anon_vma_clone+0x63/0x1c0
[ 6.588487] [<ffffffff811c661c>] ? __split_vma+0x5c/0x1e0
[ 6.592159] [<ffffffff811c6684>] __split_vma+0xc4/0x1e0
[ 6.594746] [<ffffffff811c71d4>] split_vma+0x24/0x30
[ 6.598248] [<ffffffff811ca35c>] mprotect_fixup+0x21c/0x270
[ 6.601130] [<ffffffff811ca5bc>] do_mprotect_pkey+0x20c/0x300
[ 6.602739] [<ffffffff811ca6c3>] SyS_mprotect+0x13/0x20
[ 6.604328] [<ffffffff8196eb77>] entry_SYSCALL_64_fastpath+0x1a/0xa9
SELinux: Could not open policy file <= /etc/selinux/targeted/policy/policy.30: No such file or directory
[ 6.609407] systemd[1]: RTC configured in localtime, applying delta of 480 minutes to system time.
[ 6.637736] random: fast init done
[ 6.693275] ip_tables: (C) 2000-2006 Netfilter Core Team
...
[ 7.553423] NFS: Registering the id_resolver key type
[ 7.555204] Key type id_resolver registered
[ 7.557629] Key type id_legacy registered
[ 7.570901] scsi 1:0:0:0: Attached scsi generic sg0 type 5
[ 7.572947] BUG: sleeping function called from invalid context at mm/page_alloc.c:3746
[ 7.575717] in_atomic(): 1, irqs_disabled(): 0, pid: 251, name: modprobe
[ 7.577496] CPU: 1 PID: 251 Comm: modprobe Tainted: G W 4.9.0-rc1-00048-gb70fa84 #1
[ 7.585286] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
[ 7.593093] ffffc900005e3b78 ffffffff81472609 ffff88003f33c900 0000000002000200
[ 7.597043] ffffc900005e3b90 ffffffff810a85a3 ffff8800364bc080 ffffc900005e3c20
[ 7.599790] ffffffff81190dce ffff88003f33c900 ffff88003f33c900 ffff88003f33c900
[ 7.608630] Call Trace:
[ 7.609787] [<ffffffff81472609>] dump_stack+0x63/0x8a
[ 7.611366] [<ffffffff810a85a3>] ___might_sleep+0xd3/0x120
[ 7.614373] [<ffffffff81190dce>] __alloc_pages_nodemask+0x23e/0x300
[ 7.622141] [<ffffffff811e53d5>] alloc_pages_current+0x95/0x140
[ 7.623754] [<ffffffff8118be2e>] __get_free_pages+0xe/0x40
[ 7.625323] [<ffffffff811bb693>] __tlb_remove_page_size+0x53/0x90
[ 7.627086] [<ffffffff811be47b>] unmap_page_range+0x6cb/0x910
[ 7.628647] [<ffffffff81198b7c>] ? release_pages+0x2fc/0x390
[ 7.630242] [<ffffffff811be73d>] unmap_single_vma+0x7d/0xe0
[ 7.631725] [<ffffffff811bea51>] unmap_vmas+0x51/0xa0
[ 7.633139] [<ffffffff811c538e>] unmap_region+0xae/0x110
[ 7.634564] [<ffffffff811c7453>] do_munmap+0x273/0x440
[ 7.635984] [<ffffffff811c76e0>] SyS_munmap+0x50/0x70
[ 7.637369] [<ffffffff8196eb77>] entry_SYSCALL_64_fastpath+0x1a/0xa9
[ 7.660008] NFS: set_pnfs_layoutdriver: cl_exchange_flags 0x0
...

Thanks,
Fengguang

------------------------------------------------------------------------

commit ccc0666e2049e5818c236e647cf20c552a7b053b
Author: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Tue Nov 29 11:06:05 2016 -0800

rcu: Allow boot-time use of cond_resched_rcu_qs()

The cond_resched_rcu_qs() macro is used to force RCU quiescent states into
long-running in-kernel loops. However, some of these loops can execute
during early boot when interrupts are disabled, and during which time
it is therefore illegal to enter the scheduler. This commit therefore
makes cond_resched_rcu_qs() be a no-op during early boot.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 525ca34603b7..8b4b1be8095b 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -423,7 +423,7 @@ extern struct srcu_struct tasks_rcu_exit_srcu;
*/
#define cond_resched_rcu_qs() \
do { \
- if (!cond_resched()) \
+ if (rcu_scheduler_active && !cond_resched()) \
rcu_note_voluntary_context_switch(current); \
} while (0)


_______________________________________________
LKP mailing list
LKP@xxxxxxxxxxxx
https://lists.01.org/mailman/listinfo/lkp

Attachment: dmesg.xz
Description: application/xz