Skip to content

Commit 0b7c874

Browse files
nhormandavem330
authored andcommitted
forcedeth: fix unilateral interrupt disabling in netpoll path
Forcedeth currently uses disable_irq_lockdep and enable_irq_lockdep, which in some configurations simply calls local_irq_disable. This causes errant warnings in the netpoll path as in netpoll_send_skb_on_dev, where we disable irqs using local_irq_save, leading to the following warning: WARNING: at net/core/netpoll.c:352 netpoll_send_skb_on_dev+0x243/0x250() (Not tainted) Hardware name: netpoll_send_skb_on_dev(): eth0 enabled interrupts in poll (nv_start_xmit_optimized+0x0/0x860 [forcedeth]) Modules linked in: netconsole(+) configfs ipv6 iptable_filter ip_tables ppdev parport_pc parport sg microcode serio_raw edac_core edac_mce_amd k8temp snd_hda_codec_realtek snd_hda_codec_generic forcedeth snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc i2c_nforce2 i2c_core shpchp ext4 jbd2 mbcache sr_mod cdrom sd_mod crc_t10dif pata_amd ata_generic pata_acpi sata_nv dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan] Pid: 1940, comm: modprobe Not tainted 2.6.32-573.7.1.el6.x86_64.debug #1 Call Trace: [<ffffffff8107bbc1>] ? warn_slowpath_common+0x91/0xe0 [<ffffffff8107bcc6>] ? warn_slowpath_fmt+0x46/0x60 [<ffffffffa00fe5b0>] ? nv_start_xmit_optimized+0x0/0x860 [forcedeth] [<ffffffff814b3593>] ? netpoll_send_skb_on_dev+0x243/0x250 [<ffffffff814b37c9>] ? netpoll_send_udp+0x229/0x270 [<ffffffffa02e3299>] ? write_msg+0x39/0x110 [netconsole] [<ffffffffa02e331b>] ? write_msg+0xbb/0x110 [netconsole] [<ffffffff8107bd55>] ? __call_console_drivers+0x75/0x90 [<ffffffff8107bdba>] ? _call_console_drivers+0x4a/0x80 [<ffffffff8107c445>] ? release_console_sem+0xe5/0x250 [<ffffffff8107d200>] ? register_console+0x190/0x3e0 [<ffffffffa02e71a6>] ? init_netconsole+0x1a6/0x216 [netconsole] [<ffffffffa02e7000>] ? init_netconsole+0x0/0x216 [netconsole] [<ffffffff810020d0>] ? do_one_initcall+0xc0/0x280 [<ffffffff810d4933>] ? sys_init_module+0xe3/0x260 [<ffffffff8100b0d2>] ? system_call_fastpath+0x16/0x1b ---[ end trace f349c7af88e6a6d5 ]--- console [netcon0] enabled netconsole: network logging started Fix it by modifying the forcedeth code to use disable_irq_nosync_lockdep_irqsavedisable_irq_nosync_lockdep_irqsave instead, which saves and restores irq state properly. This also saves us a little code in the process Tested by the reporter, with successful restuls Patch applies to the head of the net tree Signed-off-by: Neil Horman <[email protected]> CC: "David S. Miller" <[email protected]> Reported-by: Vasily Averin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6f5cade commit 0b7c874

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

drivers/net/ethernet/nvidia/forcedeth.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4076,6 +4076,8 @@ static void nv_do_nic_poll(unsigned long data)
40764076
struct fe_priv *np = netdev_priv(dev);
40774077
u8 __iomem *base = get_hwbase(dev);
40784078
u32 mask = 0;
4079+
unsigned long flags;
4080+
unsigned int irq = 0;
40794081

40804082
/*
40814083
* First disable irq(s) and then
@@ -4085,25 +4087,27 @@ static void nv_do_nic_poll(unsigned long data)
40854087

40864088
if (!using_multi_irqs(dev)) {
40874089
if (np->msi_flags & NV_MSI_X_ENABLED)
4088-
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
4090+
irq = np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector;
40894091
else
4090-
disable_irq_lockdep(np->pci_dev->irq);
4092+
irq = np->pci_dev->irq;
40914093
mask = np->irqmask;
40924094
} else {
40934095
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
4094-
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
4096+
irq = np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector;
40954097
mask |= NVREG_IRQ_RX_ALL;
40964098
}
40974099
if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) {
4098-
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
4100+
irq = np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector;
40994101
mask |= NVREG_IRQ_TX_ALL;
41004102
}
41014103
if (np->nic_poll_irq & NVREG_IRQ_OTHER) {
4102-
disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector);
4104+
irq = np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector;
41034105
mask |= NVREG_IRQ_OTHER;
41044106
}
41054107
}
4106-
/* disable_irq() contains synchronize_irq, thus no irq handler can run now */
4108+
4109+
disable_irq_nosync_lockdep_irqsave(irq, &flags);
4110+
synchronize_irq(irq);
41074111

41084112
if (np->recover_error) {
41094113
np->recover_error = 0;
@@ -4156,28 +4160,22 @@ static void nv_do_nic_poll(unsigned long data)
41564160
nv_nic_irq_optimized(0, dev);
41574161
else
41584162
nv_nic_irq(0, dev);
4159-
if (np->msi_flags & NV_MSI_X_ENABLED)
4160-
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
4161-
else
4162-
enable_irq_lockdep(np->pci_dev->irq);
41634163
} else {
41644164
if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
41654165
np->nic_poll_irq &= ~NVREG_IRQ_RX_ALL;
41664166
nv_nic_irq_rx(0, dev);
4167-
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
41684167
}
41694168
if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) {
41704169
np->nic_poll_irq &= ~NVREG_IRQ_TX_ALL;
41714170
nv_nic_irq_tx(0, dev);
4172-
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
41734171
}
41744172
if (np->nic_poll_irq & NVREG_IRQ_OTHER) {
41754173
np->nic_poll_irq &= ~NVREG_IRQ_OTHER;
41764174
nv_nic_irq_other(0, dev);
4177-
enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector);
41784175
}
41794176
}
41804177

4178+
enable_irq_lockdep_irqrestore(irq, &flags);
41814179
}
41824180

41834181
#ifdef CONFIG_NET_POLL_CONTROLLER

0 commit comments

Comments
 (0)