diff mbox series

[v2,5/9] cpus: Use qemu_cond_wait_iothread() where proper

Message ID 20210723193444.133412-6-peterx@redhat.com (mailing list archive)
State New, archived
Headers show
Series memory: Sanity checks memory transaction when releasing BQL | expand

Commit Message

Peter Xu July 23, 2021, 7:34 p.m. UTC
The helper is introduced but we've still got plenty of places that are directly
referencing the qemu_global_mutex itself.  Spread the usage.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 softmmu/cpus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

David Hildenbrand July 27, 2021, 12:49 p.m. UTC | #1
On 23.07.21 21:34, Peter Xu wrote:
> The helper is introduced but we've still got plenty of places that are directly
> referencing the qemu_global_mutex itself.  Spread the usage.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>   softmmu/cpus.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/softmmu/cpus.c b/softmmu/cpus.c
> index 52adc98d39..94c2804192 100644
> --- a/softmmu/cpus.c
> +++ b/softmmu/cpus.c
> @@ -442,7 +442,7 @@ void qemu_wait_io_event(CPUState *cpu)
>               slept = true;
>               qemu_plugin_vcpu_idle_cb(cpu);
>           }
> -        qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
> +        qemu_cond_wait_iothread(cpu->halt_cond);
>       }
>       if (slept) {
>           qemu_plugin_vcpu_resume_cb(cpu);
> @@ -585,7 +585,7 @@ void pause_all_vcpus(void)
>       replay_mutex_unlock();
>   
>       while (!all_vcpus_paused()) {
> -        qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
> +        qemu_cond_wait_iothread(&qemu_pause_cond);
>           CPU_FOREACH(cpu) {
>               qemu_cpu_kick(cpu);
>           }
> @@ -656,7 +656,7 @@ void qemu_init_vcpu(CPUState *cpu)
>       cpus_accel->create_vcpu_thread(cpu);
>   
>       while (!cpu->created) {
> -        qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
> +        qemu_cond_wait_iothread(&qemu_cpu_cond);
>       }
>   }
>   
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 52adc98d39..94c2804192 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -442,7 +442,7 @@  void qemu_wait_io_event(CPUState *cpu)
             slept = true;
             qemu_plugin_vcpu_idle_cb(cpu);
         }
-        qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
+        qemu_cond_wait_iothread(cpu->halt_cond);
     }
     if (slept) {
         qemu_plugin_vcpu_resume_cb(cpu);
@@ -585,7 +585,7 @@  void pause_all_vcpus(void)
     replay_mutex_unlock();
 
     while (!all_vcpus_paused()) {
-        qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
+        qemu_cond_wait_iothread(&qemu_pause_cond);
         CPU_FOREACH(cpu) {
             qemu_cpu_kick(cpu);
         }
@@ -656,7 +656,7 @@  void qemu_init_vcpu(CPUState *cpu)
     cpus_accel->create_vcpu_thread(cpu);
 
     while (!cpu->created) {
-        qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
+        qemu_cond_wait_iothread(&qemu_cpu_cond);
     }
 }