[uClinux-dev] [PATCH] m68knommu: fixing FEC irq caused crashing

Xin Xie XinX at nojapower.com.au
Mon Feb 9 18:00:10 EST 2009


Occasionally the system is crashing when connect to the network runing
30+ hours. 

 

Found out it is due to two consecutive FEC RX irqs cause the stack
corruption of handle_IRQ_event routine. In the current fec RX/TX/MII
handler, spin_unlock_irq() will enable the IRQ at the end of function,
but the those functions will be continued called by the
fec_enet_interrupt as long as there is the IRQ status indicate there is
events. So inside the fec_enet_interrupt, there will be short period of
time IRQ enabled which should not happening because the IRQ handler is
registered with IRQF_DISABLED flags. 

 

Changing the spin_lock_irq/spin_unlock_irq to spin_lock/spin_unlock
solves the problem. 

 

Signed-off-by: Xin Xie <xinx at nojapower.com.au>

 

--- a/drivers/net/fec.c 2009-02-10 08:34:04.000000000 +1000

+++ b/drivers/net/fec.c 2009-02-10 08:35:35.000000000 +1000

@@ -494,7 +494,7 @@ fec_enet_tx(struct net_device *dev)

      struct      sk_buff     *skb;

 

      fep = netdev_priv(dev);

-     spin_lock_irq(&fep->hw_lock);

+     spin_lock(&fep->hw_lock);

      bdp = fep->dirty_tx;

 

      while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) {

@@ -553,7 +553,7 @@ fec_enet_tx(struct net_device *dev)

            }

      }

      fep->dirty_tx = (cbd_t *)bdp;

-     spin_unlock_irq(&fep->hw_lock);

+     spin_unlock(&fep->hw_lock);

 }

 

 

@@ -580,7 +580,7 @@ fec_enet_rx(struct net_device *dev)

      fep = netdev_priv(dev);

      fecp = (volatile fec_t*)dev->base_addr;

 

-     spin_lock_irq(&fep->hw_lock);

+     spin_lock(&fep->hw_lock);

 

      /* First, grab all of the stats for the incoming packet.

       * These get messed up if we get called due to a busy condition.

@@ -688,7 +688,7 @@ while (!((status = bdp->cbd_sc) & BD_ENE

      fecp->fec_r_des_active = 0;

 #endif

 

-     spin_unlock_irq(&fep->hw_lock);

+     spin_unlock(&fep->hw_lock);

 }

 

 

@@ -702,7 +702,7 @@ fec_enet_mii(struct net_device *dev)

      uint        mii_reg;

 

      fep = netdev_priv(dev);

-     spin_lock_irq(&fep->mii_lock);

+     spin_lock(&fep->mii_lock);

 

      ep = fep->hwp;

      mii_reg = ep->fec_mii_data;

@@ -723,7 +723,7 @@ fec_enet_mii(struct net_device *dev)

            ep->fec_mii_data = mip->mii_regval;

 

 unlock:

-     spin_unlock_irq(&fep->mii_lock);

+     spin_unlock(&fep->mii_lock);

 }

 

 static int

 

 

 

Xin Xie

Embedded Software Engineer

Noja Power Switchgear Pty Ltd

Tel: +61 7 39078741 

Email: xinx at nojapower.com.au

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20090210/e2fbbebe/attachment.html>


More information about the uClinux-dev mailing list