[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/23] Flatten the main loop
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 06/23] Flatten the main loop |
Date: |
Fri, 4 Feb 2011 13:47:09 -0200 |
From: Jan Kiszka <address@hidden>
First of all, vm_can_run is a misnomer, it actually means "no request
pending". Moreover, there is no need to check all pending requests
twice, the first time via the inner loop check and then again when
actually processing the requests. We can simply remove the inner loop
and do the checks directly.
Signed-off-by: Jan Kiszka <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
---
vl.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/vl.c b/vl.c
index 6aa896c..837be97 100644
--- a/vl.c
+++ b/vl.c
@@ -1389,14 +1389,16 @@ void main_loop_wait(int nonblocking)
}
-static int vm_can_run(void)
+#ifndef CONFIG_IOTHREAD
+static int vm_request_pending(void)
{
- return !(powerdown_requested ||
- reset_requested ||
- shutdown_requested ||
- debug_requested ||
- vmstop_requested);
+ return powerdown_requested ||
+ reset_requested ||
+ shutdown_requested ||
+ debug_requested ||
+ vmstop_requested;
}
+#endif
qemu_irq qemu_system_powerdown;
@@ -1411,21 +1413,19 @@ static void main_loop(void)
qemu_main_loop_start();
for (;;) {
- do {
#ifndef CONFIG_IOTHREAD
- nonblocking = cpu_exec_all();
- if (!vm_can_run()) {
- nonblocking = true;
- }
+ nonblocking = cpu_exec_all();
+ if (vm_request_pending()) {
+ nonblocking = true;
+ }
#endif
#ifdef CONFIG_PROFILER
- ti = profile_getclock();
+ ti = profile_getclock();
#endif
- main_loop_wait(nonblocking);
+ main_loop_wait(nonblocking);
#ifdef CONFIG_PROFILER
- dev_time += profile_getclock() - ti;
+ dev_time += profile_getclock() - ti;
#endif
- } while (vm_can_run());
if ((r = qemu_debug_requested())) {
vm_stop(r);
--
1.7.2.3
- Re: [Qemu-devel] [PATCH 22/23] x86: Fix MCA broadcast parameters for TCG case, (continued)
- [Qemu-devel] [PATCH 08/23] kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 16/23] kvm: Fix race between timer signals and vcpu entry under !IOTHREAD, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 02/23] Stop current VCPU on synchronous reset requests, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 05/23] Leave inner main_loop faster on pending requests, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 20/23] kvm: Remove static return code of kvm_handle_io, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 10/23] kvm: Provide sigbus services arch-independently, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 15/23] Set up signalfd under !CONFIG_IOTHREAD, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 12/23] kvm: Set up signal mask also for !CONFIG_IOTHREAD, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 06/23] Flatten the main loop,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 01/23] Prevent abortion on multiple VCPU kicks, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 04/23] Trigger exit from cpu_exec_all on pending IO events, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 14/23] kvm: Call qemu_kvm_eat_signals also under !CONFIG_IOTHREAD, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 09/23] kvm: Handle kvm_init_vcpu errors, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 03/23] Process vmstop requests in IO thread, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 11/23] Refactor signal setup functions in cpus.c, Marcelo Tosatti, 2011/02/04
- [Qemu-devel] [PATCH 17/23] kvm: Add MCE signal support for !CONFIG_IOTHREAD, Marcelo Tosatti, 2011/02/04
- Re: [Qemu-devel] [PATCH 00/23] [PULL] qemu-kvm.git uq/master queue, Anthony Liguori, 2011/02/04