[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/37] Flatten the main loop
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 06/37] Flatten the main loop |
Date: |
Mon, 14 Feb 2011 13:22:35 -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 9c628f0..c9fa266 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.4
- [Qemu-devel] [PATCH 00/37] [PULL] qemu-kvm.git uq/master queue, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 29/37] kvm: Separate TCG from KVM cpu execution, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 05/37] Leave inner main_loop faster on pending requests, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 24/37] Refactor cpu_has_work/any_cpu_has_work in cpus.c, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 25/37] Fix a few coding style violations in cpus.c, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 32/37] kvm: x86: Catch and report failing IRQ and NMI injections, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 01/37] Prevent abortion on multiple VCPU kicks, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 18/37] Introduce VCPU self-signaling service, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 27/37] Refactor debug and vmstop request interface, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 06/37] Flatten the main loop,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 21/37] kvm: Leave kvm_cpu_exec directly after KVM_EXIT_SHUTDOWN, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 33/37] kvm: Remove unneeded memory slot reservation, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 10/37] kvm: Provide sigbus services arch-independently, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 26/37] Improve vm_stop reason declarations, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 08/37] kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 13/37] kvm: Refactor qemu_kvm_eat_signals, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 36/37] kvm: Make kvm_state globally available, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 03/37] Process vmstop requests in IO thread, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 19/37] kvm: Unconditionally reenter kernel after IO exits, Marcelo Tosatti, 2011/02/14
- [Qemu-devel] [PATCH 09/37] kvm: Handle kvm_init_vcpu errors, Marcelo Tosatti, 2011/02/14