diff options
author | Sebastian Siewior <bigeasy@linutronix.de> | 2008-08-19 15:12:45 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-08-27 05:55:19 -0400 |
commit | ab9399059bb85a94758f42fb25607e440e926cc6 (patch) | |
tree | e56738237e0f855cf5a19f234cec611782c7d2a4 /drivers/net/gianfar.c | |
parent | edcfe5f7e307846e578fb88d69fa27051fded0ab (diff) |
net: don't grab a mutex within a timer context in gianfar
I got the following backtrace while network was unavailble:
|NETDEV WATCHDOG: eth0: transmit timed out
|BUG: sleeping function called from invalid context at /home/bigeasy/git/linux-2.6-powerpc/kernel/mutex.c:87
|in_atomic():1, irqs_disabled():0
|Call Trace:
|[c0383d90] [c0006dd8] show_stack+0x48/0x184 (unreliable)
|[c0383db0] [c001e938] __might_sleep+0xe0/0xf4
|[c0383dc0] [c025a43c] mutex_lock+0x24/0x3c
|[c0383de0] [c019005c] phy_stop+0x20/0x70
|[c0383df0] [c018d4ec] stop_gfar+0x28/0xf4
|[c0383e10] [c018e8c4] gfar_timeout+0x30/0x60
|[c0383e20] [c01fe7c0] dev_watchdog+0xa8/0x144
|[c0383e30] [c002f93c] run_timer_softirq+0x148/0x1c8
|[c0383e60] [c002b084] __do_softirq+0x5c/0xc4
|[c0383e80] [c00046fc] do_softirq+0x3c/0x54
|[c0383e90] [c002ac60] irq_exit+0x3c/0x5c
|[c0383ea0] [c000b378] timer_interrupt+0xe0/0xf8
|[c0383ec0] [c000e5ac] ret_from_except+0x0/0x18
|[c0383f80] [c000804c] cpu_idle+0xcc/0xdc
|[c0383fa0] [c025c07c] etext+0x7c/0x90
|[c0383fc0] [c0338960] start_kernel+0x294/0x2a8
|[c0383ff0] [c00003dc] skpinv+0x304/0x340
|------------[ cut here ]------------
The phylock was once a spinlock but got changed into a mutex via
commit 35b5f6b1a aka [PHYLIB: Locking fixes for PHY I/O potentially sleeping]
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 999d69168277..4320a983a588 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -105,6 +105,7 @@ const char gfar_driver_version[] = "1.3"; | |||
105 | 105 | ||
106 | static int gfar_enet_open(struct net_device *dev); | 106 | static int gfar_enet_open(struct net_device *dev); |
107 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); | 107 | static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev); |
108 | static void gfar_reset_task(struct work_struct *work); | ||
108 | static void gfar_timeout(struct net_device *dev); | 109 | static void gfar_timeout(struct net_device *dev); |
109 | static int gfar_close(struct net_device *dev); | 110 | static int gfar_close(struct net_device *dev); |
110 | struct sk_buff *gfar_new_skb(struct net_device *dev); | 111 | struct sk_buff *gfar_new_skb(struct net_device *dev); |
@@ -209,6 +210,7 @@ static int gfar_probe(struct platform_device *pdev) | |||
209 | spin_lock_init(&priv->txlock); | 210 | spin_lock_init(&priv->txlock); |
210 | spin_lock_init(&priv->rxlock); | 211 | spin_lock_init(&priv->rxlock); |
211 | spin_lock_init(&priv->bflock); | 212 | spin_lock_init(&priv->bflock); |
213 | INIT_WORK(&priv->reset_task, gfar_reset_task); | ||
212 | 214 | ||
213 | platform_set_drvdata(pdev, dev); | 215 | platform_set_drvdata(pdev, dev); |
214 | 216 | ||
@@ -1212,6 +1214,7 @@ static int gfar_close(struct net_device *dev) | |||
1212 | 1214 | ||
1213 | napi_disable(&priv->napi); | 1215 | napi_disable(&priv->napi); |
1214 | 1216 | ||
1217 | cancel_work_sync(&priv->reset_task); | ||
1215 | stop_gfar(dev); | 1218 | stop_gfar(dev); |
1216 | 1219 | ||
1217 | /* Disconnect from the PHY */ | 1220 | /* Disconnect from the PHY */ |
@@ -1326,13 +1329,16 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu) | |||
1326 | return 0; | 1329 | return 0; |
1327 | } | 1330 | } |
1328 | 1331 | ||
1329 | /* gfar_timeout gets called when a packet has not been | 1332 | /* gfar_reset_task gets scheduled when a packet has not been |
1330 | * transmitted after a set amount of time. | 1333 | * transmitted after a set amount of time. |
1331 | * For now, assume that clearing out all the structures, and | 1334 | * For now, assume that clearing out all the structures, and |
1332 | * starting over will fix the problem. */ | 1335 | * starting over will fix the problem. |
1333 | static void gfar_timeout(struct net_device *dev) | 1336 | */ |
1337 | static void gfar_reset_task(struct work_struct *work) | ||
1334 | { | 1338 | { |
1335 | dev->stats.tx_errors++; | 1339 | struct gfar_private *priv = container_of(work, struct gfar_private, |
1340 | reset_task); | ||
1341 | struct net_device *dev = priv->dev; | ||
1336 | 1342 | ||
1337 | if (dev->flags & IFF_UP) { | 1343 | if (dev->flags & IFF_UP) { |
1338 | stop_gfar(dev); | 1344 | stop_gfar(dev); |
@@ -1342,6 +1348,14 @@ static void gfar_timeout(struct net_device *dev) | |||
1342 | netif_tx_schedule_all(dev); | 1348 | netif_tx_schedule_all(dev); |
1343 | } | 1349 | } |
1344 | 1350 | ||
1351 | static void gfar_timeout(struct net_device *dev) | ||
1352 | { | ||
1353 | struct gfar_private *priv = netdev_priv(dev); | ||
1354 | |||
1355 | dev->stats.tx_errors++; | ||
1356 | schedule_work(&priv->reset_task); | ||
1357 | } | ||
1358 | |||
1345 | /* Interrupt Handler for Transmit complete */ | 1359 | /* Interrupt Handler for Transmit complete */ |
1346 | static int gfar_clean_tx_ring(struct net_device *dev) | 1360 | static int gfar_clean_tx_ring(struct net_device *dev) |
1347 | { | 1361 | { |