All of lore.kernel.org
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: Glauber Costa <glommer@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Main loop
Date: Tue, 29 Sep 2009 03:57:58 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.64.0909290353020.11081@linmac.oyster.ru> (raw)
In-Reply-To: <20090928135723.GK29735@mothafucka.localdomain>

On Mon, 28 Sep 2009, Glauber Costa wrote:

> > > Glauber spent some time with the IO thread recently.  Any reason you didn't
> > > start with the existing IO thread (besides the fact that it doesn't work with
> > > TCG)?
> > > 
> > 
> > Because i wasn't writing a replacement for IO Thread to begin with (btw it
> > does work with TCG), what it doesn't do is play nicely with icount[1], 
> > work on Windows, and for mysterious reasons still requires alarm timers, 
> > it also deadlocks for me when killing QEMU windows while running smp 
> > guest, but that's easily corrected mistake somewhere i guess.
> 

[..snip..]

> 
> Note that I don't think it requires alarm timers at all, by design. So, 
> again, why should we drop what we have in favour of your implementation?

It doesn't require them, yet no one has come up even with the
following crude patch which brings the time of booting debian netinst
closer to mtloop. That said the real reason why iothread should be
dropped is that it's basically a big pile of shit, not only alarm
timers weren't dropped the code uses pthread_cond_timedwait all over
the place for NO good reason without ever checking the result thus
wasting time, 2 seconds of the boot time were chopped of just by
replacing it with palin wait, with such an attention to detail i
wonder what other monsters are lurking there.

diff --git a/vl.c b/vl.c
index c6c6a6b..fb04b25 100644
--- a/vl.c
+++ b/vl.c
@@ -718,6 +718,14 @@ static void qemu_rearm_alarm_timer(struct 
qemu_alarm_timer *t)
 
 static struct qemu_alarm_timer *alarm_timer;
 
+static int notimer_start_timer(struct qemu_alarm_timer *t)
+{
+    return 0;
+}
+static void notimer_stop_timer(struct qemu_alarm_timer *t)
+{
+}
+
 #ifdef _WIN32
 
 struct qemu_alarm_win32 {
@@ -816,6 +824,9 @@ static void init_icount_adjust(void)
 }
 
 static struct qemu_alarm_timer alarm_timers[] = {
+#ifdef CONFIG_IOTHREAD
+    {"notimer", 0, notimer_start_timer, notimer_stop_timer, NULL, NULL},
+#endif
 #ifndef _WIN32
 #ifdef __linux__
     {"dynticks", ALARM_FLAG_DYNTICKS, dynticks_start_timer,
@@ -1167,7 +1178,7 @@ static int64_t qemu_next_deadline(void)
     return delta;
 }
 
-#if defined(__linux__) || defined(_WIN32)
+#if defined(__linux__) || defined(_WIN32) || defined(CONFIG_IOTHREAD)
 static uint64_t qemu_next_deadline_dyntick(void)
 {
     int64_t delta;
@@ -4199,7 +4210,11 @@ static int qemu_calculate_timeout(void)
 
     return timeout;
 #else /* CONFIG_IOTHREAD */
-    return 1000;
+    if (alarm_timer->start == notimer_start_timer) {
+        return qemu_next_deadline_dyntick() / 1000;
+    } else {
+        return 1000;
+    }
 #endif
 }
 

-- 
mailto:av1474@comtv.ru

  parent reply	other threads:[~2009-09-28 23:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-26 23:55 [Qemu-devel] Main loop malc
2009-09-27  0:49 ` Anthony Liguori
2009-09-27 10:55   ` malc
2009-09-27 14:05     ` Anthony Liguori
2009-09-27 14:39       ` malc
2009-09-28 13:57         ` Glauber Costa
2009-09-28 18:50           ` malc
2009-09-28 19:35             ` Anthony Liguori
2009-09-28 21:21               ` Glauber Costa
2009-09-28 23:57           ` malc [this message]
2009-09-27 14:31     ` malc
2009-09-27 14:23 ` Blue Swirl
2009-09-27 14:35   ` malc
2009-09-27 17:43 ` malc
     [not found] ` <m3fxa7jug0.fsf@neno.mitica>
2009-09-28  9:42   ` [Qemu-devel] " malc
     [not found]     ` <m3pr9bidy9.fsf@neno.mitica>
2009-09-28 10:19       ` malc

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=Pine.LNX.4.64.0909290353020.11081@linmac.oyster.ru \
    --to=av1474@comtv.ru \
    --cc=glommer@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.