Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532592 > unrolled thread

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

Started bySudeep Holla <sudeep.holla@arm.com>
First post2016-11-29 18:30 +0100
Last post2016-11-30 13:30 +0100
Articles 8 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c Sudeep Holla <sudeep.holla@arm.com> - 2016-11-29 18:30 +0100
    Re: [lkp] [mm] e7c1db75fe:  BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-29 20:20 +0100
      Re: [lkp] [mm] e7c1db75fe:  BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c Ye Xiaolong <xiaolong.ye@intel.com> - 2016-11-30 03:30 +0100
      Re: [lkp] [mm] e7c1db75fe:  BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c Ye Xiaolong <xiaolong.ye@intel.com> - 2016-11-30 06:50 +0100
        Re: [LKP] [lkp] [mm] e7c1db75fe:  BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c Fengguang Wu <fengguang.wu@intel.com> - 2016-11-30 07:30 +0100
      Re: [lkp] [mm] e7c1db75fe:  BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c Michal Hocko <mhocko@kernel.org> - 2016-11-30 08:20 +0100
        Re: [lkp] [mm] e7c1db75fe:  BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-11-30 08:50 +0100
          Re: [lkp] [mm] e7c1db75fe:  BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c Sudeep Holla <sudeep.holla@arm.com> - 2016-11-30 13:30 +0100

#1532592 — Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-11-29 18:30 +0100
SubjectRe: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sIUoa-311-41@gated-at.bofh.it>
On Sun, Nov 27, 2016 at 6:16 PM, kernel test robot
<xiaolong.ye@intel.com> 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.

--
Regards,
Sudeep

[toc] | [next] | [standalone]


#1532694 — Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-11-29 20:20 +0100
SubjectRe: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sIW6C-48h-13@gated-at.bofh.it>
In reply to#1532592
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@intel.com> 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

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

commit ccc0666e2049e5818c236e647cf20c552a7b053b
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
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@linux.vnet.ibm.com>

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)
 

[toc] | [prev] | [next] | [standalone]


#1532919 — Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

FromYe Xiaolong <xiaolong.ye@intel.com>
Date2016-11-30 03:30 +0100
SubjectRe: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sJ2OJ-8mh-5@gated-at.bofh.it>
In reply to#1532694
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@intel.com> 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?

I've queued test jobs for this patch, will let you know once I get the
result.

Thanks,
Xiaolong
>
>							Thanx, Paul
>
>------------------------------------------------------------------------
>
>commit ccc0666e2049e5818c236e647cf20c552a7b053b
>Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>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@linux.vnet.ibm.com>
>
>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)
> 
>

[toc] | [prev] | [next] | [standalone]


#1532967 — Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

FromYe Xiaolong <xiaolong.ye@intel.com>
Date2016-11-30 06:50 +0100
SubjectRe: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sJ5Wh-1XE-7@gated-at.bofh.it>
In reply to#1532694
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@intel.com> 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

Thanks,
Xiaolong
>
>------------------------------------------------------------------------
>
>commit ccc0666e2049e5818c236e647cf20c552a7b053b
>Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>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@linux.vnet.ibm.com>
>
>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)
> 
>

[toc] | [prev] | [next] | [standalone]


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

FromFengguang Wu <fengguang.wu@intel.com>
Date2016-11-30 07:30 +0100
SubjectRe: [LKP] [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sJ6z0-2x2-19@gated-at.bofh.it>
In reply to#1532967

[Multipart message — attachments visible in raw view] — view raw

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@intel.com> 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@linux.vnet.ibm.com>
>>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@linux.vnet.ibm.com>
>>
>>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@lists.01.org
>https://lists.01.org/mailman/listinfo/lkp

[toc] | [prev] | [next] | [standalone]


#1533010 — Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

FromMichal Hocko <mhocko@kernel.org>
Date2016-11-30 08:20 +0100
SubjectRe: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sJ7lo-31Q-1@gated-at.bofh.it>
In reply to#1532694
On Tue 29-11-16 11:14:48, 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@intel.com> 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
> 
> ------------------------------------------------------------------------
> 
> commit ccc0666e2049e5818c236e647cf20c552a7b053b
> Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 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@linux.vnet.ibm.com>

This is not the problem with your "mm: Prevent __alloc_pages_nodemask()
RCU CPU stall warnings", though. The main problem imho is that the
allocator might be called from the atomic contexts (aka
gfp_mask & ~__GFP_DIRECT_RECLAIM). Besides that I do not think that any
variant of cond_resched inside the allocator hot path
__alloc_pages_nodemask is just wrong. If anything such a scheduling/RCU
point should be added to the slow path. But as I've said earlier we
already have these points in that path so new ones shouldn't be really
necessary.

Could you drop this patch Paul, please?

-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [next] | [standalone]


#1533033 — Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-11-30 08:50 +0100
SubjectRe: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sJ7Oq-3b7-1@gated-at.bofh.it>
In reply to#1533010
On Wed, Nov 30, 2016 at 08:16:02AM +0100, Michal Hocko wrote:
> On Tue 29-11-16 11:14:48, 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@intel.com> 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
> > 
> > ------------------------------------------------------------------------
> > 
> > commit ccc0666e2049e5818c236e647cf20c552a7b053b
> > Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 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@linux.vnet.ibm.com>
> 
> This is not the problem with your "mm: Prevent __alloc_pages_nodemask()
> RCU CPU stall warnings", though. The main problem imho is that the
> allocator might be called from the atomic contexts (aka
> gfp_mask & ~__GFP_DIRECT_RECLAIM). Besides that I do not think that any
> variant of cond_resched inside the allocator hot path
> __alloc_pages_nodemask is just wrong. If anything such a scheduling/RCU
> point should be added to the slow path. But as I've said earlier we
> already have these points in that path so new ones shouldn't be really
> necessary.
> 
> Could you drop this patch Paul, please?

Good point, dropped.

Boris's test results show that something else is needed, will review
his splats and see what else presents itself.

							Thanx, Paul

[toc] | [prev] | [next] | [standalone]


#1533265 — Re: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-11-30 13:30 +0100
SubjectRe: [lkp] [mm] e7c1db75fe: BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c
Message-ID<sJcbn-64I-7@gated-at.bofh.it>
In reply to#1533033
On 30/11/16 07:40, Paul E. McKenney wrote:
> On Wed, Nov 30, 2016 at 08:16:02AM +0100, Michal Hocko wrote:
>> On Tue 29-11-16 11:14:48, 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@intel.com> 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?

Yes it didn't work for me either. Adding the log from my setup(in case
it's useful)

Regards,
Sudeep


--->8

BUG: sleeping function called from invalid context at mm/page_alloc.c:3775
in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper/0
1 lock held by swapper/0/1:
 #0:   (&sig->cred_guard_mutex ){+.+.+.}, at:   prepare_bprm_creds+0x2c/0x70
irq event stamp: 508063
hardirqs last  enabled at (508062):  __netdev_alloc_skb+0x11c/0x160
hardirqs last disabled at (508063):  __slab_alloc.isra.22.constprop.26+0x30/0x90
softirqs last  enabled at (508052):  xprt_end_transmit+0x4c/0x60
softirqs last disabled at (508053):  do_softirq.part.4+0x7c/0x98
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 29 2016
Call trace:
 dump_backtrace+0x0/0x260
 show_stack+0x24/0x30
 dump_stack+0xac/0xe8
 ___might_sleep+0x14c/0x1f8
 __alloc_pages_nodemask+0x414/0xef0
 new_slab+0xa4/0x558
 ___slab_alloc.constprop.27+0x2f8/0x378
 __slab_alloc.isra.22.constprop.26+0x4c/0x90
 kmem_cache_alloc+0x388/0x430
 __build_skb+0x34/0xc0
 __netdev_alloc_skb+0xf0/0x160
 smsc911x_poll+0x9c/0x280
 net_rx_action+0x200/0x510
 __do_softirq+0x12c/0x6fc
 do_softirq.part.4+0x7c/0x98
 __local_bh_enable_ip+0x110/0x138
 _raw_spin_unlock_bh+0x40/0x50
 xprt_end_transmit+0x4c/0x60
 call_transmit_status+0x58/0x100
 call_transmit+0x178/0x1e8
 __rpc_execute+0xa0/0x680
 rpc_execute+0xb4/0x298
 rpc_run_task+0x11c/0x168
 nfs4_call_sync_sequence+0x6c/0x98
 _nfs4_proc_access+0xe8/0x170
 nfs4_proc_access+0x88/0x2a0
 nfs_do_access+0x458/0x778
 nfs_permission+0x2c8/0x2f8
 __inode_permission+0xa0/0x100
 inode_permission+0x2c/0x70
 link_path_walk+0x98/0x518
 path_openat+0x74/0x340
 do_filp_open+0x70/0xf8
 do_open_execat+0x70/0x1a0
 do_execveat_common.isra.14+0x288/0x998
 do_execve+0x44/0x58
 run_init_process+0x38/0x48
 try_to_run_init_process+0x20/0x58
 kernel_init+0xb4/0x108
 ret_from_fork+0x10/0x30
BUG: sleeping function called from invalid context at mm/page_alloc.c:3775
in_atomic(): 1, irqs_disabled(): 128, pid: 98, name: kworker/0:1
3 locks held by kworker/0:1/98:
 #0: ("rpciod" ){.+.+..} , at: process_one_work+0x198/0x818
 #1: ((&task->u.tk_work)){+.+...}, at: process_one_work+0x198/0x818
 #2: (&(&clnt->cl_lock)->rlock){+.+...}, at: rpc_task_release_client+0x38/0xb0
irq event stamp: 31359
hardirqs last  enabled at (31358):  _raw_spin_unlock_irqrestore+0x84/0x90
hardirqs last disabled at (31359):  __netdev_alloc_skb+0xa8/0x160
softirqs last  enabled at (31252):  rpc_wake_up_first_on_wq+0x84/0x200
softirqs last disabled at (31255):  irq_exit+0xe8/0x148
CPU: 0 PID: 98 Comm: kworker/0:1 Tainted: G        W       4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 29 2016
Workqueue: rpciod rpc_async_schedule
Call trace:
 dump_backtrace+0x0/0x260
 show_stack+0x24/0x30
 dump_stack+0xac/0xe8
 ___might_sleep+0x14c/0x1f8
 __alloc_pages_nodemask+0x414/0xef0
 __alloc_page_frag+0xa8/0x158
 __netdev_alloc_skb+0xcc/0x160
 smsc911x_poll+0x9c/0x280
 net_rx_action+0x200/0x510
 __do_softirq+0x12c/0x6fc
 irq_exit+0xe8/0x148
 __handle_domain_irq+0x6c/0xc0
 gic_handle_irq+0x5c/0xb0
BUG: sleeping function called from invalid context at mm/page_alloc.c:3775
in_atomic(): 1, irqs_disabled(): 128, pid: 1326, name: kworker/0:1H
4 locks held by kworker/0:1H/1326:
 #0: ("xprtiod"){.+.+.+}, at: process_one_work+0x198/0x818
 #1: ((&transport->recv_worker)){+.+...}, at: process_one_work+0x198/0x818
 #2: (&new->recv_mutex){+.+...}, at: xs_tcp_data_receive_workfn+0x4c/0x2f8
 #3:  (sk_lock-AF_INET-RPC){+.+...}, at: xs_tcp_data_receive_workfn+0x74/0x2f8
irq event stamp: 41851
hardirqs last  enabled at (41850):  _raw_spin_unlock_irqrestore+0x84/0x90
hardirqs last disabled at (41851):  __netdev_alloc_skb+0xa8/0x160
softirqs last  enabled at (41836):  xs_tcp_data_recv+0x580/0x960
softirqs last disabled at (41843):  irq_exit+0xe8/0x148
CPU: 0 PID: 1326 Comm: kworker/0:1H Tainted: G        W       4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 29 2016
Workqueue: xprtiod xs_tcp_data_receive_workfn
Call trace:
 dump_backtrace+0x0/0x260
 show_stack+0x24/0x30
 dump_stack+0xac/0xe8
 ___might_sleep+0x14c/0x1f8
 __alloc_pages_nodemask+0x414/0xef0
 __alloc_page_frag+0xa8/0x158
 __netdev_alloc_skb+0xcc/0x160
 smsc911x_poll+0x9c/0x280
 net_rx_action+0x200/0x510
 __do_softirq+0x12c/0x6fc
 irq_exit+0xe8/0x148
 __handle_domain_irq+0x6c/0xc0
 gic_handle_irq+0x5c/0xb0
Exception stack(0xffff800974d4b9e0 to 0xffff800974d4bb10)
b9e0: ffff800974c59600 000000000001fc5a 0000800976db6000 fffffffffffffe50
ba00: 0000000000000004 0000000000000040 0000800976db6000 ffff000009353c38
ba20: 0000000000000001 00010643c0000000 c000000000100400 0010080000012144
ba40: 00012145c0000000 c000000000101000 0010180000010646 0000000000000000
ba60: 0000000000000000 0000000000000000 0000000000000000 ffff7e0025d34600
ba80: 00000000009f4d18 0000000000000040 0000000000000003 0000000000000000
baa0: ffff7e0025d34800 0000000000000001 000000000018bce1 ffff800974c0c830
bac0: 0000000000000000 ffff800974d4bb10 ffff00000821b9bc ffff800974d4bb10
bae0: ffff00000821b9c0 0000000060000045 0000000000000040 0000000000000000
bb00: ffffffffffffffff ffff00000821b9bc
 el1_irq+0xb8/0x130
 __free_pages_ok+0x1d0/0x4b0
 __free_page_frag+0x78/0x88
 skb_free_head+0x3c/0x48
 skb_release_data+0xd0/0xf8
 skb_release_all+0x30/0x40
 __kfree_skb+0x20/0x38
 tcp_read_sock+0x118/0x1d8
 xs_tcp_data_receive_workfn+0x84/0x2f8
 process_one_work+0x248/0x818
 worker_thread+0x54/0x438
 kthread+0xe0/0xf8
 ret_from_fork+0x10/0x30
BUG: sleeping function called from invalid context at mm/page_alloc.c:3775
in_atomic(): 1, irqs_disabled(): 128, pid: 6, name: ksoftirqd/0
no locks held by ksoftirqd/0/6.
irq event stamp: 76667
hardirqs last  enabled at (76666):   _raw_spin_unlock_irqrestore+0x84/0x90
hardirqs last disabled at (76667):   __netdev_alloc_skb+0xa8/0x160
softirqs last  enabled at (76506):   __do_softirq+0x5f4/0x6fc
softirqs last disabled at (76511):   run_ksoftirqd+0x40/0xb0
CPU: 0 PID: 6 Comm: ksoftirqd/0 Tainted: G        W       4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 29 2016
Call trace:
 dump_backtrace+0x0/0x260
 show_stack+0x24/0x30
 dump_stack+0xac/0xe8
 ___might_sleep+0x14c/0x1f8
 __alloc_pages_nodemask+0x414/0xef0
 __alloc_page_frag+0xa8/0x158
 __netdev_alloc_skb+0xcc/0x160
 smsc911x_poll+0x9c/0x280
 net_rx_action+0x200/0x510
 __do_softirq+0x12c/0x6fc
 run_ksoftirqd+0x40/0xb0
 smpboot_thread_fn+0x1d4/0x308
 kthread+0xe0/0xf8
 ret_from_fork+0x10/0x30
BUG: sleeping function called from invalid context at mm/page_alloc.c:3775
in_atomic(): 1, irqs_disabled(): 128, pid: 6, name: ksoftirqd/0
no locks held by ksoftirqd/0/6.
irq event stamp: 121831
hardirqs last  enabled at (121830):   _raw_spin_unlock_irqrestore+0x84/0x90
hardirqs last disabled at (121831):   __netdev_alloc_skb+0xa8/0x160
softirqs last  enabled at (121742):   __do_softirq+0x5f4/0x6fc
softirqs last disabled at (121747):   run_ksoftirqd+0x40/0xb0
CPU: 0 PID: 6 Comm: ksoftirqd/0 Tainted: G        W       4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 29 2016
Call trace:
 dump_backtrace+0x0/0x260
 show_stack+0x24/0x30
 dump_stack+0xac/0xe8
 ___might_sleep+0x14c/0x1f8
 __alloc_pages_nodemask+0x414/0xef0
 __alloc_page_frag+0xa8/0x158
 __netdev_alloc_skb+0xcc/0x160
 smsc911x_poll+0x9c/0x280
 net_rx_action+0x200/0x510
 __do_softirq+0x12c/0x6fc
 run_ksoftirqd+0x40/0xb0
 smpboot_thread_fn+0x1d4/0x308
 kthread+0xe0/0xf8
 ret_from_fork+0x10/0x30
NET: Registered protocol family 10

===============================
suspicious RCU usage. ]
4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218 Tainted: G        W
-------------------------------
kernel/sched/core.c:7747 Illegal context switch in RCU-bh read-side critical section!

other info that might help us debug this:

rcu_scheduler_active = 1, debug_locks = 1
3 locks held by systemd/1:
 #0: (rtnl_mutex ){+.+.+.}, at: rtnl_lock+0x20/0x28
 #1: (rcu_read_lock_bh){......}, at: ipv6_add_addr+0x70/0x548 [ipv6]
 #2: (addrconf_hash_lock){+.....}, at: ipv6_add_addr+0x194/0x548 [ipv6]

stack backtrace:
CPU: 3 PID: 1 Comm: systemd Tainted: G        W       4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 29 2016
Call trace:
 dump_backtrace+0x0/0x260
 show_stack+0x24/0x30
 dump_stack+0xac/0xe8
 lockdep_rcu_suspicious+0xcc/0x110
 ___might_sleep+0x1e0/0x1f8
 __alloc_pages_nodemask+0x414/0xef0
 new_slab+0xa4/0x558
 ___slab_alloc.constprop.27+0x2f8/0x378
 __slab_alloc.isra.22.constprop.26+0x4c/0x90
 kmem_cache_alloc+0x388/0x430
 dst_alloc+0x5c/0xb0
 __ip6_dst_alloc+0x3c/0xa0 [ipv6]
 ip6_dst_alloc+0x38/0x108 [ipv6]
 addrconf_dst_alloc+0x4c/0x130 [ipv6]
 ipv6_add_addr+0x274/0x548 [ipv6]
 add_addr+0x4c/0xd8 [ipv6]
 addrconf_notify+0x5c4/0xa98 [ipv6]
 register_netdevice_notifier+0x1e0/0x1e8
 addrconf_init+0xb8/0x270 [ipv6]
 inet6_init+0x180/0x330 [ipv6]
 do_one_initcall+0x44/0x138
 do_init_module+0x64/0x1d0
 load_module+0x1230/0x1560
 SyS_finit_module+0x120/0x130
 el0_svc_naked+0x24/0x28
BUG: sleeping function called from invalid context at mm/page_alloc.c:3775
in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: systemd
3 locks held by systemd/1:
 #0:   (rtnl_mutex){+.+.+.} , at:   rtnl_lock+0x20/0x28
 #1:   (rcu_read_lock_bh){......}, at:   ipv6_add_addr+0x70/0x548 [ipv6]
 #2:   (addrconf_hash_lock){+.....}, at: ipv6_add_addr+0x194/0x548 [ipv6]
irq event stamp: 619543
hardirqs last  enabled at (619541):   __local_bh_enable_ip+0x88/0x138
hardirqs last disabled at (619543):   __slab_alloc.isra.22.constprop.26+0x30/0x90
softirqs last  enabled at (619540):   ipv6_mc_up+0x4c/0x58 [ipv6]
softirqs last disabled at (619542):   ipv6_add_addr+0x70/0x548 [ipv6]
CPU: 3 PID: 1 Comm: systemd Tainted: G        W       4.9.0-rc7-next-20161130-00010-ga0f9af725c5d #218
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Nov 29 2016
Call trace:
 dump_backtrace+0x0/0x260
 show_stack+0x24/0x30
 dump_stack+0xac/0xe8
 ___might_sleep+0x14c/0x1f8
 __alloc_pages_nodemask+0x414/0xef0
 new_slab+0xa4/0x558
 ___slab_alloc.constprop.27+0x2f8/0x378
 __slab_alloc.isra.22.constprop.26+0x4c/0x90
 kmem_cache_alloc+0x388/0x430
 dst_alloc+0x5c/0xb0
 __ip6_dst_alloc+0x3c/0xa0 [ipv6]
 ip6_dst_alloc+0x38/0x108 [ipv6]
 addrconf_dst_alloc+0x4c/0x130 [ipv6]
 ipv6_add_addr+0x274/0x548 [ipv6]
 add_addr+0x4c/0xd8 [ipv6]
 addrconf_notify+0x5c4/0xa98 [ipv6]
 register_netdevice_notifier+0x1e0/0x1e8
 addrconf_init+0xb8/0x270 [ipv6]
 inet6_init+0x180/0x330 [ipv6]
 do_one_initcall+0x44/0x138
 do_init_module+0x64/0x1d0
 load_module+0x1230/0x1560
 SyS_finit_module+0x120/0x130
 el0_svc_naked+0x24/0x28

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web