netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spidernet: enable poll() before registering interrupts
@ 2007-07-11 23:19 Arnd Bergmann
  2007-08-20 22:20 ` Linas Vepstas
  2007-08-20 22:29 ` Linas Vepstas
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2007-07-11 23:19 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: cbe-oss-dev, netdev, Christian Krafft

We must not call netif_poll_enable after enabling interrupts,
because an interrupt might come in and set the __LINK_STATE_RX_SCHED
bit before we get to clear that bit again. If that happens,
the next call to the ->poll() function will oops.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
---
This was found during testing with the fedora kernel,
with all patches from netdev-2.6.git applied.

It may not be the right fix, but this is currently the
only way I can get that kernel to boot.

One part I don't understand at the moment is that Christian
Krafft reported the same problem with tg3, but that driver
has all interrupts disabled at the device while calling
the request_irq() function, which seems to be the best
solution for avoiding the bug in the first place.

Index: linux-2.6/drivers/net/spider_net.c
===================================================================
--- linux-2.6.orig/drivers/net/spider_net.c
+++ linux-2.6/drivers/net/spider_net.c
@@ -1997,6 +1997,7 @@ spider_net_open(struct net_device *netde
 	/* further enhancement: setup hw vlan, if needed */
 
 	result = -EBUSY;
+	netif_poll_enable(netdev);
 	if (request_irq(netdev->irq, spider_net_interrupt,
 			     IRQF_SHARED, netdev->name, netdev))
 		goto register_int_failed;
@@ -2005,11 +2006,11 @@ spider_net_open(struct net_device *netde
 
 	netif_start_queue(netdev);
 	netif_carrier_on(netdev);
-	netif_poll_enable(netdev);
 
 	return 0;
 
 register_int_failed:
+	netif_poll_disable(netdev);
 	spider_net_free_rx_chain_contents(card);
 alloc_skbs_failed:
 	spider_net_free_chain(card, &card->rx_chain);

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

* Re: [PATCH] spidernet: enable poll() before registering interrupts
  2007-07-11 23:19 [PATCH] spidernet: enable poll() before registering interrupts Arnd Bergmann
@ 2007-08-20 22:20 ` Linas Vepstas
  2007-08-20 22:29 ` Linas Vepstas
  1 sibling, 0 replies; 5+ messages in thread
From: Linas Vepstas @ 2007-08-20 22:20 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: cbe-oss-dev, netdev, Christian Krafft

On Thu, Jul 12, 2007 at 01:19:11AM +0200, Arnd Bergmann wrote:
> Index: linux-2.6/drivers/net/spider_net.c

Sorry, this one got lost in my mailbox.  Will attend to it shortly.

--linas


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

* Re: [PATCH] spidernet: enable poll() before registering interrupts
  2007-07-11 23:19 [PATCH] spidernet: enable poll() before registering interrupts Arnd Bergmann
  2007-08-20 22:20 ` Linas Vepstas
@ 2007-08-20 22:29 ` Linas Vepstas
  2007-08-20 23:06   ` Arnd Bergmann
  1 sibling, 1 reply; 5+ messages in thread
From: Linas Vepstas @ 2007-08-20 22:29 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: cbe-oss-dev, netdev, Christian Krafft

On Thu, Jul 12, 2007 at 01:19:11AM +0200, Arnd Bergmann wrote:
> We must not call netif_poll_enable after enabling interrupts,
> because an interrupt might come in and set the __LINK_STATE_RX_SCHED
> bit before we get to clear that bit again. If that happens,
> the next call to the ->poll() function will oops.
> 
> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
> ---
> This was found during testing with the fedora kernel,
> with all patches from netdev-2.6.git applied.
> 
> It may not be the right fix, but this is currently the
> only way I can get that kernel to boot.
> 
> One part I don't understand at the moment is that Christian
> Krafft reported the same problem with tg3, but that driver
> has all interrupts disabled at the device while calling
> the request_irq() function, which seems to be the best
> solution for avoiding the bug in the first place.

It apears that this patch does not apply cleanly any more,
and I think that's a good thing! 

An intervening patch changed the init so that the 
hardware interrupts aren't enabled until after the
request_irq, and after the poll_enable().  Thus,
it seems this pach is no longer needed, right?

I'll pursue with Kou Ishizaki, who pointed out that
I'd missed your email.

--linas


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

* Re: [PATCH] spidernet: enable poll() before registering interrupts
  2007-08-20 22:29 ` Linas Vepstas
@ 2007-08-20 23:06   ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2007-08-20 23:06 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: cbe-oss-dev, netdev, Christian Krafft

On Tuesday 21 August 2007, Linas Vepstas wrote:
> 
> An intervening patch changed the init so that the 
> hardware interrupts aren't enabled until after the
> request_irq, and after the poll_enable().  Thus,
> it seems this pach is no longer needed, right?

Right, the other patch that you already applied is a better fix.

	Arnd <><

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

* [PATCH] spidernet: enable poll() before registering interrupts
@ 2007-08-22  0:27 Ishizaki Kou
  0 siblings, 0 replies; 5+ messages in thread
From: Ishizaki Kou @ 2007-08-22  0:27 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: netdev, cbe-oss-dev, arnd

We must not call netif_poll_enable after enabling interrupts,
because an interrupt might come in and set the __LINK_STATE_RX_SCHED
bit before we get to clear that bit again. If that happens,
the next call to the ->poll() function will oops.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
---

I refreshed Arnd-san's patch.


Index: linux-powerpc-git/drivers/net/spider_net.c
===================================================================
--- linux-powerpc-git.orig/drivers/net/spider_net.c	2007-08-21 16:58:44.000000000 +0900
+++ linux-powerpc-git/drivers/net/spider_net.c	2007-08-21 17:11:07.000000000 +0900
@@ -2030,6 +2030,7 @@ spider_net_open(struct net_device *netde
 	/* further enhancement: setup hw vlan, if needed */
 
 	result = -EBUSY;
+	netif_poll_enable(netdev);
 	if (request_irq(netdev->irq, spider_net_interrupt,
 			     IRQF_SHARED, netdev->name, netdev))
 		goto register_int_failed;
@@ -2038,13 +2039,13 @@ spider_net_open(struct net_device *netde
 
 	netif_start_queue(netdev);
 	netif_carrier_on(netdev);
-	netif_poll_enable(netdev);
 
 	spider_net_enable_interrupts(card);
 
 	return 0;
 
 register_int_failed:
+	netif_poll_disable(netdev);
 	spider_net_free_rx_chain_contents(card);
 alloc_skbs_failed:
 	spider_net_free_chain(card, &card->rx_chain);

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

end of thread, other threads:[~2007-08-22  0:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11 23:19 [PATCH] spidernet: enable poll() before registering interrupts Arnd Bergmann
2007-08-20 22:20 ` Linas Vepstas
2007-08-20 22:29 ` Linas Vepstas
2007-08-20 23:06   ` Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2007-08-22  0:27 Ishizaki Kou

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