aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysemu.h2
-rw-r--r--vl.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/sysemu.h b/sysemu.h
index bd830e5..9090457 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -67,7 +67,7 @@ void do_info_snapshots(Monitor *mon);
void qemu_announce_self(void);
-void main_loop_wait(int nonblocking);
+int main_loop_wait(int nonblocking);
bool qemu_savevm_state_blocked(Monitor *mon);
int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
diff --git a/vl.c b/vl.c
index c52937a..9cd67a3 100644
--- a/vl.c
+++ b/vl.c
@@ -1321,7 +1321,7 @@ void qemu_system_vmstop_request(int reason)
qemu_notify_event();
}
-void main_loop_wait(int nonblocking)
+int main_loop_wait(int nonblocking)
{
fd_set rfds, wfds, xfds;
int ret, nfds;
@@ -1368,6 +1368,7 @@ void main_loop_wait(int nonblocking)
them. */
qemu_bh_poll();
+ return ret;
}
#ifndef CONFIG_IOTHREAD
@@ -1385,7 +1386,8 @@ qemu_irq qemu_system_powerdown;
static void main_loop(void)
{
- bool nonblocking = false;
+ bool nonblocking;
+ int last_io __attribute__ ((unused)) = 0;
#ifdef CONFIG_PROFILER
int64_t ti;
#endif
@@ -1394,7 +1396,9 @@ static void main_loop(void)
qemu_main_loop_start();
for (;;) {
-#ifndef CONFIG_IOTHREAD
+#ifdef CONFIG_IOTHREAD
+ nonblocking = !kvm_enabled() && last_io > 0;
+#else
nonblocking = cpu_exec_all();
if (vm_request_pending()) {
nonblocking = true;
@@ -1403,7 +1407,7 @@ static void main_loop(void)
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
- main_loop_wait(nonblocking);
+ last_io = main_loop_wait(nonblocking);
#ifdef CONFIG_PROFILER
dev_time += profile_getclock() - ti;
#endif