On 19/01/2018 09:44, Pavel Dovgalyuk wrote:
> static void qemu_wait_io_event(CPUState *cpu)
> {
> + qemu_mutex_lock_iothread();
> +
> while (cpu_thread_is_idle(cpu)) {
> qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
> }
This function locks the iothread and never unlocks it. Please test your
patches better.
> @@ -1190,6 +1194,8 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
>
> /* signal CPU creation */
> cpu->created = true;
> + qemu_mutex_unlock_iothread();
> +
> qemu_cond_signal(&qemu_cpu_cond);
>
> do {
This function calls qemu_wait_io_event with BQL not taken.
> @@ -1232,10 +1238,10 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
>
> /* signal CPU creation */
> cpu->created = true;
> + qemu_mutex_unlock_iothread();
> qemu_cond_signal(&qemu_cpu_cond);
>
> while (1) {
> - qemu_mutex_unlock_iothread();
> do {
> int sig;
> r = sigwait(&waitset, &sig);
> @@ -1246,6 +1252,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
> }
> qemu_mutex_lock_iothread();
> qemu_wait_io_event(cpu);
> + qemu_mutex_unlock_iothread();
This function calls it with BQL taken.
Even without the mistakes, these changes are hard to follow. If
possible, please separate the hax_vcpu_hax_exec and kvm_cpu_exec changes
to a separate patch.
Paolo