netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] net: cpu offline cause napi stall
@ 2011-06-01 10:33 Frank Blaschka
  2011-06-01 12:13 ` Eric Dumazet
  0 siblings, 1 reply; 11+ messages in thread
From: Frank Blaschka @ 2011-06-01 10:33 UTC (permalink / raw)
  To: davem, eric.dumazet; +Cc: netdev, linux-s390, heiko.carstens

Hi Dave, Eric,

during heavy network load we turn off/on cpus.
Sometimes this causes a stall on the network device.
Digging into the dump I found out following:

napi is scheduled but does not run. From the I/O buffers
and the napi state I see napi/rx_softirq processing has stopped
because the budget was reached. napi stays in the
softnet_data poll_list and the rx_softirq was raised again.

I assume at this time the cpu offline comes in.
the rx softirq is raised/moved to another cpu but napi stays in the poll_list
of the softnet_data of the now offline cpu.

reviewing dev_cpu_callback (net/core/dev.c) I did not find the poll_list
is transfered to the new cpu. Do you think this could cause the stall or
did I miss something?

Thx for your help.

Frank


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

* Re: [BUG] net: cpu offline cause napi stall
  2011-06-01 10:33 [BUG] net: cpu offline cause napi stall Frank Blaschka
@ 2011-06-01 12:13 ` Eric Dumazet
  2011-06-01 16:36   ` Heiko Carstens
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Dumazet @ 2011-06-01 12:13 UTC (permalink / raw)
  To: Frank Blaschka; +Cc: davem, netdev, linux-s390, heiko.carstens

Le mercredi 01 juin 2011 à 12:33 +0200, Frank Blaschka a écrit :
> Hi Dave, Eric,
> 
> during heavy network load we turn off/on cpus.
> Sometimes this causes a stall on the network device.
> Digging into the dump I found out following:
> 
> napi is scheduled but does not run. From the I/O buffers
> and the napi state I see napi/rx_softirq processing has stopped
> because the budget was reached. napi stays in the
> softnet_data poll_list and the rx_softirq was raised again.
> 
> I assume at this time the cpu offline comes in.
> the rx softirq is raised/moved to another cpu but napi stays in the poll_list
> of the softnet_data of the now offline cpu.
> 
> reviewing dev_cpu_callback (net/core/dev.c) I did not find the poll_list
> is transfered to the new cpu. Do you think this could cause the stall or
> did I miss something?
> 
> Thx for your help.

Hi Frank

I believe you are right, I cant see where the poll_list transfert from
dead cpu to online cpu is done.

Do you want to prepare a patch ?

Thanks !




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

* Re: [BUG] net: cpu offline cause napi stall
  2011-06-01 12:13 ` Eric Dumazet
@ 2011-06-01 16:36   ` Heiko Carstens
  2011-06-01 16:55     ` Eric Dumazet
  0 siblings, 1 reply; 11+ messages in thread
From: Heiko Carstens @ 2011-06-01 16:36 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Frank Blaschka, davem, netdev, linux-s390

On Wed, Jun 01, 2011 at 02:13:19PM +0200, Eric Dumazet wrote:
> Le mercredi 01 juin 2011 à 12:33 +0200, Frank Blaschka a écrit :
> > Hi Dave, Eric,
> > 
> > during heavy network load we turn off/on cpus.
> > Sometimes this causes a stall on the network device.
> > Digging into the dump I found out following:
> > 
> > napi is scheduled but does not run. From the I/O buffers
> > and the napi state I see napi/rx_softirq processing has stopped
> > because the budget was reached. napi stays in the
> > softnet_data poll_list and the rx_softirq was raised again.
> > 
> > I assume at this time the cpu offline comes in.
> > the rx softirq is raised/moved to another cpu but napi stays in the poll_list
> > of the softnet_data of the now offline cpu.
> > 
> > reviewing dev_cpu_callback (net/core/dev.c) I did not find the poll_list
> > is transfered to the new cpu. Do you think this could cause the stall or
> > did I miss something?
> > 
> > Thx for your help.
> 
> Hi Frank
> 
> I believe you are right, I cant see where the poll_list transfert from
> dead cpu to online cpu is done.
> 
> Do you want to prepare a patch ?

Frank will be offline until next week. I assume the patch below would fix
the problem, however its untested. I doubt we can verify that it really
fixes the problem also until next week (public holiday tomorrow).

diff --git a/net/core/dev.c b/net/core/dev.c
index 6561021..6d6a7cf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5981,6 +5981,8 @@ static int dev_cpu_callback(struct notifier_block *nfb,
 		oldsd->output_queue = NULL;
 		oldsd->output_queue_tailp = &oldsd->output_queue;
 	}
+	/* Append NAPI poll list from offline CPU. */
+	list_splice_init(&oldsd->poll_list, &sd->poll_list);
 
 	raise_softirq_irqoff(NET_TX_SOFTIRQ);
 	local_irq_enable();

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

* Re: [BUG] net: cpu offline cause napi stall
  2011-06-01 16:36   ` Heiko Carstens
@ 2011-06-01 16:55     ` Eric Dumazet
  2011-06-01 18:12       ` Heiko Carstens
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Dumazet @ 2011-06-01 16:55 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Frank Blaschka, davem, netdev, linux-s390

Le mercredi 01 juin 2011 à 18:36 +0200, Heiko Carstens a écrit :
> On Wed, Jun 01, 2011 at 02:13:19PM +0200, Eric Dumazet wrote:
> > Le mercredi 01 juin 2011 à 12:33 +0200, Frank Blaschka a écrit :
> > > Hi Dave, Eric,
> > > 
> > > during heavy network load we turn off/on cpus.
> > > Sometimes this causes a stall on the network device.
> > > Digging into the dump I found out following:
> > > 
> > > napi is scheduled but does not run. From the I/O buffers
> > > and the napi state I see napi/rx_softirq processing has stopped
> > > because the budget was reached. napi stays in the
> > > softnet_data poll_list and the rx_softirq was raised again.
> > > 
> > > I assume at this time the cpu offline comes in.
> > > the rx softirq is raised/moved to another cpu but napi stays in the poll_list
> > > of the softnet_data of the now offline cpu.
> > > 
> > > reviewing dev_cpu_callback (net/core/dev.c) I did not find the poll_list
> > > is transfered to the new cpu. Do you think this could cause the stall or
> > > did I miss something?
> > > 
> > > Thx for your help.
> > 
> > Hi Frank
> > 
> > I believe you are right, I cant see where the poll_list transfert from
> > dead cpu to online cpu is done.
> > 
> > Do you want to prepare a patch ?
> 
> Frank will be offline until next week. I assume the patch below would fix
> the problem, however its untested. I doubt we can verify that it really
> fixes the problem also until next week (public holiday tomorrow).
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 6561021..6d6a7cf 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5981,6 +5981,8 @@ static int dev_cpu_callback(struct notifier_block *nfb,
>  		oldsd->output_queue = NULL;
>  		oldsd->output_queue_tailp = &oldsd->output_queue;
>  	}
> +	/* Append NAPI poll list from offline CPU. */
> +	list_splice_init(&oldsd->poll_list, &sd->poll_list);
>  
>  	raise_softirq_irqoff(NET_TX_SOFTIRQ);
>  	local_irq_enable();

Same here, I'll be offline for the next 4 days ;)

Please make sure we raise NET_RX_SOFTIRQ on new cpu if necessary.




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

* Re: [BUG] net: cpu offline cause napi stall
  2011-06-01 16:55     ` Eric Dumazet
@ 2011-06-01 18:12       ` Heiko Carstens
  2011-06-01 20:03         ` Eric Dumazet
  0 siblings, 1 reply; 11+ messages in thread
From: Heiko Carstens @ 2011-06-01 18:12 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Frank Blaschka, davem, netdev, linux-s390

On Wed, Jun 01, 2011 at 06:55:21PM +0200, Eric Dumazet wrote:
> > +	/* Append NAPI poll list from offline CPU. */
> > +	list_splice_init(&oldsd->poll_list, &sd->poll_list);
> >  
> >  	raise_softirq_irqoff(NET_TX_SOFTIRQ);
> >  	local_irq_enable();
> 
> Please make sure we raise NET_RX_SOFTIRQ on new cpu if necessary.

Well, see two lines below the list_splice_init() call ;)

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

* Re: [BUG] net: cpu offline cause napi stall
  2011-06-01 18:12       ` Heiko Carstens
@ 2011-06-01 20:03         ` Eric Dumazet
  2011-06-01 20:42           ` Heiko Carstens
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Dumazet @ 2011-06-01 20:03 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: Frank Blaschka, davem, netdev, linux-s390

Le mercredi 01 juin 2011 à 20:12 +0200, Heiko Carstens a écrit :
> On Wed, Jun 01, 2011 at 06:55:21PM +0200, Eric Dumazet wrote:
> > > +	/* Append NAPI poll list from offline CPU. */
> > > +	list_splice_init(&oldsd->poll_list, &sd->poll_list);
> > >  
> > >  	raise_softirq_irqoff(NET_TX_SOFTIRQ);
> > >  	local_irq_enable();
> > 
> > Please make sure we raise NET_RX_SOFTIRQ on new cpu if necessary.
> 
> Well, see two lines below the list_splice_init() call ;)

I see nothing... NET_TX_SOFTIRQ and NET_RX_SOFTIRQ are not the same 



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

* Re: [BUG] net: cpu offline cause napi stall
  2011-06-01 20:03         ` Eric Dumazet
@ 2011-06-01 20:42           ` Heiko Carstens
  2011-06-06 21:50             ` David Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Heiko Carstens @ 2011-06-01 20:42 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Frank Blaschka, davem, netdev, linux-s390

On Wed, Jun 01, 2011 at 10:03:12PM +0200, Eric Dumazet wrote:
> Le mercredi 01 juin 2011 à 20:12 +0200, Heiko Carstens a écrit :
> > On Wed, Jun 01, 2011 at 06:55:21PM +0200, Eric Dumazet wrote:
> > > > +	/* Append NAPI poll list from offline CPU. */
> > > > +	list_splice_init(&oldsd->poll_list, &sd->poll_list);
> > > >  
> > > >  	raise_softirq_irqoff(NET_TX_SOFTIRQ);
> > > >  	local_irq_enable();
> > > 
> > > Please make sure we raise NET_RX_SOFTIRQ on new cpu if necessary.
> > 
> > Well, see two lines below the list_splice_init() call ;)
> 
> I see nothing... NET_TX_SOFTIRQ and NET_RX_SOFTIRQ are not the same 

Indeed. I must be blind.

diff --git a/net/core/dev.c b/net/core/dev.c
index 6561021..6189dac 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5981,6 +5981,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
 		oldsd->output_queue = NULL;
 		oldsd->output_queue_tailp = &oldsd->output_queue;
 	}
+	/* Append NAPI poll list from offline CPU. */
+	if (!list_empty(&oldsd->poll_list)) {
+		list_splice_init(&oldsd->poll_list, &sd->poll_list);
+		raise_softirq_irqoff(NET_RX_SOFTIRQ);
+	}
 
 	raise_softirq_irqoff(NET_TX_SOFTIRQ);
 	local_irq_enable();

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

* Re: [BUG] net: cpu offline cause napi stall
  2011-06-01 20:42           ` Heiko Carstens
@ 2011-06-06 21:50             ` David Miller
  2011-06-07  6:50               ` [PATCH] " Eric Dumazet
  0 siblings, 1 reply; 11+ messages in thread
From: David Miller @ 2011-06-06 21:50 UTC (permalink / raw)
  To: heiko.carstens; +Cc: eric.dumazet, blaschka, netdev, linux-s390

From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Wed, 1 Jun 2011 22:42:34 +0200

> On Wed, Jun 01, 2011 at 10:03:12PM +0200, Eric Dumazet wrote:
>> Le mercredi 01 juin 2011 à 20:12 +0200, Heiko Carstens a écrit :
>> > On Wed, Jun 01, 2011 at 06:55:21PM +0200, Eric Dumazet wrote:
>> > > > +	/* Append NAPI poll list from offline CPU. */
>> > > > +	list_splice_init(&oldsd->poll_list, &sd->poll_list);
>> > > >  
>> > > >  	raise_softirq_irqoff(NET_TX_SOFTIRQ);
>> > > >  	local_irq_enable();
>> > > 
>> > > Please make sure we raise NET_RX_SOFTIRQ on new cpu if necessary.
>> > 
>> > Well, see two lines below the list_splice_init() call ;)
>> 
>> I see nothing... NET_TX_SOFTIRQ and NET_RX_SOFTIRQ are not the same 
> 
> Indeed. I must be blind.

Can I get a final version of this patch with proper commit log message,
signoffs, etc.?

Thanks!

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

* [PATCH] net: cpu offline cause napi stall
  2011-06-06 21:50             ` David Miller
@ 2011-06-07  6:50               ` Eric Dumazet
  2011-06-07  7:09                 ` Eric Dumazet
  2011-06-07  8:01                 ` David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Eric Dumazet @ 2011-06-07  6:50 UTC (permalink / raw)
  To: David Miller; +Cc: heiko.carstens, blaschka, netdev, linux-s390

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Frank Blaschka reported :
<quote>
  During heavy network load we turn off/on cpus.
  Sometimes this causes a stall on the network device.
  Digging into the dump I found out following:

  napi is scheduled but does not run. From the I/O buffers
  and the napi state I see napi/rx_softirq processing has stopped
  because the budget was reached. napi stays in the
  softnet_data poll_list and the rx_softirq was raised again.

  I assume at this time the cpu offline comes in,
  the rx softirq is raised/moved to another cpu but napi stays in the
  poll_list of the softnet_data of the now offline cpu.

  Reviewing dev_cpu_callback (net/core/dev.c) I did not find the
  poll_list is transfered to the new cpu.
</quote>

This patch is a straightforward implementation of Frank suggestion :

Transfert poll_list and trigger NET_RX_SOFTIRQ on new cpu.

Reported-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Eric Dumazet <eric.dumazet@gmail.com>
---
While doing my tests on bnx2x adapter, I found patch was working ok,
but /proc/interrupts still increment interrupt count on my offlined
cpu... go figure...

 net/core/dev.c |    5 +++++
 1 files changed, 5 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 9393078..095909c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6178,6 +6178,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
 		oldsd->output_queue = NULL;
 		oldsd->output_queue_tailp = &oldsd->output_queue;
 	}
+	/* Append NAPI poll list from offline CPU. */
+	if (!list_empty(&oldsd->poll_list)) {
+		list_splice_init(&oldsd->poll_list, &sd->poll_list);
+		raise_softirq_irqoff(NET_RX_SOFTIRQ);
+	}
 
 	raise_softirq_irqoff(NET_TX_SOFTIRQ);
 	local_irq_enable();



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

* Re: [PATCH] net: cpu offline cause napi stall
  2011-06-07  6:50               ` [PATCH] " Eric Dumazet
@ 2011-06-07  7:09                 ` Eric Dumazet
  2011-06-07  8:01                 ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: Eric Dumazet @ 2011-06-07  7:09 UTC (permalink / raw)
  To: David Miller; +Cc: heiko.carstens, blaschka, netdev, linux-s390

Le mardi 07 juin 2011 à 08:50 +0200, Eric Dumazet a écrit :
> While doing my tests on bnx2x adapter, I found patch was working ok,
> but /proc/interrupts still increment interrupt count on my offlined
> cpu... go figure...

Oh well, "cat /proc/interrupts" skips offlined cpu, of course, thats a
false alarm.

I was doing "grep eth1 /proc/interrupts" so didnt catch this.




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

* Re: [PATCH] net: cpu offline cause napi stall
  2011-06-07  6:50               ` [PATCH] " Eric Dumazet
  2011-06-07  7:09                 ` Eric Dumazet
@ 2011-06-07  8:01                 ` David Miller
  1 sibling, 0 replies; 11+ messages in thread
From: David Miller @ 2011-06-07  8:01 UTC (permalink / raw)
  To: eric.dumazet; +Cc: heiko.carstens, blaschka, netdev, linux-s390

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 07 Jun 2011 08:50:03 +0200

> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> 
> Frank Blaschka reported :
> <quote>
>   During heavy network load we turn off/on cpus.
>   Sometimes this causes a stall on the network device.
>   Digging into the dump I found out following:
> 
>   napi is scheduled but does not run. From the I/O buffers
>   and the napi state I see napi/rx_softirq processing has stopped
>   because the budget was reached. napi stays in the
>   softnet_data poll_list and the rx_softirq was raised again.
> 
>   I assume at this time the cpu offline comes in,
>   the rx softirq is raised/moved to another cpu but napi stays in the
>   poll_list of the softnet_data of the now offline cpu.
> 
>   Reviewing dev_cpu_callback (net/core/dev.c) I did not find the
>   poll_list is transfered to the new cpu.
> </quote>
> 
> This patch is a straightforward implementation of Frank suggestion :
> 
> Transfert poll_list and trigger NET_RX_SOFTIRQ on new cpu.
> 
> Reported-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Tested-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks everyone.

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

end of thread, other threads:[~2011-06-07  8:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-01 10:33 [BUG] net: cpu offline cause napi stall Frank Blaschka
2011-06-01 12:13 ` Eric Dumazet
2011-06-01 16:36   ` Heiko Carstens
2011-06-01 16:55     ` Eric Dumazet
2011-06-01 18:12       ` Heiko Carstens
2011-06-01 20:03         ` Eric Dumazet
2011-06-01 20:42           ` Heiko Carstens
2011-06-06 21:50             ` David Miller
2011-06-07  6:50               ` [PATCH] " Eric Dumazet
2011-06-07  7:09                 ` Eric Dumazet
2011-06-07  8:01                 ` David Miller

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).