netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dummy: fix rcu_sched self-detected stalls
@ 2012-06-09 10:59 Eric Dumazet
  2012-06-11  5:48 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2012-06-09 10:59 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

Trying to "modprobe dummy numdummies=30000" triggers :

INFO: rcu_sched self-detected stall on CPU { 8} (t=60000 jiffies)

After this splat, RTNL is locked and reboot is needed.

We must call cond_resched() to avoid this, even holding RTNL.

Also remove the ~32767 limit on number of dummies (PAGE_SIZE*8)

Tested with "modprobe dummy numdummies=128000"
(it took ~12 minutes, because of sysfs)

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/dummy.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 442d91a..004ca81 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -160,12 +160,14 @@ static struct rtnl_link_ops dummy_link_ops __read_mostly = {
 module_param(numdummies, int, 0);
 MODULE_PARM_DESC(numdummies, "Number of dummy pseudo devices");
 
-static int __init dummy_init_one(void)
+static int __init dummy_init_one(int index)
 {
 	struct net_device *dev_dummy;
 	int err;
+	char name[64];
 
-	dev_dummy = alloc_netdev(0, "dummy%d", dummy_setup);
+	sprintf(name, "dummy%d", index);
+	dev_dummy = alloc_netdev(0, name, dummy_setup);
 	if (!dev_dummy)
 		return -ENOMEM;
 
@@ -187,8 +189,10 @@ static int __init dummy_init_module(void)
 	rtnl_lock();
 	err = __rtnl_link_register(&dummy_link_ops);
 
-	for (i = 0; i < numdummies && !err; i++)
-		err = dummy_init_one();
+	for (i = 0; i < numdummies && !err; i++) {
+		err = dummy_init_one(i);
+		cond_resched();
+	}
 	if (err < 0)
 		__rtnl_link_unregister(&dummy_link_ops);
 	rtnl_unlock();

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dummy: fix rcu_sched self-detected stalls
  2012-06-09 10:59 [PATCH] dummy: fix rcu_sched self-detected stalls Eric Dumazet
@ 2012-06-11  5:48 ` David Miller
  2012-06-11  7:11   ` [PATCH v2] " Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2012-06-11  5:48 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 09 Jun 2012 12:59:06 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Trying to "modprobe dummy numdummies=30000" triggers :
> 
> INFO: rcu_sched self-detected stall on CPU { 8} (t=60000 jiffies)
> 
> After this splat, RTNL is locked and reboot is needed.
> 
> We must call cond_resched() to avoid this, even holding RTNL.
> 
> Also remove the ~32767 limit on number of dummies (PAGE_SIZE*8)
> 
> Tested with "modprobe dummy numdummies=128000"
> (it took ~12 minutes, because of sysfs)
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

I'm all for the cond_resched() change, but the name optimization
belongs generically in net/core/dev.c not in specific drivers.

So, please submit this cond_resched() fix first then we can work
on the naming performance issue.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] dummy: fix rcu_sched self-detected stalls
  2012-06-11  5:48 ` David Miller
@ 2012-06-11  7:11   ` Eric Dumazet
  2012-06-11 16:51     ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2012-06-11  7:11 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

Trying to "modprobe dummy numdummies=30000" triggers :

INFO: rcu_sched self-detected stall on CPU { 8} (t=60000 jiffies)

After this splat, RTNL is locked and reboot is needed.

We must call cond_resched() to avoid this, even holding RTNL.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/dummy.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 442d91a..bab0158 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -187,8 +187,10 @@ static int __init dummy_init_module(void)
 	rtnl_lock();
 	err = __rtnl_link_register(&dummy_link_ops);
 
-	for (i = 0; i < numdummies && !err; i++)
+	for (i = 0; i < numdummies && !err; i++) {
 		err = dummy_init_one();
+		cond_resched();
+	}
 	if (err < 0)
 		__rtnl_link_unregister(&dummy_link_ops);
 	rtnl_unlock();

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dummy: fix rcu_sched self-detected stalls
  2012-06-11  7:11   ` [PATCH v2] " Eric Dumazet
@ 2012-06-11 16:51     ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2012-06-11 16:51 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev

On Mon, 11 Jun 2012 09:11:57 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> From: Eric Dumazet <edumazet@google.com>
> 
> Trying to "modprobe dummy numdummies=30000" triggers :
> 
> INFO: rcu_sched self-detected stall on CPU { 8} (t=60000 jiffies)
> 
> After this splat, RTNL is locked and reboot is needed.
> 
> We must call cond_resched() to avoid this, even holding RTNL.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>  drivers/net/dummy.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
> index 442d91a..bab0158 100644
> --- a/drivers/net/dummy.c
> +++ b/drivers/net/dummy.c
> @@ -187,8 +187,10 @@ static int __init dummy_init_module(void)
>  	rtnl_lock();
>  	err = __rtnl_link_register(&dummy_link_ops);
>  
> -	for (i = 0; i < numdummies && !err; i++)
> +	for (i = 0; i < numdummies && !err; i++) {
>  		err = dummy_init_one();
> +		cond_resched();
> +	}
>  	if (err < 0)
>  		__rtnl_link_unregister(&dummy_link_ops);
>  	rtnl_unlock();
> 


Rather than holding lock for the whole loop, why not reacquire
each time to keep from holding off everything els.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-11 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-09 10:59 [PATCH] dummy: fix rcu_sched self-detected stalls Eric Dumazet
2012-06-11  5:48 ` David Miller
2012-06-11  7:11   ` [PATCH v2] " Eric Dumazet
2012-06-11 16:51     ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).