From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Wangkai (Kevin, C)" <wangkai86@huawei.com>
Subject: [Qemu-devel] [PULL 1/5] tap: fix vcpu long time io blocking on tap
Date: Fri, 19 Dec 2014 13:18:20 +0000 [thread overview]
Message-ID: <1418995104-26262-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1418995104-26262-1-git-send-email-stefanha@redhat.com>
From: "Wangkai (Kevin,C)" <wangkai86@huawei.com>
[Adjusted doc comment for grammar.
--Stefan]
Signed-off-by: Wangkai <wangkai86@huawei.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
net/tap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/tap.c b/net/tap.c
index bde6b58..1fe0edf 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 packets = 0;
while (qemu_can_send_packet(&s->nc)) {
uint8_t *buf = s->buf;
@@ -210,6 +211,17 @@ static void tap_send(void *opaque)
} else if (size < 0) {
break;
}
+
+ /*
+ * When the host keeps receiving more packets while tap_send() is
+ * running we can hog the QEMU global mutex. Limit the number of
+ * packets that are processed per tap_send() callback to prevent
+ * stalling the guest.
+ */
+ packets++;
+ if (packets >= 50) {
+ break;
+ }
}
}
--
2.1.0
next prev parent reply other threads:[~2014-12-19 13:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-19 13:18 [Qemu-devel] [PULL 0/5] Net patches Stefan Hajnoczi
2014-12-19 13:18 ` Stefan Hajnoczi [this message]
2014-12-19 13:18 ` [Qemu-devel] [PULL 2/5] net: don't use set/get_pointer() in set/get_netdev() Stefan Hajnoczi
2014-12-19 13:18 ` [Qemu-devel] [PULL 3/5] net: Fuse g_malloc(); memset() into g_new0() Stefan Hajnoczi
2014-12-19 13:18 ` [Qemu-devel] [PULL 4/5] net: Use g_new() & friends where that makes obvious sense Stefan Hajnoczi
2014-12-19 13:18 ` [Qemu-devel] [PULL 5/5] e1000: defer packets until BM enabled Stefan Hajnoczi
2014-12-19 14:21 ` Michael S. Tsirkin
2014-12-21 23:16 ` [Qemu-devel] [PULL 0/5] Net patches Peter Maydell
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=1418995104-26262-2-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=peter.maydell@linaro.org \
--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).