[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 03/24] Stop current VCPU on synchronous reset req
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH v2 03/24] Stop current VCPU on synchronous reset requests |
Date: |
Tue, 1 Feb 2011 22:15:43 +0100 |
From: Jan Kiszka <address@hidden>
If some I/O operation ends up calling qemu_system_reset_request in VCPU
context, we record this and inform the io-thread, but we do not
terminate the VCPU loop. This can lead to fairly unexpected behavior if
the triggering reset operation is supposed to work synchronously.
Fix this for TCG (when run in deterministic I/O mode) by setting the
VCPU on stop and issuing a cpu_exit. KVM requires some more work on its
VCPU loop.
[ ported from qemu-kvm ]
Signed-off-by: Jan Kiszka <address@hidden>
---
cpus.c | 13 +++++++++----
cpus.h | 1 +
vl.c | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/cpus.c b/cpus.c
index ab6e40e..ceb3a83 100644
--- a/cpus.c
+++ b/cpus.c
@@ -99,6 +99,14 @@ void cpu_synchronize_all_post_init(void)
}
}
+void cpu_stop_current(void)
+{
+ if (cpu_single_env) {
+ cpu_single_env->stopped = 1;
+ cpu_exit(cpu_single_env);
+ }
+}
+
int cpu_is_stopped(CPUState *env)
{
return !vm_running || env->stopped;
@@ -863,10 +871,7 @@ void vm_stop(int reason)
* FIXME: should not return to device code in case
* vm_stop() has been requested.
*/
- if (cpu_single_env) {
- cpu_exit(cpu_single_env);
- cpu_single_env->stop = 1;
- }
+ cpu_stop_current();
return;
}
do_vm_stop(reason);
diff --git a/cpus.h b/cpus.h
index bf4d9bb..4cadb64 100644
--- a/cpus.h
+++ b/cpus.h
@@ -6,6 +6,7 @@ int qemu_init_main_loop(void);
void qemu_main_loop_start(void);
void resume_all_vcpus(void);
void pause_all_vcpus(void);
+void cpu_stop_current(void);
/* vl.c */
extern int smp_cores;
diff --git a/vl.c b/vl.c
index 33f844f..db24a05 100644
--- a/vl.c
+++ b/vl.c
@@ -1278,6 +1278,7 @@ void qemu_system_reset_request(void)
} else {
reset_requested = 1;
}
+ cpu_stop_current();
qemu_notify_event();
}
--
1.7.1
- [Qemu-devel] [PATCH v2 20/24] kvm: Unconditionally reenter kernel after IO exits, (continued)
- [Qemu-devel] [PATCH v2 20/24] kvm: Unconditionally reenter kernel after IO exits, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 08/24] kvm: Report proper error on GET_VCPU_MMAP_SIZE failures, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 19/24] Introduce VCPU self-signaling service, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 05/24] Trigger exit from cpu_exec_all on pending IO events, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 02/24] Prevent abortion on multiple VCPU kicks, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 06/24] Leave inner main_loop faster on pending requests, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 10/24] kvm: Handle kvm_init_vcpu errors, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 09/24] kvm: Drop redundant kvm_enabled from kvm_cpu_thread_fn, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 24/24] Fix a few coding style violations in cpus.c, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 15/24] kvm: Call qemu_kvm_eat_signals also under !CONFIG_IOTHREAD, Jan Kiszka, 2011/02/01
- [Qemu-devel] [PATCH v2 03/24] Stop current VCPU on synchronous reset requests,
Jan Kiszka <=
- [Qemu-devel] [PATCH v2 12/24] Refactor signal setup functions in cpus.c, Jan Kiszka, 2011/02/01
- [Qemu-devel] Re: [PATCH v2 00/24] [uq/master] Patch queue, part II, Marcelo Tosatti, 2011/02/04