* [Qemu-devel] [PATCH 0/2] io-thread fixes
@ 2009-08-25 22:13 Glauber Costa
2009-08-25 22:13 ` [Qemu-devel] [PATCH 1/2] unlock iothread before running vpu Glauber Costa
0 siblings, 1 reply; 3+ messages in thread
From: Glauber Costa @ 2009-08-25 22:13 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Hi,
Our iothread still does not work reliably, but with those fixes
I can get a little bit further.
Anthony, please let me know what you think of it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 1/2] unlock iothread before running vpu
2009-08-25 22:13 [Qemu-devel] [PATCH 0/2] io-thread fixes Glauber Costa
@ 2009-08-25 22:13 ` Glauber Costa
2009-08-25 22:13 ` [Qemu-devel] [PATCH 2/2] do not issue ioctl from within the io thread Glauber Costa
0 siblings, 1 reply; 3+ messages in thread
From: Glauber Costa @ 2009-08-25 22:13 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
kvm-all.c | 4 ++++
qemu-common.h | 4 ++++
vl.c | 9 ++++-----
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index f669c3a..d9d7e06 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -591,7 +591,11 @@ int kvm_cpu_exec(CPUState *env)
}
kvm_arch_pre_run(env, run);
+
+ qemu_mutex_unlock_iothread();
ret = kvm_vcpu_ioctl(env, KVM_RUN, 0);
+ qemu_mutex_lock_iothread();
+
kvm_arch_post_run(env, run);
if (ret == -EINTR || ret == -EAGAIN) {
diff --git a/qemu-common.h b/qemu-common.h
index 74ac88f..69486ed 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -207,6 +207,10 @@ void qemu_notify_event(void);
void qemu_cpu_kick(void *env);
int qemu_cpu_self(void *env);
+
+void qemu_mutex_lock_iothread(void);
+void qemu_mutex_unlock_iothread(void);
+
#ifdef CONFIG_USER_ONLY
#define qemu_init_vcpu(env) do { } while (0)
#else
diff --git a/vl.c b/vl.c
index c164f45..aa5047e 100644
--- a/vl.c
+++ b/vl.c
@@ -3595,14 +3595,13 @@ void qemu_notify_event(void)
}
}
-#define qemu_mutex_lock_iothread() do { } while (0)
-#define qemu_mutex_unlock_iothread() do { } while (0)
-
void vm_stop(int reason)
{
do_vm_stop(reason);
}
+void qemu_mutex_lock_iothread(void) {}
+void qemu_mutex_unlock_iothread(void) {}
#else /* CONFIG_IOTHREAD */
#include "qemu-thread.h"
@@ -3788,7 +3787,7 @@ static void qemu_signal_lock(unsigned int msecs)
qemu_mutex_unlock(&qemu_fair_mutex);
}
-static void qemu_mutex_lock_iothread(void)
+void qemu_mutex_lock_iothread(void)
{
if (kvm_enabled()) {
qemu_mutex_lock(&qemu_fair_mutex);
@@ -3798,7 +3797,7 @@ static void qemu_mutex_lock_iothread(void)
qemu_signal_lock(100);
}
-static void qemu_mutex_unlock_iothread(void)
+void qemu_mutex_unlock_iothread(void)
{
qemu_mutex_unlock(&qemu_global_mutex);
}
--
1.6.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 2/2] do not issue ioctl from within the io thread
2009-08-25 22:13 ` [Qemu-devel] [PATCH 1/2] unlock iothread before running vpu Glauber Costa
@ 2009-08-25 22:13 ` Glauber Costa
0 siblings, 0 replies; 3+ messages in thread
From: Glauber Costa @ 2009-08-25 22:13 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
According to Documentation/kvm/api.txt, (and well, to common sense),
we should not be calling vcpu ioctls from within the iothread.
Since vcpu initialization issues a vcpu ioctl, move it a little bit
further in time to prevent it.
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
vl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vl.c b/vl.c
index aa5047e..89051b8 100644
--- a/vl.c
+++ b/vl.c
@@ -3675,6 +3675,7 @@ static void *kvm_cpu_thread_fn(void *arg)
block_io_signals();
qemu_thread_self(env->thread);
+ kvm_init_vcpu(env);
/* signal CPU creation */
qemu_mutex_lock(&qemu_global_mutex);
@@ -3870,7 +3871,6 @@ static void tcg_init_vcpu(void *_env)
static void kvm_start_vcpu(CPUState *env)
{
- kvm_init_vcpu(env);
env->thread = qemu_mallocz(sizeof(QemuThread));
env->halt_cond = qemu_mallocz(sizeof(QemuCond));
qemu_cond_init(env->halt_cond);
--
1.6.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-26 2:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-25 22:13 [Qemu-devel] [PATCH 0/2] io-thread fixes Glauber Costa
2009-08-25 22:13 ` [Qemu-devel] [PATCH 1/2] unlock iothread before running vpu Glauber Costa
2009-08-25 22:13 ` [Qemu-devel] [PATCH 2/2] do not issue ioctl from within the io thread Glauber Costa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).