[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/8] Fix cpu_exit for tcp_cpu_exec
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 4/8] Fix cpu_exit for tcp_cpu_exec |
Date: |
Fri, 25 Jun 2010 16:56:52 +0200 |
If a cpu_exit request is pending, ensure that we leave the CPU loop
quickly. For this purpose, keep the global exit_request pending until
we are about to leave tcg_cpu_exec. Also, immediately break out of the
SMP loop if the request is set, do not run till the end of the chain.
This preserves the VCPU scheduling order in SMP mode.
Signed-off-by: Jan Kiszka <address@hidden>
---
cpu-exec.c | 3 +--
cpus.c | 3 ++-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index 5f88f3f..d170566 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -237,9 +237,8 @@ int cpu_exec(CPUState *env1)
barrier();
env = env1;
- if (exit_request) {
+ if (unlikely(exit_request)) {
env->exit_request = 1;
- exit_request = 0;
}
#if defined(TARGET_I386)
diff --git a/cpus.c b/cpus.c
index 37e6b33..ff5e804 100644
--- a/cpus.c
+++ b/cpus.c
@@ -769,7 +769,7 @@ bool tcg_cpu_exec(void)
if (next_cpu == NULL)
next_cpu = first_cpu;
- for (; next_cpu != NULL; next_cpu = next_cpu->next_cpu) {
+ for (; next_cpu != NULL && !exit_request; next_cpu = next_cpu->next_cpu) {
CPUState *env = cur_cpu = next_cpu;
qemu_clock_enable(vm_clock,
@@ -788,6 +788,7 @@ bool tcg_cpu_exec(void)
break;
}
}
+ exit_request = 0;
return tcg_has_work();
}
--
1.7.1
- [Qemu-devel] [PATCH 0/8] Fix various IO-thread breakages, Jan Kiszka, 2010/06/25
- [Qemu-devel] [PATCH 6/8] Drop redundant global cur_cpu variable, Jan Kiszka, 2010/06/25
- [Qemu-devel] [PATCH 8/8] Rework debug exception processing for gdb use, Jan Kiszka, 2010/06/25
- [Qemu-devel] [PATCH 3/8] Init qemu_system_cond, Jan Kiszka, 2010/06/25
- [Qemu-devel] [PATCH 1/8] Introduce proper compiler barrier, Jan Kiszka, 2010/06/25
- [Qemu-devel] [PATCH 2/8] Fix cpu_unlink_tb race, Jan Kiszka, 2010/06/25
- [Qemu-devel] [PATCH 5/8] Fix qemu_wait_io_event processing in io-thread mode, Jan Kiszka, 2010/06/25
- [Qemu-devel] [PATCH 4/8] Fix cpu_exit for tcp_cpu_exec,
Jan Kiszka <=
- [Qemu-devel] [PATCH 7/8] Rename tcg_cpu_exec and tcg_has_work, Jan Kiszka, 2010/06/25
- [Qemu-devel] Re: [PATCH 0/8] Fix various IO-thread breakages, Paolo Bonzini, 2010/06/27
- [Qemu-devel] Re: [PATCH 0/8] Fix various IO-thread breakages, Marcelo Tosatti, 2010/06/28