qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Wangkai (Kevin,C)" <wangkai86@huawei.com>
Cc: Lee yang <lee.yang@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"aliguori@amazon.com" <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH] Tap: fix vcpu long time io blocking on tap
Date: Thu, 17 Jul 2014 13:54:02 +0100	[thread overview]
Message-ID: <20140717125402.GA24256@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <87B246BB5ED53A4C98E4F9A35839EDE128F6F49D@nkgeml506-mbs.china.huawei.com>

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]

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.

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

      parent reply	other threads:[~2014-07-17 12:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11  1:05 [Qemu-devel] [PATCH] Tap: fix vcpu long time io blocking on tap Wangkai (Kevin,C)
2014-07-11 13:04 ` Stefan Hajnoczi
2014-07-14  1:55   ` Wangkai (Kevin,C)
2014-07-14  8:43     ` Stefan Hajnoczi
2014-07-14 10:44       ` Wangkai (Kevin,C)
2014-07-15 14:59         ` Stefan Hajnoczi
2014-07-16 10:10           ` Wangkai (Kevin,C)
2014-07-17  3:43           ` Wangkai (Kevin,C)
2014-07-17  5:36             ` Jason Wang
2014-07-17  7:48               ` Wangkai (Kevin,C)
2014-07-17 12:54 ` Stefan Hajnoczi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140717125402.GA24256@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=lee.yang@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wangkai86@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).