qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH qom-cpu 10/59] cpus: Simplify qemu_tcg_wait_io_e


From: li guang
Subject: Re: [Qemu-devel] [PATCH qom-cpu 10/59] cpus: Simplify qemu_tcg_wait_io_event() and qemu_tcg_cpu_thread_fn()
Date: Mon, 10 Jun 2013 10:20:13 +0800

Reviewed-by: liguang <address@hidden>

在 2013-06-09日的 21:12 +0200,Andreas Färber写道:
> Use new qemu_for_each_cpu().
> 
> Signed-off-by: Andreas Färber <address@hidden>
> ---
>  cpus.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 9195bc3..a8572a9 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -703,10 +703,13 @@ static void qemu_wait_io_event_common(CPUState *cpu)
>      cpu->thread_kicked = false;
>  }
>  
> -static void qemu_tcg_wait_io_event(void)
> +static void qemu_wait_one_io_event_common(CPUState *cpu, void *data)
>  {
> -    CPUArchState *env;
> +    qemu_wait_io_event_common(cpu);
> +}
>  
> +static void qemu_tcg_wait_io_event(void)
> +{
>      while (all_cpu_threads_idle()) {
>         /* Start accounting real time to the virtual clock if the CPUs
>            are idle.  */
> @@ -718,9 +721,7 @@ static void qemu_tcg_wait_io_event(void)
>          qemu_cond_wait(&qemu_io_proceeded_cond, &qemu_global_mutex);
>      }
>  
> -    for (env = first_cpu; env != NULL; env = env->next_cpu) {
> -        qemu_wait_io_event_common(ENV_GET_CPU(env));
> -    }
> +    qemu_for_each_cpu(qemu_wait_one_io_event_common, NULL);
>  }
>  
>  static void qemu_kvm_wait_io_event(CPUArchState *env)
> @@ -825,7 +826,6 @@ static void tcg_signal_cpu_creation(CPUState *cpu, void 
> *data)
>  static void *qemu_tcg_cpu_thread_fn(void *arg)
>  {
>      CPUState *cpu = arg;
> -    CPUArchState *env;
>  
>      qemu_tcg_init_cpu_signals();
>      qemu_thread_get_self(cpu->thread);
> @@ -839,9 +839,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
>          qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
>  
>          /* process any pending work */
> -        for (env = first_cpu; env != NULL; env = env->next_cpu) {
> -            qemu_wait_io_event_common(ENV_GET_CPU(env));
> -        }
> +        qemu_for_each_cpu(qemu_wait_one_io_event_common, NULL);
>      }
>  
>      while (1) {





reply via email to

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