All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	linux-nfs <linux-nfs@vger.kernel.org>,
	"trond.myklebust" <trond.myklebust@primarydata.com>,
	netdev <netdev@vger.kernel.org>
Subject: Re: RCU stalls when running out of memory on 3.14-rc4 w/ NFS and kernel threads priorities changed
Date: Wed, 5 Mar 2014 16:42:55 -0800	[thread overview]
Message-ID: <CAGVrzcYBtR14-XkPjDiC+JnQ422d8T8j+3Qg6b5OUQLC7eRgXg@mail.gmail.com> (raw)
In-Reply-To: <20140305053440.GD3334@linux.vnet.ibm.com>

2014-03-04 21:34 GMT-08:00 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
> On Tue, Mar 04, 2014 at 07:55:03PM -0800, Florian Fainelli wrote:
>> 2014-03-04 17:43 GMT-08:00 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
>> > On Tue, Mar 04, 2014 at 05:16:27PM -0800, Florian Fainelli wrote:
>> >> 2014-03-04 17:03 GMT-08:00 Florian Fainelli <f.fainelli@gmail.com>:
>> >> > 2014-03-04 16:48 GMT-08:00 Eric Dumazet <eric.dumazet@gmail.com>:
>> >> >> On Tue, 2014-03-04 at 15:55 -0800, Florian Fainelli wrote:
>> >> >>> Hi all,
>> >> >>>
>> >> >>> I am seeing the following RCU stalls messages appearing on an ARMv7
>> >> >>> 4xCPUs system running 3.14-rc4:
>> >> >>>
>> >> >>> [   42.974327] INFO: rcu_sched detected stalls on CPUs/tasks:
>> >> >>> [   42.979839]  (detected by 0, t=2102 jiffies, g=4294967082,
>> >> >>> c=4294967081, q=516)
>> >> >>> [   42.987169] INFO: Stall ended before state dump start
>> >> >>>
>> >> >>> this is happening under the following conditions:
>> >> >>>
>> >> >>> - the attached bumper.c binary alters various kernel thread priorities
>> >> >>> based on the contents of bumpup.cfg and
>> >> >>> - malloc_crazy is running from a NFS share
>> >> >>> - malloc_crazy.c is running in a loop allocating chunks of memory but
>> >> >>> never freeing it
>> >> >>>
>> >> >>> when the priorities are altered, instead of getting the OOM killer to
>> >> >>> be invoked, the RCU stalls are happening. Taking NFS out of the
>> >> >>> equation does not allow me to reproduce the problem even with the
>> >> >>> priorities altered.
>> >> >>>
>> >> >>> This "problem" seems to have been there for quite a while now since I
>> >> >>> was able to get 3.8.13 to trigger that bug as well, with a slightly
>> >> >>> more detailed RCU debugging trace which points the finger at kswapd0.
>> >> >>>
>> >> >>> You should be able to get that reproduced under QEMU with the
>> >> >>> Versatile Express platform emulating a Cortex A15 CPU and the attached
>> >> >>> files.
>> >> >>>
>> >> >>> Any help or suggestions would be greatly appreciated. Thanks!
>> >> >>
>> >> >> Do you have a more complete trace, including stack traces ?
>> >> >
>> >> > Attatched is what I get out of SysRq-t, which is the only thing I have
>> >> > (note that the kernel is built with CONFIG_RCU_CPU_STALL_INFO=y):
>> >>
>> >> QEMU for Versatile Express w/ 2 CPUs yields something slightly
>> >> different than the real HW platform this is happening with, but it
>> >> does produce the RCU stall anyway:
>> >>
>> >> [  125.762946] BUG: soft lockup - CPU#1 stuck for 53s! [malloc_crazy:91]
>> >
>> > This soft-lockup condition can result in RCU CPU stall warnings.  Fix
>> > the problem causing the soft lockup, and I bet that your RCU CPU stall
>> > warnings go away.
>>
>> I definitively agree, which is why I was asking for help, as I think
>> the kernel thread priority change is what is causing the soft lockup
>> to appear, but nothing obvious jumps to mind when looking at the
>> trace.
>
> Is your hardware able to make the malloc_crazy CPU periodically dump
> its stack, perhaps in response to an NMI?  If not, another approach is
> to use ftrace -- though this will require a very high-priority task to
> turn tracing on and off reasonably quickly, unless you happen to have
> a very large amount of storage to hold the trace.
>
> What happens if you malloc() less intensively?  Does that avoid this
> problem?

It does yes, putting some arbitrary delays between the malloc() calls
does definitively help.

>The reason I ask is that you mentioned that avoiding NFS helped,
> and it is possible that NFS is increasing storage-access latencies and
> thus triggering another problem.  It is quite possible that slowing
> down the malloc()s would also help, and might allow you to observe what
> is happening more easily than when the system is driven fully to the
> lockup condition.
>
> Finally, what are you trying to achieve with this workload?  Does your
> production workload behave in this way?  Or is this an experimental
> investigation of some sort?

This is an experimental investigation, part of the problem being that
there were some expectations that altering priority of essential
kernel threads would "just work".

It seemed to me like even if we moved kthreadd to SCHED_RR, with
priority 2 (as shown by /proc/*/sched), we should still be at a more
favorable scheduling class than 'rcu_bh' and 'rcu_sched' which are on
SCHED_NORMAL. Interestingly, the issue only appears with 1 or 2 CPUs
online, as soon as the 4 are online I am no longer able to reproduce
it...
-- 
Florian

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Paul McKenney
	<paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: Eric Dumazet
	<eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-mm <linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	linux-nfs <linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"trond.myklebust"
	<trond.myklebust-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>,
	netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: RCU stalls when running out of memory on 3.14-rc4 w/ NFS and kernel threads priorities changed
Date: Wed, 5 Mar 2014 16:42:55 -0800	[thread overview]
Message-ID: <CAGVrzcYBtR14-XkPjDiC+JnQ422d8T8j+3Qg6b5OUQLC7eRgXg@mail.gmail.com> (raw)
In-Reply-To: <20140305053440.GD3334-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

2014-03-04 21:34 GMT-08:00 Paul E. McKenney <paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>:
> On Tue, Mar 04, 2014 at 07:55:03PM -0800, Florian Fainelli wrote:
>> 2014-03-04 17:43 GMT-08:00 Paul E. McKenney <paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>:
>> > On Tue, Mar 04, 2014 at 05:16:27PM -0800, Florian Fainelli wrote:
>> >> 2014-03-04 17:03 GMT-08:00 Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>> >> > 2014-03-04 16:48 GMT-08:00 Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>> >> >> On Tue, 2014-03-04 at 15:55 -0800, Florian Fainelli wrote:
>> >> >>> Hi all,
>> >> >>>
>> >> >>> I am seeing the following RCU stalls messages appearing on an ARMv7
>> >> >>> 4xCPUs system running 3.14-rc4:
>> >> >>>
>> >> >>> [   42.974327] INFO: rcu_sched detected stalls on CPUs/tasks:
>> >> >>> [   42.979839]  (detected by 0, t=2102 jiffies, g=4294967082,
>> >> >>> c=4294967081, q=516)
>> >> >>> [   42.987169] INFO: Stall ended before state dump start
>> >> >>>
>> >> >>> this is happening under the following conditions:
>> >> >>>
>> >> >>> - the attached bumper.c binary alters various kernel thread priorities
>> >> >>> based on the contents of bumpup.cfg and
>> >> >>> - malloc_crazy is running from a NFS share
>> >> >>> - malloc_crazy.c is running in a loop allocating chunks of memory but
>> >> >>> never freeing it
>> >> >>>
>> >> >>> when the priorities are altered, instead of getting the OOM killer to
>> >> >>> be invoked, the RCU stalls are happening. Taking NFS out of the
>> >> >>> equation does not allow me to reproduce the problem even with the
>> >> >>> priorities altered.
>> >> >>>
>> >> >>> This "problem" seems to have been there for quite a while now since I
>> >> >>> was able to get 3.8.13 to trigger that bug as well, with a slightly
>> >> >>> more detailed RCU debugging trace which points the finger at kswapd0.
>> >> >>>
>> >> >>> You should be able to get that reproduced under QEMU with the
>> >> >>> Versatile Express platform emulating a Cortex A15 CPU and the attached
>> >> >>> files.
>> >> >>>
>> >> >>> Any help or suggestions would be greatly appreciated. Thanks!
>> >> >>
>> >> >> Do you have a more complete trace, including stack traces ?
>> >> >
>> >> > Attatched is what I get out of SysRq-t, which is the only thing I have
>> >> > (note that the kernel is built with CONFIG_RCU_CPU_STALL_INFO=y):
>> >>
>> >> QEMU for Versatile Express w/ 2 CPUs yields something slightly
>> >> different than the real HW platform this is happening with, but it
>> >> does produce the RCU stall anyway:
>> >>
>> >> [  125.762946] BUG: soft lockup - CPU#1 stuck for 53s! [malloc_crazy:91]
>> >
>> > This soft-lockup condition can result in RCU CPU stall warnings.  Fix
>> > the problem causing the soft lockup, and I bet that your RCU CPU stall
>> > warnings go away.
>>
>> I definitively agree, which is why I was asking for help, as I think
>> the kernel thread priority change is what is causing the soft lockup
>> to appear, but nothing obvious jumps to mind when looking at the
>> trace.
>
> Is your hardware able to make the malloc_crazy CPU periodically dump
> its stack, perhaps in response to an NMI?  If not, another approach is
> to use ftrace -- though this will require a very high-priority task to
> turn tracing on and off reasonably quickly, unless you happen to have
> a very large amount of storage to hold the trace.
>
> What happens if you malloc() less intensively?  Does that avoid this
> problem?

It does yes, putting some arbitrary delays between the malloc() calls
does definitively help.

>The reason I ask is that you mentioned that avoiding NFS helped,
> and it is possible that NFS is increasing storage-access latencies and
> thus triggering another problem.  It is quite possible that slowing
> down the malloc()s would also help, and might allow you to observe what
> is happening more easily than when the system is driven fully to the
> lockup condition.
>
> Finally, what are you trying to achieve with this workload?  Does your
> production workload behave in this way?  Or is this an experimental
> investigation of some sort?

This is an experimental investigation, part of the problem being that
there were some expectations that altering priority of essential
kernel threads would "just work".

It seemed to me like even if we moved kthreadd to SCHED_RR, with
priority 2 (as shown by /proc/*/sched), we should still be at a more
favorable scheduling class than 'rcu_bh' and 'rcu_sched' which are on
SCHED_NORMAL. Interestingly, the issue only appears with 1 or 2 CPUs
online, as soon as the 4 are online I am no longer able to reproduce
it...
-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	linux-nfs <linux-nfs@vger.kernel.org>,
	"trond.myklebust" <trond.myklebust@primarydata.com>,
	netdev <netdev@vger.kernel.org>
Subject: Re: RCU stalls when running out of memory on 3.14-rc4 w/ NFS and kernel threads priorities changed
Date: Wed, 5 Mar 2014 16:42:55 -0800	[thread overview]
Message-ID: <CAGVrzcYBtR14-XkPjDiC+JnQ422d8T8j+3Qg6b5OUQLC7eRgXg@mail.gmail.com> (raw)
In-Reply-To: <20140305053440.GD3334@linux.vnet.ibm.com>

2014-03-04 21:34 GMT-08:00 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
> On Tue, Mar 04, 2014 at 07:55:03PM -0800, Florian Fainelli wrote:
>> 2014-03-04 17:43 GMT-08:00 Paul E. McKenney <paulmck@linux.vnet.ibm.com>:
>> > On Tue, Mar 04, 2014 at 05:16:27PM -0800, Florian Fainelli wrote:
>> >> 2014-03-04 17:03 GMT-08:00 Florian Fainelli <f.fainelli@gmail.com>:
>> >> > 2014-03-04 16:48 GMT-08:00 Eric Dumazet <eric.dumazet@gmail.com>:
>> >> >> On Tue, 2014-03-04 at 15:55 -0800, Florian Fainelli wrote:
>> >> >>> Hi all,
>> >> >>>
>> >> >>> I am seeing the following RCU stalls messages appearing on an ARMv7
>> >> >>> 4xCPUs system running 3.14-rc4:
>> >> >>>
>> >> >>> [   42.974327] INFO: rcu_sched detected stalls on CPUs/tasks:
>> >> >>> [   42.979839]  (detected by 0, t=2102 jiffies, g=4294967082,
>> >> >>> c=4294967081, q=516)
>> >> >>> [   42.987169] INFO: Stall ended before state dump start
>> >> >>>
>> >> >>> this is happening under the following conditions:
>> >> >>>
>> >> >>> - the attached bumper.c binary alters various kernel thread priorities
>> >> >>> based on the contents of bumpup.cfg and
>> >> >>> - malloc_crazy is running from a NFS share
>> >> >>> - malloc_crazy.c is running in a loop allocating chunks of memory but
>> >> >>> never freeing it
>> >> >>>
>> >> >>> when the priorities are altered, instead of getting the OOM killer to
>> >> >>> be invoked, the RCU stalls are happening. Taking NFS out of the
>> >> >>> equation does not allow me to reproduce the problem even with the
>> >> >>> priorities altered.
>> >> >>>
>> >> >>> This "problem" seems to have been there for quite a while now since I
>> >> >>> was able to get 3.8.13 to trigger that bug as well, with a slightly
>> >> >>> more detailed RCU debugging trace which points the finger at kswapd0.
>> >> >>>
>> >> >>> You should be able to get that reproduced under QEMU with the
>> >> >>> Versatile Express platform emulating a Cortex A15 CPU and the attached
>> >> >>> files.
>> >> >>>
>> >> >>> Any help or suggestions would be greatly appreciated. Thanks!
>> >> >>
>> >> >> Do you have a more complete trace, including stack traces ?
>> >> >
>> >> > Attatched is what I get out of SysRq-t, which is the only thing I have
>> >> > (note that the kernel is built with CONFIG_RCU_CPU_STALL_INFO=y):
>> >>
>> >> QEMU for Versatile Express w/ 2 CPUs yields something slightly
>> >> different than the real HW platform this is happening with, but it
>> >> does produce the RCU stall anyway:
>> >>
>> >> [  125.762946] BUG: soft lockup - CPU#1 stuck for 53s! [malloc_crazy:91]
>> >
>> > This soft-lockup condition can result in RCU CPU stall warnings.  Fix
>> > the problem causing the soft lockup, and I bet that your RCU CPU stall
>> > warnings go away.
>>
>> I definitively agree, which is why I was asking for help, as I think
>> the kernel thread priority change is what is causing the soft lockup
>> to appear, but nothing obvious jumps to mind when looking at the
>> trace.
>
> Is your hardware able to make the malloc_crazy CPU periodically dump
> its stack, perhaps in response to an NMI?  If not, another approach is
> to use ftrace -- though this will require a very high-priority task to
> turn tracing on and off reasonably quickly, unless you happen to have
> a very large amount of storage to hold the trace.
>
> What happens if you malloc() less intensively?  Does that avoid this
> problem?

It does yes, putting some arbitrary delays between the malloc() calls
does definitively help.

>The reason I ask is that you mentioned that avoiding NFS helped,
> and it is possible that NFS is increasing storage-access latencies and
> thus triggering another problem.  It is quite possible that slowing
> down the malloc()s would also help, and might allow you to observe what
> is happening more easily than when the system is driven fully to the
> lockup condition.
>
> Finally, what are you trying to achieve with this workload?  Does your
> production workload behave in this way?  Or is this an experimental
> investigation of some sort?

This is an experimental investigation, part of the problem being that
there were some expectations that altering priority of essential
kernel threads would "just work".

It seemed to me like even if we moved kthreadd to SCHED_RR, with
priority 2 (as shown by /proc/*/sched), we should still be at a more
favorable scheduling class than 'rcu_bh' and 'rcu_sched' which are on
SCHED_NORMAL. Interestingly, the issue only appears with 1 or 2 CPUs
online, as soon as the 4 are online I am no longer able to reproduce
it...
-- 
Florian

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2014-03-06  0:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 23:55 RCU stalls when running out of memory on 3.14-rc4 w/ NFS and kernel threads priorities changed Florian Fainelli
2014-03-05  0:48 ` Eric Dumazet
2014-03-05  0:48   ` Eric Dumazet
2014-03-05  0:48   ` Eric Dumazet
2014-03-05  1:03   ` Florian Fainelli
2014-03-05  1:16     ` Florian Fainelli
2014-03-05  1:16       ` Florian Fainelli
2014-03-05  1:43       ` Paul E. McKenney
2014-03-05  1:43         ` Paul E. McKenney
2014-03-05  3:55         ` Florian Fainelli
2014-03-05  3:55           ` Florian Fainelli
2014-03-05  5:34           ` Paul E. McKenney
2014-03-05  5:34             ` Paul E. McKenney
2014-03-06  0:42             ` Florian Fainelli [this message]
2014-03-06  0:42               ` Florian Fainelli
2014-03-06  0:42               ` Florian Fainelli
2014-03-06  1:42               ` Paul E. McKenney
2014-03-06  1:42                 ` Paul E. McKenney
2014-03-05  1:41     ` Paul E. McKenney
2014-03-05  1:41       ` Paul E. McKenney
2014-03-05  1:43       ` Florian Fainelli
2014-03-05  1:43         ` Florian Fainelli

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=CAGVrzcYBtR14-XkPjDiC+JnQ422d8T8j+3Qg6b5OUQLC7eRgXg@mail.gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=trond.myklebust@primarydata.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.