qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v4 12/23] cpus: push BQL lock to qemu_*_wait


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH v4 12/23] cpus: push BQL lock to qemu_*_wait_io_event
Date: Fri, 19 Jan 2018 09:55:08 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]