@@ -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) {
@@ -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
@@ -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);
}
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(-)