public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] netpoll: WARN_ONCE for start_xmit returns with interrupts enabled
  2009-08-19 10:43 [PATCH] netpoll: WARN_ONCE for start_xmit returns with interrupts enabled DDD
@ 2009-08-19 10:43 ` Matt Mackall
  2009-08-20 10:44   ` DDD
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Mackall @ 2009-08-19 10:43 UTC (permalink / raw)
  To: DDD; +Cc: linux-kernel, Ingo Molnar

On Wed, 2009-08-19 at 18:43 +0800, DDD wrote:
> The NETPOLL API requires that interrupts remain disabled in
> netpoll_send_skb().
> 
> Add a WARN_ONCE when ndo_start_xmit returns with interrupts enabled
> in netpoll_send_skb().
> 
> Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
> ---
>  net/core/netpoll.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index df30feb..d38103f 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -319,6 +319,12 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
>  
>  			udelay(USEC_PER_POLL);
>  		}
> +
> +		WARN_ONCE(!irqs_disabled(),
> +			KERN_WARNING "netpoll_send_skb(): [net driver %s]"
> +			"ndo_start_xmit() shouldn't return with interrupts"
> +			"enabled!", dev->name);

Hmm, perhaps:

"netpoll_send_skb(): %s enabled interrupts in poll (%pF)\n",
dev->name, ops->ndo_start_xmit

That'll give us a real function name and maybe even a module name.

-- 
http://selenic.com : development and support for Mercurial and Linux



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

* [PATCH] netpoll: WARN_ONCE for start_xmit returns with interrupts enabled
@ 2009-08-19 10:43 DDD
  2009-08-19 10:43 ` Matt Mackall
  0 siblings, 1 reply; 3+ messages in thread
From: DDD @ 2009-08-19 10:43 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel, Ingo Molnar

The NETPOLL API requires that interrupts remain disabled in
netpoll_send_skb().

Add a WARN_ONCE when ndo_start_xmit returns with interrupts enabled
in netpoll_send_skb().

Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
---
 net/core/netpoll.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index df30feb..d38103f 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -319,6 +319,12 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
 
 			udelay(USEC_PER_POLL);
 		}
+
+		WARN_ONCE(!irqs_disabled(),
+			KERN_WARNING "netpoll_send_skb(): [net driver %s]"
+			"ndo_start_xmit() shouldn't return with interrupts"
+			"enabled!", dev->name);
+
 		local_irq_restore(flags);
 	}
 
-- 
1.6.0.4



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

* Re: [PATCH] netpoll: WARN_ONCE for start_xmit returns with interrupts enabled
  2009-08-19 10:43 ` Matt Mackall
@ 2009-08-20 10:44   ` DDD
  0 siblings, 0 replies; 3+ messages in thread
From: DDD @ 2009-08-20 10:44 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel, Ingo Molnar, David Miller, netdev

On Wed, 2009-08-19 at 05:43 -0500, Matt Mackall wrote: 
> On Wed, 2009-08-19 at 18:43 +0800, DDD wrote:
> > The NETPOLL API requires that interrupts remain disabled in
> > netpoll_send_skb().
> > 
> > Add a WARN_ONCE when ndo_start_xmit returns with interrupts enabled
> > in netpoll_send_skb().
> > 
> > Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
> > ---
> >  net/core/netpoll.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> > 
> > diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> > index df30feb..d38103f 100644
> > --- a/net/core/netpoll.c
> > +++ b/net/core/netpoll.c
> > @@ -319,6 +319,12 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
> >  
> >  			udelay(USEC_PER_POLL);
> >  		}
> > +
> > +		WARN_ONCE(!irqs_disabled(),
> > +			KERN_WARNING "netpoll_send_skb(): [net driver %s]"
> > +			"ndo_start_xmit() shouldn't return with interrupts"
> > +			"enabled!", dev->name);
> 
> Hmm, perhaps:
> 
> "netpoll_send_skb(): %s enabled interrupts in poll (%pF)\n",
> dev->name, ops->ndo_start_xmit
> 
> That'll give us a real function name and maybe even a module name.

Thanks, I will modify it as your suggestions.

When I test the WRAN_ONCE, I find that some net drivers still have this problem,
such as using local_irq_disable/local_irq_enable in ndo_start_xmit() or other cases.


I will do an new patch and hope it could fix this problem completely in all the net drivers that support NETPOLL.


I check the drivers that support NETPOLL one by one again(almost 100 drivers),
and following drivers's fix will be included by my patch:

1: ixp2000/ixpdev.c : 66 local_irq_disable

2: fec_mpc52xx.c : 319 spin_unlock_irq

3: macb.c:602 : 638 spin_unlock_irq

4: mlx4/en_netdev.c : 448 
mlx4_en_xmit() -> mlx4_en_xmit_poll() -> spin_trylock_irq

5: smc91x.c 
It seems that there is a lots work to let smc91x work well with netpoll.


Thanks,
Dongdong

> 

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

end of thread, other threads:[~2009-08-20 10:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-19 10:43 [PATCH] netpoll: WARN_ONCE for start_xmit returns with interrupts enabled DDD
2009-08-19 10:43 ` Matt Mackall
2009-08-20 10:44   ` DDD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox