From: Liu Ping Fan <qemulist@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Jan Kiszka <jan.kiszka@siemens.com>
Subject: [Qemu-devel] [PATCH 3/3] slirp: fill mainloop timeout with more precise value
Date: Tue, 13 Aug 2013 11:15:41 +0800 [thread overview]
Message-ID: <1376363741-19420-4-git-send-email-pingfank@linux.vnet.ibm.com> (raw)
In-Reply-To: <1376363741-19420-1-git-send-email-pingfank@linux.vnet.ibm.com>
If slirp needs to emulate tcp timeout, then the timeout value
for mainloop should be more precise, which is determined by
slirp's fasttimo or slowtimo.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
main-loop.c | 2 +-
slirp/slirp.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/main-loop.c b/main-loop.c
index a44fff6..04120d2 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -458,8 +458,8 @@ int main_loop_wait(int nonblocking)
g_array_set_size(gpollfds, 0); /* reset for new iteration */
/* XXX: separate device handlers from system ones */
#ifdef CONFIG_SLIRP
- slirp_update_timeout(&timeout);
slirp_pollfds_fill(gpollfds);
+ slirp_update_timeout(&timeout);
#endif
qemu_iohandler_fill(gpollfds);
ret = os_host_main_loop_wait(timeout);
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 1deaad9..af66006 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -262,9 +262,27 @@ void slirp_cleanup(Slirp *slirp)
void slirp_update_timeout(uint32_t *timeout)
{
+ Slirp *slirp;
+
if (!QTAILQ_EMPTY(&slirp_instances)) {
*timeout = MIN(1000, *timeout);
}
+ if (*timeout <= TIMEOUT_FAST) {
+ return;
+ }
+
+ /* If we have tcp timeout with slirp, then we will fill @timeout with
+ * more precise value.
+ */
+ QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
+ if (slirp->time_fasttimo) {
+ *timeout = TIMEOUT_FAST;
+ break;
+ }
+ if (slirp->do_slowtimo) {
+ *timeout = MIN(TIMEOUT_SLOW, *timeout);
+ }
+ }
}
void slirp_pollfds_fill(GArray *pollfds)
--
1.8.1.4
next prev parent reply other threads:[~2013-08-13 3:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-13 3:15 [Qemu-devel] [PATCH 0/3] slirp: fill mainloop with more precise timeout value Liu Ping Fan
2013-08-13 3:15 ` [Qemu-devel] [PATCH 1/3] slirp: make timeout local Liu Ping Fan
2013-08-13 8:03 ` Jan Kiszka
2013-08-13 8:30 ` liu ping fan
2013-08-13 3:15 ` [Qemu-devel] [PATCH 2/3] slirp: define timeout as macro Liu Ping Fan
2013-08-13 8:04 ` Jan Kiszka
2013-08-13 3:15 ` Liu Ping Fan [this message]
2013-08-13 8:19 ` [Qemu-devel] [PATCH 3/3] slirp: fill mainloop timeout with more precise value Jan Kiszka
2013-08-13 8:25 ` liu ping fan
2013-08-13 8:29 ` Jan Kiszka
2013-08-13 8:33 ` liu ping fan
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=1376363741-19420-4-git-send-email-pingfank@linux.vnet.ibm.com \
--to=qemulist@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).