Skip to contentSkip to conversation

spidernet: enable poll() before registering interrupts

PATCH In review Arnd Bergmann 2 participants 4 messages Jul 11, 2007 – Aug 20, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spidernet: enable poll() before registering interrupts

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.

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

drivers/net/spider_net.c +2 -1
Index: 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);
#1 lore raw
Quoted 1 line · Arnd Bergmann

Index: linux-2.6/drivers/net/spider_net.c

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

--linas

#2 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

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.

---
This was found during testing with the fedora kernel, with all patches from netdev-2.6.git applied.

Quoted 8 lines

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

#3 lore raw
Quoted 5 lines · Linas Vepstas

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