Skip to contentSkip to conversation

d44: the poll handler b44_poll must not enable IRQ unconditionally

PATCH In review DDD 2 participants 2 messages Sep 17, 2009

Subsystems (2)
lore
Share & tools
lore

DDD

author
#0 lore raw

PATCH 1/1 d44: the poll handler b44_poll must not enable IRQ unconditionally

net/core/netpoll.c::netpoll_send_skb() calls the poll handler when it is available. As netconsole can be used from almost any context, IRQ must not be enabled blindly in the NAPI handler of the driver which supports netpoll.

Call trace:

netpoll_send_skb()
{
local_irq_save(flags)
-> netpoll_poll()

    -> poll_napi()
      -> poll_one_napi()
        -> napi->poll()
            -> b44_poll()

local_irq_restore(flags)
}

---
 drivers/net/b44.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/b44.c +3 -4
index 0189dcd..e046943 100644
@@ -847,23 +847,22 @@ static int b44_poll(struct napi_struct *napi, int budget)
 {
 	struct b44 *bp = container_of(napi, struct b44, napi);
 	int work_done;
+	unsigned long flags;
 
-	spin_lock_irq(&bp->lock);
+	spin_lock_irqsave(&bp->lock, flags);
 
 	if (bp->istat & (ISTAT_TX | ISTAT_TO)) {
 		/* spin_lock(&bp->tx_lock); */
 		b44_tx(bp);
 		/* spin_unlock(&bp->tx_lock); */
 	}
-	spin_unlock_irq(&bp->lock);
+	spin_unlock_irqrestore(&bp->lock, flags);
 
 	work_done = 0;
 	if (bp->istat & ISTAT_RX)
 		work_done += b44_rx(bp, budget);
 
 	if (bp->istat & ISTAT_ERRORS) {
-		unsigned long flags;
-
 		spin_lock_irqsave(&bp->lock, flags);
 		b44_halt(bp);
 		b44_init_rings(bp);
Signature · 1 line
1.6.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · DDD

net/core/netpoll.c::netpoll_send_skb() calls the poll handler when it is available. As netconsole can be used from almost any context, IRQ must not be enabled blindly in the NAPI handler of the driver which supports netpoll.

Call trace:

netpoll_send_skb()
{
local_irq_save(flags)
-> netpoll_poll()

Quoted 8 lines
    -> poll_napi()
      -> poll_one_napi()
        -> napi->poll()
            -> b44_poll()

local_irq_restore(flags)
}

Quoted 38 lines
---
 drivers/net/b44.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/b44.c +3 -4
index 0189dcd..e046943 100644
@@ -847,23 +847,22 @@ static int b44_poll(struct napi_struct *napi, int budget)
 {
 	struct b44 *bp = container_of(napi, struct b44, napi);
 	int work_done;
+	unsigned long flags;
 
-	spin_lock_irq(&bp->lock);
+	spin_lock_irqsave(&bp->lock, flags);
 
 	if (bp->istat & (ISTAT_TX | ISTAT_TO)) {
 		/* spin_lock(&bp->tx_lock); */
 		b44_tx(bp);
 		/* spin_unlock(&bp->tx_lock); */
 	}
-	spin_unlock_irq(&bp->lock);
+	spin_unlock_irqrestore(&bp->lock, flags);
 
 	work_done = 0;
 	if (bp->istat & ISTAT_RX)
 		work_done += b44_rx(bp, budget);
 
 	if (bp->istat & ISTAT_ERRORS) {
-		unsigned long flags;
-
 		spin_lock_irqsave(&bp->lock, flags);
 		b44_halt(bp);
 		b44_init_rings(bp);
Signature · 1 line
1.6.0.4
Signature · 1 line
Mathematics is the supreme nostalgia of our time.