linux/drivers/net
Christian Borntraeger 4265f161b6 virtio: fix race in enable_cb
There is a race in virtio_net, dealing with disabling/enabling the callback.
I saw the following oops:

kernel BUG at /space/kvm/drivers/virtio/virtio_ring.c:218!
illegal operation: 0001 [#1] SMP
Modules linked in: sunrpc dm_mod
CPU: 2 Not tainted 2.6.25-rc1zlive-host-10623-gd358142-dirty #99
Process swapper (pid: 0, task: 000000000f85a610, ksp: 000000000f873c60)
Krnl PSW : 0404300180000000 00000000002b81a6 (vring_disable_cb+0x16/0x20)
           R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:0 CC:3 PM:0 EA:3
Krnl GPRS: 0000000000000001 0000000000000001 0000000010005800 0000000000000001
           000000000f3a0900 000000000f85a610 0000000000000000 0000000000000000
           0000000000000000 000000000f870000 0000000000000000 0000000000001237
           000000000f3a0920 000000000010ff74 00000000002846f6 000000000fa0bcd8
Krnl Code: 00000000002b819a: a7110001           tmll    %r1,1
           00000000002b819e: a7840004           brc     8,2b81a6
           00000000002b81a2: a7f40001           brc     15,2b81a4
          >00000000002b81a6: a51b0001           oill    %r1,1
           00000000002b81aa: 40102000           sth     %r1,0(%r2)
           00000000002b81ae: 07fe               bcr     15,%r14
           00000000002b81b0: eb7ff0380024       stmg    %r7,%r15,56(%r15)
           00000000002b81b6: a7f13e00           tmll    %r15,15872
Call Trace:
([<000000000fa0bcd0>] 0xfa0bcd0)
 [<00000000002b8350>] vring_interrupt+0x5c/0x6c
 [<000000000010ab08>] do_extint+0xb8/0xf0
 [<0000000000110716>] ext_no_vtime+0x16/0x1a
 [<0000000000107e72>] cpu_idle+0x1c2/0x1e0

The problem can be triggered with a high amount of host->guest traffic.
I think its the following race:

poll says netif_rx_complete
poll calls enable_cb
enable_cb opens the interrupt mask
a new packet comes, an interrupt is triggered----\
enable_cb sees that there is more work           |
enable_cb disables the interrupt                 |
       .                                         V
       .                            interrupt is delivered
       .                            skb_recv_done does atomic napi test, ok
 some waiting                       disable_cb is called->check fails->bang!
       .
poll would do napi check
poll would do disable_cb

The fix is to let enable_cb not disable the interrupt again, but expect the
caller to do the cleanup if it returns false. In that case, the interrupt is
only disabled, if the napi test_set_bit was successful.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cleaned up doco)
2008-03-17 22:58:21 +11:00
..
appletalk drivers/net/appletalk/ltpc.c: replace init_module&cleanup_module with module_init&module_exit 2008-03-05 18:49:21 -08:00
arcnet drivers/net/arcnet/capmode.c: replace init_module&cleanup_module with module_init&module_exit 2008-03-05 18:49:51 -08:00
arm drivers/net/arm/at91_ether.c: logical/bitand typo in function reset_phy() 2008-02-03 04:28:36 -08:00
atl1
bonding bonding: update version 2008-02-03 04:28:34 -08:00
can [CAN]: Add virtual CAN netdevice driver 2008-01-28 14:54:12 -08:00
chelsio annotate chelsio 2008-01-28 15:10:29 -08:00
cris CRIS v10: drivers/net/cris/eth_v10.c rename LED defines to CRIS_LED to avoid name clash. 2008-02-08 11:16:44 +01:00
cxgb3 cxgb3: Handle ARP completions that mark neighbors stale. 2008-02-11 11:09:17 -05:00
e1000 e1000: warn if this driver is used for e1000e devices 2008-02-11 14:51:40 -05:00
e1000e e1000e: remove unused read value in ASPM disable code. 2008-02-24 00:07:52 -05:00
ehea ehea: add kdump support 2008-02-23 23:54:59 -05:00
fec_8xx [POWERPC] CPM: Rename commproc to cpm1 and cpm2_common.c to cpm2.c 2008-01-28 08:31:05 -06:00
fs_enet fs_enet: Don't call phy_mii_ioctl() in atomic context. 2008-02-23 23:55:00 -05:00
hamradio mkiss: ax_bump() locking fix 2008-02-15 10:51:51 -05:00
ibm_emac
ibm_newemac [POWERPC] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table 2008-02-15 21:32:51 -06:00
igb igb: Fix panic with NICs with 1000BASE-SX PHY 2008-02-23 23:57:49 -05:00
irda Spelling fixes: lenght->length 2008-02-03 15:42:53 +02:00
ixgb ixgb: add RNBC counter - no buffer count - to ethtool stats 2008-02-24 00:07:44 -05:00
ixgbe ixgbe: fix typo in speed mesage 2008-03-05 06:34:29 -05:00
ixp2000
mlx4 mlx4_core: Move table_find from fmr_alloc to fmr_enable 2008-02-14 10:43:48 -08:00
myri10ge annotate myri10ge 2008-01-28 15:10:31 -08:00
netxen annotate netxen 2008-01-28 15:10:31 -08:00
pcmcia axnet_cs: change debugging level for "Too much work at interrupt" message. 2008-03-05 06:28:49 -05:00
phy FIXED_PHY must depend on PHYLIB=y 2008-03-05 06:34:34 -05:00
sk98lin drivers/net/sk98lin: Add missing "space" 2008-01-28 15:03:58 -08:00
skfp Spelling fixes: lenght->length 2008-02-03 15:42:53 +02:00
tokenring Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2008-02-04 07:58:52 -08:00
tulip de2104x: remove BUG_ON() when changing media type 2008-03-05 06:27:50 -05:00
usb rtl8150: use default MTU of 1500 2008-02-03 04:26:15 -08:00
wan net: replace __inline with inline 2008-03-05 18:36:28 -08:00
wireless rt2x00: Add new D-Link USB ID 2008-03-11 15:13:41 -04:00
3c59x.c
3c501.c 3c501: Bring into compliance with the coding style 2008-01-28 15:04:00 -08:00
3c501.h
3c503.c
3c503.h
3c505.c
3c505.h
3c507.c [netdrvr] checkpatch cleanups 2008-01-28 15:04:05 -08:00
3c509.c
3c515.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
3c523.c
3c523.h
3c527.c
3c527.h
7990.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
7990.h
8139cp.c
8139too.c 8139too fix for Dreamcast 2008-02-11 10:29:33 -05:00
8390.c
8390.h
82596.c
a2065.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
a2065.h
ac3200.c drivers/net/ac3200.c: replace init_module&cleanup_module with module_init&module_exit 2008-03-05 18:50:41 -08:00
acenic_firmware.h
acenic.c
acenic.h
amd8111e.c drivers/net: Add missing "space" 2008-01-28 15:03:59 -08:00
amd8111e.h
apne.c drivers/net/apne.c: replace init_module&cleanup_module with module_init&module_exit 2008-03-05 18:50:16 -08:00
ariadne.c
ariadne.h
at1700.c [netdrvr] checkpatch cleanups 2008-01-28 15:04:05 -08:00
atarilance.c fix drivers/net/atarilance.c compilation 2008-03-05 06:34:32 -05:00
atp.c
atp.h
au1000_eth.c
au1000_eth.h
ax88796.c NET: AX88796 use dev_dbg() instead of printk() 2008-02-03 04:26:09 -08:00
b44.c b44: power down PHY when interface down 2008-01-28 15:09:19 -08:00
b44.h
bfin_mac.c EMAC driver: Fix bug: The clock divisor is set to all ones at reset. 2008-02-03 04:28:51 -08:00
bfin_mac.h EMAC driver: use simpler comment headers and strip out information that is maintained in the scm's log 2008-02-03 04:28:48 -08:00
bmac.c
bmac.h
bnx2_fw2.h [BNX2]: Update firmware. 2008-01-31 19:27:17 -08:00
bnx2_fw.h [BNX2]: Update firmware. 2008-01-31 19:27:17 -08:00
bnx2.c [BNX2]: Update version to 1.7.4. 2008-02-23 19:49:48 -08:00
bnx2.h [BNX2]: Disable parallel detect on an HP blade. 2008-02-23 19:48:57 -08:00
bnx2x_fw_defs.h [BNX2X]: Correct Link management 2008-02-28 11:51:50 -08:00
bnx2x_hsi.h [BNX2X]: Correct Link management 2008-02-28 11:51:50 -08:00
bnx2x_init_values.h add bnx2x driver for BCM57710 2008-01-28 15:03:53 -08:00
bnx2x_init.h [BNX2X]: Prevent PCI queue overflow 2008-02-28 11:57:29 -08:00
bnx2x_reg.h [BNX2X]: Correct Link management 2008-02-28 11:51:50 -08:00
bnx2x.c [BNX2X]: update version, remove CVS strings 2008-02-28 11:58:49 -08:00
bnx2x.h [BNX2X]: Fix Xmit bugs 2008-02-28 11:57:55 -08:00
bsd_comp.c
cassini.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
cassini.h
cpmac.c cpmac: convert to new Fixed PHY infrastructure 2008-02-05 23:19:03 -06:00
cs89x0.c drivers/net/cs89x0.c: compilation warning fix 2008-02-23 23:55:05 -05:00
cs89x0.h
de600.c
de600.h
de620.c
de620.h
declance.c [netdrvr] irq handler minor cleanups in several drivers 2008-01-28 15:03:40 -08:00
defxx.c
defxx.h
depca.c
depca.h
dl2k.c
dl2k.h Fix dl2k constants 2008-02-01 20:54:03 +11:00
dm9000.c DM9000: Show the MAC address source after printing MAC 2008-02-11 11:06:37 -05:00
dm9000.h
dummy.c
e100.c e100: Do suspend/shutdown like e1000 2008-03-05 06:34:28 -05:00
e2100.c
eepro100.c eepro100 annotations 2008-01-28 15:07:59 -08:00
eepro.c
eexpress.c MAINTAINERS: remove Adam Fritzler, remove his email address in other sources 2008-02-03 16:36:24 +02:00
eexpress.h
enc28j60_hw.h add driver for enc28j60 ethernet chip 2008-01-28 15:08:03 -08:00
enc28j60.c net/enc28j60: oops fix 2008-03-05 18:51:19 -08:00
epic100.c
eql.c
es3210.c
eth16i.c
ewrk3.c
ewrk3.h
fealnx.c
fec_mpc52xx_phy.c [POWERPC] mpc5200: normalize compatible property bindings 2008-01-26 15:26:01 -07:00
fec_mpc52xx.c [POWERPC] mpc5200: normalize compatible property bindings 2008-01-26 15:26:01 -07:00
fec_mpc52xx.h
fec.c m68knommu: fix fec driver interrupt races 2008-03-04 08:04:11 -08:00
fec.h
forcedeth.c forcedeth: tx pause watermarks 2008-02-11 11:13:47 -05:00
gianfar_ethtool.c
gianfar_mii.c gianfar iomem misannotations 2008-02-15 10:51:53 -05:00
gianfar_mii.h
gianfar_sysfs.c gianfar driver: eliminate compiler warnings and unnecessary macros 2008-01-28 15:05:47 -08:00
gianfar.c gianfar: don't pass NULL dev ptr to DMA ops 2008-02-23 23:57:48 -05:00
gianfar.h
hamachi.c
hp100.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
hp100.h
hp-plus.c
hp.c
hplance.c
hplance.h
hydra.c
ibmlana.c ibmlana_init_one() must be __devinit 2008-02-03 04:26:12 -08:00
ibmlana.h
ibmveth.c
ibmveth.h
ifb.c
ioc3-eth.c
ipg.c ipg: add __devexit annotation 2008-01-28 15:05:54 -08:00
ipg.h ipg: fix checkpatch reported errors 2008-01-28 15:05:53 -08:00
isa-skeleton.c
iseries_veth.c iSeries: fix section mismatch in iseries_veth 2008-02-05 13:31:08 -05:00
jazzsonic.c
Kconfig drivers/net/Kconfig: fix whitespace for GELIC_WIRELESS entry 2008-03-11 15:13:39 -04:00
lance.c
lasi_82596.c
lib8390.c Fix a small number of "memeber" typoes. 2008-02-03 15:12:15 +02:00
lib82596.c
LICENSE.SRC
lne390.c
loopback.c [NET]: Remove unused define from loopback driver. 2008-01-28 14:57:25 -08:00
lp486e.c [netdrvr] checkpatch cleanups 2008-01-28 15:04:05 -08:00
mac89x0.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
mac8390.c
macb.c macb: Fix speed setting 2008-02-24 00:07:42 -05:00
macb.h
mace.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
mace.h
macmace.c
macsonic.c
macvlan.c [MACVLAN]: Setting macvlan_handle_frame_hook to NULL when rtnl_link_register() fails. 2008-01-31 19:28:25 -08:00
Makefile PS3: gelic: Add wireless support for PS3 2008-02-11 10:30:05 -05:00
meth.c
meth.h
mii.c
mipsnet.c Fix/Rewrite of the mipsnet driver] 2008-02-03 04:28:10 -08:00
mv643xx_eth.c mv643xx_eth: Define module alias for platform device 2008-03-05 06:28:31 -05:00
mvme147.c
myri_code.h
myri_sbus.c
myri_sbus.h
natsemi.c natsemi: section fix 2008-02-09 23:41:08 -08:00
ne2.c
ne2k-pci.c
ne3210.c
ne-h8300.c
ne.c
netconsole.c netconsole: avoid null pointer dereference at show_local_mac() 2008-02-15 02:01:58 -08:00
netx-eth.c
ni52.c ni52: Remove 278 scripts/checkpatch errors 2008-02-11 10:28:33 -05:00
ni52.h ni52: Remove 278 scripts/checkpatch errors 2008-02-11 10:28:33 -05:00
ni65.c
ni65.h
ni5010.c
ni5010.h
niu.c [NIU]: More BMAC alt MAC address fixes. 2008-02-20 00:18:09 -08:00
niu.h [NIU]: More BMAC alt MAC address fixes. 2008-02-20 00:18:09 -08:00
ns83820.c NET: ns83820.c remove fastcall macro 2008-01-28 15:07:56 -08:00
pasemi_mac.c pasemi_mac: Disable interface on close 2008-02-03 04:27:55 -08:00
pasemi_mac.h pasemi_mac: add support for setting MTU 2008-02-03 04:27:54 -08:00
pci-skeleton.c pci-skeleton: Misc fixes to build neatly 2008-02-03 04:28:43 -08:00
pcnet32.c pcnet32: Use print_mac 2008-02-11 10:28:31 -05:00
plip.c PLIP driver: convert the semaphore killed_timer_sem to completion 2008-01-28 15:07:20 -08:00
ppp_async.c
ppp_deflate.c [PPP]: Sparse warning fixes. 2008-01-28 15:11:27 -08:00
ppp_generic.c [PPP]: Sparse warning fixes. 2008-01-28 15:11:27 -08:00
ppp_mppe.c
ppp_mppe.h
ppp_synctty.c [PPP]: Sparse warning fixes. 2008-01-28 15:11:27 -08:00
pppoe.c [PPP]: Sparse warning fixes. 2008-01-28 15:11:27 -08:00
pppol2tp.c [PPPOL2TP]: Fix SMP issues in skb reorder queue handling 2008-03-05 18:40:01 -08:00
pppox.c
ps3_gelic_net.c PS3: gelic: Add wireless support for PS3 2008-02-11 10:30:05 -05:00
ps3_gelic_net.h PS3: gelic: Add wireless support for PS3 2008-02-11 10:30:05 -05:00
ps3_gelic_wireless.c PS3: gelic: Link the wireless net_device structure to the corresponding device structure 2008-02-28 09:13:09 -05:00
ps3_gelic_wireless.h PS3: gelic: Add wireless support for PS3 2008-02-11 10:30:05 -05:00
qla3xxx.c qla3xxx annotations 2008-01-28 15:08:00 -08:00
qla3xxx.h qla3xxx annotations 2008-01-28 15:08:00 -08:00
r6040.c r6040: cleanups 2008-02-05 23:29:22 +01:00
r8169.c
rionet.c
rrunner.c drivers/net: Add missing "space" 2008-01-28 15:03:59 -08:00
rrunner.h
s2io-regs.h [S2IO]: Support for add/delete/store/restore ethernet addresses 2008-01-28 15:03:52 -08:00
s2io.c make s2io.c:init_tti() static 2008-03-05 07:24:01 -05:00
s2io.h S2io: Fix for LRO Bugs 2008-02-03 04:27:38 -08:00
saa9730.c
saa9730.h
sb1000.c
sb1250-mac.c
sc92031.c
seeq8005.c
seeq8005.h
sgiseeq.c SGISEEQ: fix oops when doing ifconfig down; ifconfig up 2008-01-28 15:08:02 -08:00
sgiseeq.h
sis190.c sis190: read the mac address from the eeprom first 2008-02-23 23:57:47 -05:00
sis900.c drivers/net: Add missing "space" 2008-01-28 15:03:59 -08:00
sis900.h
skge.c
skge.h
sky2.c sky2: fix LED management 2008-02-24 00:07:39 -05:00
sky2.h sky2: fix LED management 2008-02-24 00:07:39 -05:00
slhc.c [PPP]: Sparse warning fixes. 2008-01-28 15:11:27 -08:00
slip.c slip: Drag kicking and screaming into coding style compliance 2008-01-28 15:04:01 -08:00
slip.h
smc91x.c [NET] smc91x: Make smc91x use IRQ resource trigger flags 2008-01-28 13:13:19 +00:00
smc91x.h mn10300: add the MN10300/AM33 architecture to the kernel 2008-02-08 09:22:30 -08:00
smc911x.c
smc911x.h
smc9194.c drivers/net: Add missing "space" 2008-01-28 15:03:59 -08:00
smc9194.h
smc-mca.c
smc-ultra32.c
smc-ultra.c
sni_82596.c
sonic.c
sonic.h
Space.c
spider_net_ethtool.c
spider_net.c
spider_net.h
starfire_firmware.h
starfire_firmware.pl
starfire.c starfire: secton fix 2008-02-09 23:42:17 -08:00
stnic.c
sun3_82586.c
sun3_82586.h
sun3lance.c
sunbmac.c net/sunbmac.c section fix 2008-02-03 04:26:15 -08:00
sunbmac.h
sundance.c sundance: SIOCDEVPRIVATE pollution 2008-01-28 15:03:46 -08:00
sungem_phy.c
sungem_phy.h
sungem.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
sungem.h sungem endianness annotations 2008-01-28 15:07:10 -08:00
sunhme.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
sunhme.h sunhme endianness annotations 2008-01-28 15:07:09 -08:00
sunlance.c
sunqe.c net/sunqe.c section fix 2008-02-03 04:26:14 -08:00
sunqe.h
sunvnet.c drivers/net/sunvnet.c:print_version() must be __devinit 2008-02-03 04:26:13 -08:00
sunvnet.h
tc35815.c
tehuti_fw.h
tehuti.c netdev: ARRAY_SIZE() cleanups 2008-01-28 15:03:37 -08:00
tehuti.h
tg3.c tg3: ethtool phys_id default 2008-02-23 19:51:59 -08:00
tg3.h [TG3]: Replace some magic 5704S constants 2008-01-28 14:59:32 -08:00
tlan.c tlan: add static to function definitions 2008-02-23 23:57:46 -05:00
tlan.h
tsi108_eth.c Tsi108_eth: Add ethtool support 2008-02-11 14:47:29 -05:00
tsi108_eth.h
tun.c [TUN]: Fix RTNL-locking in tun/tap driver 2008-02-29 12:26:21 -08:00
typhoon-firmware.h
typhoon.c typhoon: section fix 2008-02-09 23:40:34 -08:00
typhoon.h
ucc_geth_ethtool.c
ucc_geth_mii.c Fix PHY Lib support for gianfar and ucc_geth 2008-02-06 06:42:04 -05:00
ucc_geth_mii.h
ucc_geth.c ucc_geth: add support for netpoll 2008-02-03 04:25:59 -08:00
ucc_geth.h
veth.c veth: fix dev refcount race 2008-02-20 00:21:47 -08:00
via-rhine.c [netdrvr] via-rhine: Use register offset definition for WOLcgClr 2008-02-24 00:07:37 -05:00
via-velocity.c via-velocity: section fix 2008-02-09 23:41:40 -08:00
via-velocity.h big-endian support for via-velocity 2008-02-03 04:26:27 -08:00
virtio_net.c virtio: fix race in enable_cb 2008-03-17 22:58:21 +11:00
wd.c
xen-netfront.c NULL noise in drivers/net 2008-01-28 15:07:12 -08:00
yellowfin.c
znet.c
zorro8390.c