qemu-e2k/net
Stefan Hajnoczi 68e5ec6400 tap: avoid deadlocking rx
The net subsystem has a control flow mechanism so peer NetClientStates
can tell each other to stop sending packets.  This is used to stop
monitoring the tap file descriptor for incoming packets if the guest rx
ring has no spare buffers.

There is a corner case when tap_can_send() is true at the beginning of
an event loop iteration but becomes false before the tap_send() fd
handler is invoked.

tap_send() will read the packet from the tap file descriptor and attempt
to send it.  The net queue will hold on to the packet and return 0,
indicating that further I/O is not possible.  tap then stops monitoring
the file descriptor for reads.

This is unlike the normal case where tap_can_send() is the same before
and during the event loop iteration.  The event loop would simply not
monitor the file descriptor if tap_can_send() returns true.  Upon next
iteration it would check tap_can_send() again and begin monitoring if we
can send.

The deadlock happens because tap_send() explicitly disabled read_poll.
This is done with the expectation that the peer will call
qemu_net_queue_flush().  But hw/net/virtio-net.c does not monitor
vm_running transitions and issue the flush.  Hence we're left with a
broken tap device.

Cc: qemu-stable@nongnu.org
Reported-by: Neil Skrypuch <neil@tembosocial.com>
Tested-by: Neil Skrypuch <neil@tembosocial.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-03-12 10:12:00 +01:00
..
checksum.c
clients.h net: Adding netmap network backend 2013-12-09 13:33:19 +01:00
dump.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
eth.c
hub.c net: Rename send_queue to incoming_queue 2013-09-06 17:01:26 +02:00
hub.h
Makefile.objs net: Adding netmap network backend 2013-12-09 13:33:19 +01:00
net.c net: remove implicit peer from offload API 2014-02-25 14:31:05 +01:00
netmap.c net: Disable netmap backend when not supported 2014-02-25 11:50:17 +01:00
queue.c
slirp.c
socket.c net: call socket_set_fast_reuse instead of setting SO_REUSEADDR 2013-10-02 19:20:31 +02:00
tap_int.h
tap-aix.c
tap-bsd.c tap: Use numbered tap/tun devices on all *BSD OS's 2013-09-06 17:01:26 +02:00
tap-haiku.c
tap-linux.c tap-linux: Get features once and use it many times 2014-01-27 15:44:06 +01:00
tap-linux.h
tap-solaris.c
tap-win32.c net: make tap offloading callbacks static 2014-02-25 11:50:17 +01:00
tap.c tap: avoid deadlocking rx 2014-03-12 10:12:00 +01:00
util.c
util.h
vde.c