From c8b7de7fce9cffe97e9d10dbda7b5476e2339d6f Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Tue, 23 Aug 2011 23:40:39 +0100 Subject: [PATCH] staging: et131x: Fix free IRQ from IRQ context warning after tx_timeout When a tx timeout occured, et131x_tx_timeout closed and re-opened the device to fix. As et131x_close called free_irq(), bad things ensued (see warning trace below), namely a storm of errors and warnings. Fixed by replacing the close() and open() calls with just the relevant functions previously called from these. Verified on an ET-1310 device. Signed-off-by: Mark Einon ---------- Aug 2 21:26:08 msilap kernel: [ 6484.816024] ------------[ cut here ]------------ Aug 2 21:26:08 msilap kernel: [ 6484.816039] WARNING: at /home/mark/Source/staging-2.6/net/sched/sch_generic.c:255 dev_watchdog+0xf0/0x150() Aug 2 21:26:08 msilap kernel: [ 6484.816045] Hardware name: MS-1727 Aug 2 21:26:08 msilap kernel: [ 6484.816050] NETDEV WATCHDOG: eth1 (et131x): transmit queue 0 timed out Aug 2 21:26:08 msilap kernel: [ 6484.816054] Modules linked in: et131x(C) aes_generic tcp_lp fuse nouveau ttm drm_kms_helper drm i2c_algo_bit sunrpc ipv6 cpufreq_ondemand acpi_cpufreq freq_table mperf uinput arc4 iwlagn snd_hda_codec_hdmi mac80211 sdhci_pci sdhci snd_hda_codec_realtek cfg80211 snd_hda_intel snd_hda_codec mmc_core snd_hwdep firewire_ohci firewire_core jmb38x_ms snd_seq snd_seq_device snd_pcm mxm_wmi ir_lirc_codec lirc_dev ir_sony_decoder i2c_i801 ir_jvc_decoder ir_rc6_decoder rc_rc6_mce i7core_edac edac_core snd_timer pcspkr rfkill r8169 mii i2c_core video ir_rc5_decoder memstick iTCO_wdt iTCO_vendor_support ir_nec_decoder ene_ir rc_core joydev microcode wmi snd crc_itu_t soundcore snd_page_alloc [last unloaded: et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816163] Pid: 0, comm: kworker/0:1 Tainted: G C 3.0.0-rc6+ #21 Aug 2 21:26:08 msilap kernel: [ 6484.816167] Call Trace: Aug 2 21:26:08 msilap kernel: [ 6484.816171] [] warn_slowpath_common+0x85/0x9d Aug 2 21:26:08 msilap kernel: [ 6484.816189] [] warn_slowpath_fmt+0x46/0x48 Aug 2 21:26:08 msilap kernel: [ 6484.816196] [] ? netif_tx_lock+0x4a/0x7b Aug 2 21:26:08 msilap kernel: [ 6484.816203] [] dev_watchdog+0xf0/0x150 Aug 2 21:26:08 msilap kernel: [ 6484.816211] [] run_timer_softirq+0x1a9/0x279 Aug 2 21:26:08 msilap kernel: [ 6484.816218] [] ? netif_tx_unlock+0x53/0x53 Aug 2 21:26:08 msilap kernel: [ 6484.816226] [] __do_softirq+0xd5/0x1a4 Aug 2 21:26:08 msilap kernel: [ 6484.816234] [] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816245] [] call_softirq+0x1c/0x26 Aug 2 21:26:08 msilap kernel: [ 6484.816251] [] do_softirq+0x46/0x83 Aug 2 21:26:08 msilap kernel: [ 6484.816257] [] irq_exit+0x52/0x9b Aug 2 21:26:08 msilap kernel: [ 6484.816265] [] smp_apic_timer_interrupt+0x7c/0x8a Aug 2 21:26:08 msilap kernel: [ 6484.816273] [] apic_timer_interrupt+0x13/0x20 Aug 2 21:26:08 msilap kernel: [ 6484.816278] [] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816291] [] ? intel_idle+0xd1/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816297] [] ? intel_idle+0xb3/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816306] [] cpuidle_idle_call+0xe2/0x160 Aug 2 21:26:08 msilap kernel: [ 6484.816315] [] cpu_idle+0xaa/0xcc Aug 2 21:26:08 msilap kernel: [ 6484.816323] [] start_secondary+0x248/0x24f Aug 2 21:26:08 msilap kernel: [ 6484.816329] ---[ end trace 10ae1b2c6bae932f ]--- Aug 2 21:26:08 msilap kernel: [ 6484.816337] et131x 0000:02:00.0: Send stuck - reset. tcb->WrIndex 0, flags 0x00000000 Aug 2 21:26:08 msilap kernel: [ 6484.816344] ------------[ cut here ]------------ Aug 2 21:26:08 msilap kernel: [ 6484.816353] WARNING: at /home/mark/Source/staging-2.6/kernel/irq/manage.c:1131 __free_irq+0x58/0x192() Aug 2 21:26:08 msilap kernel: [ 6484.816358] Hardware name: MS-1727 Aug 2 21:26:08 msilap kernel: [ 6484.816362] Trying to free IRQ 16 from IRQ context! Aug 2 21:26:08 msilap kernel: [ 6484.816365] Modules linked in: et131x(C) aes_generic tcp_lp fuse nouveau ttm drm_kms_helper drm i2c_algo_bit sunrpc ipv6 cpufreq_ondemand acpi_cpufreq freq_table mperf uinput arc4 iwlagn snd_hda_codec_hdmi mac80211 sdhci_pci sdhci snd_hda_codec_realtek cfg80211 snd_hda_intel snd_hda_codec mmc_core snd_hwdep firewire_ohci firewire_core jmb38x_ms snd_seq snd_seq_device snd_pcm mxm_wmi ir_lirc_codec lirc_dev ir_sony_decoder i2c_i801 ir_jvc_decoder ir_rc6_decoder rc_rc6_mce i7core_edac edac_core snd_timer pcspkr rfkill r8169 mii i2c_core video ir_rc5_decoder memstick iTCO_wdt iTCO_vendor_support ir_nec_decoder ene_ir rc_core joydev microcode wmi snd crc_itu_t soundcore snd_page_alloc [last unloaded: et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816459] Pid: 0, comm: kworker/0:1 Tainted: G WC 3.0.0-rc6+ #21 Aug 2 21:26:08 msilap kernel: [ 6484.816464] Call Trace: Aug 2 21:26:08 msilap kernel: [ 6484.816467] [] warn_slowpath_common+0x85/0x9d Aug 2 21:26:08 msilap kernel: [ 6484.816480] [] warn_slowpath_fmt+0x46/0x48 Aug 2 21:26:08 msilap kernel: [ 6484.816488] [] __free_irq+0x58/0x192 Aug 2 21:26:08 msilap kernel: [ 6484.816496] [] free_irq+0x5e/0x77 Aug 2 21:26:08 msilap kernel: [ 6484.816506] [] et131x_close+0x4b/0x5e [et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816516] [] et131x_tx_timeout+0xac/0xc7 [et131x] Aug 2 21:26:08 msilap kernel: [ 6484.816523] [] dev_watchdog+0x104/0x150 Aug 2 21:26:08 msilap kernel: [ 6484.816530] [] run_timer_softirq+0x1a9/0x279 Aug 2 21:26:08 msilap kernel: [ 6484.816537] [] ? netif_tx_unlock+0x53/0x53 Aug 2 21:26:08 msilap kernel: [ 6484.816544] [] __do_softirq+0xd5/0x1a4 Aug 2 21:26:08 msilap kernel: [ 6484.816552] [] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816560] [] call_softirq+0x1c/0x26 Aug 2 21:26:08 msilap kernel: [ 6484.816566] [] do_softirq+0x46/0x83 Aug 2 21:26:08 msilap kernel: [ 6484.816572] [] irq_exit+0x52/0x9b Aug 2 21:26:08 msilap kernel: [ 6484.816580] [] smp_apic_timer_interrupt+0x7c/0x8a Aug 2 21:26:08 msilap kernel: [ 6484.816588] [] apic_timer_interrupt+0x13/0x20 Aug 2 21:26:08 msilap kernel: [ 6484.816592] [] ? paravirt_read_tsc+0x9/0xd Aug 2 21:26:08 msilap kernel: [ 6484.816604] [] ? intel_idle+0xd1/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816610] [] ? intel_idle+0xb3/0xf8 Aug 2 21:26:08 msilap kernel: [ 6484.816617] [] cpuidle_idle_call+0xe2/0x160 Aug 2 21:26:08 msilap kernel: [ 6484.816625] [] cpu_idle+0xaa/0xcc Aug 2 21:26:08 msilap kernel: [ 6484.816632] [] start_secondary+0x248/0x24f Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_phy.c | 1 - drivers/staging/et131x/et131x_netdev.c | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index 2c6898f707be..c845c27f23db 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -732,7 +732,6 @@ void et131x_mii_check(struct et131x_adapter *adapter, u32 mdi_mdix; u32 masterslave; u32 polarity; - unsigned long flags; if (bmsr_ints & MI_BMSR_LINK_STATUS) { if (bmsr & MI_BMSR_LINK_STATUS) { diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 37e10696afb8..70a0da3fb52d 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -478,9 +478,28 @@ void et131x_tx_timeout(struct net_device *netdev) tcb->index, tcb->flags); - et131x_close(netdev); - et131x_open(netdev); + adapter->net_stats.tx_errors++; + /* perform reset */ + /* First thing is to stop the queue */ + netif_stop_queue(netdev); + + /* Stop the Tx and Rx DMA engines */ + et131x_rx_dma_disable(adapter); + et131x_tx_dma_disable(adapter); + + /* Disable device interrupts */ + et131x_disable_interrupts(adapter); + + /* Enable the Tx and Rx DMA engines (if not already enabled) */ + et131x_rx_dma_enable(adapter); + et131x_tx_dma_enable(adapter); + + /* Enable device interrupts */ + et131x_enable_interrupts(adapter); + + /* We're ready to move some data, so start the queue */ + netif_start_queue(netdev); return; } } -- 2.30.2