qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v2 04/11] cpus: Wrap mutex used to protect CPU wor


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC v2 04/11] cpus: Wrap mutex used to protect CPU work
Date: Mon, 11 Jul 2016 13:06:46 +0100
User-agent: mu4e 0.9.17; emacs 25.0.95.9

Sergey Fedorov <address@hidden> writes:

> From: Sergey Fedorov <address@hidden>
>
> This will be useful to enable CPU work on user mode emulation.
>
> Signed-off-by: Sergey Fedorov <address@hidden>
> Signed-off-by: Sergey Fedorov <address@hidden>

Reviewed-by: Alex Bennée <address@hidden>

> ---
>  cpus.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 04687c85bcd4..f80ed2aeefdd 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -910,6 +910,11 @@ void qemu_init_cpu_loop(void)
>      qemu_thread_get_self(&io_thread);
>  }
>
> +static QemuMutex *qemu_get_cpu_work_mutex(void)
> +{
> +    return &qemu_global_mutex;
> +}
> +
>  static void queue_work_on_cpu(CPUState *cpu, struct qemu_work_item *wi)
>  {
>      qemu_mutex_lock(&cpu->work_mutex);
> @@ -943,7 +948,7 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, void 
> *data)
>      while (!atomic_mb_read(&wi.done)) {
>          CPUState *self_cpu = current_cpu;
>
> -        qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex);
> +        qemu_cond_wait(&qemu_work_cond, qemu_get_cpu_work_mutex());
>          current_cpu = self_cpu;
>      }
>  }


--
Alex Bennée



reply via email to

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