On Fri, Jul 11, 2014 at 01:05:30AM +0000, Wangkai (Kevin,C) wrote: > When used a tap as net driver for vm, if too many packets was delivered to > the > guest os via tap interface, the guest os will be blocked on io events for a > long > time, while tap driver was busying process packets.
Please tweak this description to explain clearly that the tap_send() loop can execute for a very long time if more packets are received by the host during tap_send(). It seems that the guest does not require the QEMU global mutex often during virtio-net receive, otherwise the rx virtqueue would fill up and tap_send() would return. > diff --git a/net/tap.c b/net/tap.c > index a40f7f0..df9a0eb 100644 > --- a/net/tap.c > +++ b/net/tap.c > @@ -189,6 +189,7 @@ static void tap_send(void *opaque) > { > TAPState *s = opaque; > int size; > + int pkt = 0; > > while (qemu_can_send_packet(&s->nc)) { > uint8_t *buf = s->buf; > @@ -210,6 +211,11 @@ static void tap_send(void *opaque) > } else if (size < 0) { > break; > } > + > + /* limit io block time slice for 50 packets */ > + pkt++; > + if (pkt >= 50) > + break; Please use scripts/checkpatch.pl to check coding style. QEMU always uses curlies around if statement bodies, even when they are only one line.
pgpzx6epjOO7a.pgp
Description: PGP signature