[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH V7 08/19] tcg: remove tcg_halt_cond global v
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC PATCH V7 08/19] tcg: remove tcg_halt_cond global variable. |
Date: |
Mon, 10 Aug 2015 18:12:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 10/08/2015 17:27, address@hidden wrote:
> From: KONRAD Frederic <address@hidden>
>
> This removes tcg_halt_cond global variable.
> We need one QemuCond per virtual cpu for multithread TCG.
>
> Signed-off-by: KONRAD Frederic <address@hidden>
> ---
> cpus.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index 2250296..2550be2 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -815,7 +815,6 @@ static unsigned iothread_requesting_mutex;
> static QemuThread io_thread;
>
> static QemuThread *tcg_cpu_thread;
> -static QemuCond *tcg_halt_cond;
>
> /* cpu creation */
> static QemuCond qemu_cpu_cond;
> @@ -1038,15 +1037,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_tcg_wait_io_event(CPUState *cpu)
> {
> - CPUState *cpu;
> -
> while (all_cpu_threads_idle()) {
> /* Start accounting real time to the virtual clock if the CPUs
> are idle. */
> qemu_clock_warp(QEMU_CLOCK_VIRTUAL);
> - qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
> + qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
> }
>
> while (iothread_requesting_mutex) {
> @@ -1166,7 +1163,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
>
> /* wait for initial kick-off after machine start */
> while (first_cpu->stopped) {
> - qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
> + qemu_cond_wait(first_cpu->halt_cond, &qemu_global_mutex);
>
> /* process any pending work */
> CPU_FOREACH(cpu) {
> @@ -1187,7 +1184,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
> qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
> }
> }
> - qemu_tcg_wait_io_event();
> + qemu_tcg_wait_io_event(QTAILQ_FIRST(&cpus));
> }
>
> return NULL;
> @@ -1328,12 +1325,12 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
>
> tcg_cpu_address_space_init(cpu, cpu->as);
>
> + cpu->halt_cond = g_malloc0(sizeof(QemuCond));
> + qemu_cond_init(cpu->halt_cond);
> +
> /* share a single thread for all cpus with TCG */
> if (!tcg_cpu_thread) {
> cpu->thread = g_malloc0(sizeof(QemuThread));
> - cpu->halt_cond = g_malloc0(sizeof(QemuCond));
> - qemu_cond_init(cpu->halt_cond);
> - tcg_halt_cond = cpu->halt_cond;
> snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG",
> cpu->cpu_index);
> qemu_thread_create(cpu->thread, thread_name, qemu_tcg_cpu_thread_fn,
> @@ -1347,7 +1344,6 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
> tcg_cpu_thread = cpu->thread;
> } else {
> cpu->thread = tcg_cpu_thread;
> - cpu->halt_cond = tcg_halt_cond;
> }
> }
>
>
This should be squashed in "tcg: switch on multithread".
Paolo
Re: [Qemu-devel] [RFC PATCH V7 07/19] protect TBContext with tb_lock., Frederic Konrad, 2015/08/12
[Qemu-devel] [RFC PATCH V7 08/19] tcg: remove tcg_halt_cond global variable., fred . konrad, 2015/08/10
- Re: [Qemu-devel] [RFC PATCH V7 08/19] tcg: remove tcg_halt_cond global variable.,
Paolo Bonzini <=
[Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution, fred . konrad, 2015/08/10
- Re: [Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution, Paolo Bonzini, 2015/08/10
- Re: [Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution, Frederic Konrad, 2015/08/11
- Re: [Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution, Alex Bennée, 2015/08/11
- Re: [Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution, Frederic Konrad, 2015/08/11
- Re: [Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution, Paolo Bonzini, 2015/08/12
- Re: [Qemu-devel] [RFC PATCH V7 09/19] Drop global lock during TCG code execution, Frederic Konrad, 2015/08/12
[Qemu-devel] [RFC PATCH V7 11/19] tcg: switch on multithread., fred . konrad, 2015/08/10